Why does eth0 keep resetting?

MannDude

Just a dude
vpsBoard Founder
Moderator
So trying to network two local Linux machines (Desktop PC to my Raspberry Pi), should be relatively simple for what I want but I keep encountering a problem.

I've assigned both PCs a local IP (sudo ifconfig eth0 192.168.4.1/2), on one PC the updated settings 'take hold' and remains. On the other PC the setting seems to reset automatically making it impossible for these two PCs to ping or communicate with each other.

Any idea on what could be causing this?

EXAMPLE: (Desktop PC)


[email protected]:~$ sudo ifconfig eth0 192.168.4.1
[sudo] password for curtis:
[email protected]:~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:21:85:62:24:c0
inet addr:192.168.4.1 Bcast:192.168.4.255 Mask:255.255.255.0
inet6 addr: fe80::221:85ff:fe62:24c0/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:3333 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2052 (2.0 KiB) TX bytes:788991 (770.4 KiB)
Interrupt:40 Base address:0xe000


Ok, then the same command ran about 5 minutes later.


[email protected]:~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:21:85:62:24:c0
inet6 addr: fe80::221:85ff:fe62:24c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:3421 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4104 (4.0 KiB) TX bytes:808920 (789.9 KiB)
Interrupt:40 Base address:0xe000


Reissue the command and I can communicate/ping/ssh with the other local PC again:


[email protected]:~$ sudo ifconfig eth0 192.168.4.1
[email protected]:~$ ping 192.168.4.2
PING 192.168.4.2 (192.168.4.2) 56(84) bytes of data.
64 bytes from 192.168.4.2: icmp_req=1 ttl=64 time=0.994 ms
64 bytes from 192.168.4.2: icmp_req=2 ttl=64 time=0.537 ms
64 bytes from 192.168.4.2: icmp_req=3 ttl=64 time=0.434 ms
64 bytes from 192.168.4.2: icmp_req=4 ttl=64 time=0.531 ms
64 bytes from 192.168.4.2: icmp_req=5 ttl=64 time=0.475 ms


The other PC maintains the eth0 configuration until a reboot is made, though it's a Raspberry Pi and will likely never need rebooted.
 
Last edited by a moderator:

jarland

The ocean is digital
Ubuntu loves taking over networking with it's own utilities. Have you tried adding the IP to the interface via the GUI utility?
 

maounique

Active Member
Ubuntu loves taking over networking with it's own utilities. Have you tried adding the IP to the interface via the GUI utility?
Or disable network manager or whatever it uses completely. I find it utterly annoying on Debian...
 

MannDude

Just a dude
vpsBoard Founder
Moderator
Ubuntu loves taking over networking with it's own utilities. Have you tried adding the IP to the interface via the GUI utility?
Ah, actually manually added the wired connection info to the Network manager seemed to do the trick (so far). Don't feel like rebooting right now to see if the configuration will remain, but good call.
 

mikho

Not to be taken seriously, ever!
Tha case with ubuntu is that if you can do it in the gui, do it or face the consequences.


I think Ubuntu does like windows does and have cronjob that compares current config against the saved config, if it's different, revert to the saved config.
 

wlanboy

Content Contributer
I think Ubuntu does like windows does and have cronjob that compares current config against the saved config, if it's different, revert to the saved config.
Ah, actually manually added the wired connection info to the Network manager seemed to do the trick (so far). Don't feel like rebooting right now to see if the configuration will remain, but good call.
My first thought was dhcp-client or avahi-daemon. But yes the network manager does have it's own configuration which is used to override all existing configs.

But you can disable this:


sudo stop network-manager
echo "manual" | sudo tee /etc/init/network-manager.override

And it has got a command line tool too:


nmcli help

And if you want to edit the connections look at this folders:

Code:
/etc/NetworkManager
/etc/NetworkManager/system-connections
 
Last edited by a moderator:

acd

New Member
In my opinion, the easiest way to make sure it works every time is to run a dhcpd somewhere on your network, whether that be a crappy dlink router or a full blown IPv4/IPv6 isc dhcpd. Static allocations are pretty easy to set up, usually. Even the most crappy hardware/software understands dhcp ethernet autoconfiguration.
 
Top