1

In my /etc/network/interfaces.d/eth0 I have set:

auto eth0
iface eth0 inet static
    address 10.0.0.25
    netmask 255.255.255.0
    gateway 10.0.0.1
    dns-nameservers 8.8.8.8 8.8.4.4

Which shall assign my local machine a static IP from the local network on my interface eth0.

After restarting the network with service networking restart I still have my old IP (192.168.178.25) assigned when checking with ifconfig

eth0      Link encap:Ethernet  HWaddr 09:c5:e3:f1:a3:05  
          inet addr:192.168.178.25  Bcast:192.168.178.255  Mask:255.255.255.0
          inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope:Link
          inet6 addr: XXXX:XXXX:XXXX:X:XXXX:XXXX:XXXX:XXXX/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21005449 errors:0 dropped:2187 overruns:0 frame:0
          TX packets:19834119 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15429610791 (15.4 GB)  TX bytes:12129886014 (12.1 GB)
          Interrupt:114 

Now to the funny part:

When pinging this machine on my local network, I get responses from either 10.0.0.25 or 192.168.178.25:

PING 10.0.0.25 (10.0.0.25) 56(84) bytes of data.
64 bytes from 10.0.0.25: icmp_seq=1 ttl=64 time=0.220 ms
64 bytes from 10.0.0.25: icmp_seq=2 ttl=64 time=0.189 ms
64 bytes from 10.0.0.25: icmp_seq=3 ttl=64 time=0.196 ms

--- 10.0.0.25 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.189/0.201/0.220/0.021 ms

PING 192.168.178.25 (192.168.178.25) 56(84) bytes of data.
64 bytes from 192.168.178.25: icmp_seq=1 ttl=64 time=0.189 ms
64 bytes from 192.168.178.25: icmp_seq=2 ttl=64 time=0.191 ms
64 bytes from 192.168.178.25: icmp_seq=3 ttl=64 time=0.191 ms

--- 192.168.178.25 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.189/0.190/0.191/0.011 ms

(As the gateway also has changed, I now get a different outside ip address than before while still routing the traffic via my old (gateway and) outside ip!?)

What safe way is there to get the newly assigned ip solely without rebooting the machine and by only using ssh and not loosing access?

Some people state ifdown eth0; ifup eth0 is the way to go, but some say this messes up the entire machines connection when run on ssh.

Flatron
  • 318
  • 2
  • 5
  • 19
  • The whole network pickle aside, run the ifdown/ifup commands from an `at` job. Your login shell will disappear when the `ifdown` runs and `ifup` will never happen. – Karen B Jul 13 '16 at 06:12
  • Thanks, after running `ifdown eth0; ifup eth0` within a tmux session I still got the same ip: `192.168.178.25` – Flatron Jul 13 '16 at 06:26
  • Are you sure your connection was coming in on `eth0`? – Karen B Jul 13 '16 at 06:27
  • 100% sure as the board used is a small dev board only having one physical gigabit ethernet socket. – Flatron Jul 13 '16 at 06:33
  • Do you have any configuration in `/etc/network/interfaces` which is overwriting your eth0 config? You could try checking the ARP table on your local machine after pinging both IP addresses and or run a tcpdump to see who is responding. – Mark Riddell Jul 13 '16 at 18:50

0 Answers0