Unable to run ifdown eth0 && ifup eth0
In my case, I imaged an Ubuntu machine and laid the image on several others. I started having them come up with interfaces that weren't named eth0 and wlan0 but rather eth1 and wlan1.
Here's what happened: There is a file that ties the MAC address of each adapter to the name of each adapter (eth{n} wlan{n} etc.). If you boot up and the OS sees that eth0 is tied to some other MAC address (in my case, from the master machine) it will create a new interface called eth1 and things start breaking inside /etc/network/interfaces.
Solution: Delete the file /etc/udev/rules.d/70-persistent-net.rules
and reboot (sorry, OP). The file will be recreated at boot with the proper settings for this machine.
For those who experience this in the context of imaging like I did, think of deleting this file as sysprep. You'll want to delete that and then capture your image before next boot of the OS.
I can't be sure that my situation is the same as yours, but if it sounds like this makes sense, it shouldn't hurt to try it. Good luck
Related videos on Youtube
Admin
Updated on September 18, 2022Comments
-
Admin over 1 year
Joining our Ubuntu farm to a windows domain and after adding the DC's IP to /etc/network/interfaces, I try to bounce the interface as I've done on other Ubuntu servers and it errors out.
ifdown: interface eth0 not configured RTNETLINK answers: File exists Failed to bring up eth0
/etc/network# cat run/ifstate shows:
lo=lo eth2=eth2 eth1=eth1
I looked at /run/network/ifstate and added eth0=eth0 to the end of the file. Still cannot run the command
ifdown eth0 && ifup eth0
Due to the nature of this server, I need to keep reboots to a minimum. Does anyone have any ideas of what is causing this issue and how I can resolve it? We have another server with the same issue.
UPDATE: Here is the eth0 portion of my /etc/network/interfaces
auto lo iface lo inet loopback # Label public auto eth0 iface eth0 inet static address XXX.XXX.X95.56 netmask 255.255.255.0 gateway XXX.XXX.X95.1 iface eth0 inet6 static address 2001:XXXX:XXXX:XXX:XXXX:XXXX:XXXX:XXXX netmask 64 gateway fe80::def dns-nameservers 192.168.XXX.XXX 173.203.4.9 173.203.4.8
If I run
ifconfig eth0 down
the interface goes down butifconfig eth0 up
does not bring it back up. Ironically a nslookup of my AD domain works at this point. I assume it's now using the DNS entry I added to the LAN port to do this. Rebooting the server restores eth0.UPDATE 2: Running
sudo ifup -v eth0
Configuring interface eth0=eth0 (inet) run-parts --verbose /etc/network/if-pre-up.d ip addr add XXX.XXX.XX5.56/255.255.255.0 broadcast XXX.XXX.X95.255 dev eth0 label eth0 RTNETLINK answers: File exists Failed to bring up eth0.
-
chili555 almost 8 yearsDo you mind letting us have a look at:
cat /etc/network/interfaces
? -
Admin almost 8 yearsAdded to my question.
-
Admin almost 6 years**did you try
sudo ifconfig eth0 up
&&sudo ifconfig eth0 down
try check the interface also if it blocked usingsudo rfkill list
-
-
Fasterandhigher Rast almost 8 yearsMy
/etc/udev/rules.d/70-persistent-net.rules
is completely blank. I tried anyways. Same result. -
trademark almost 8 yearsI think I recall seeing this file named something else once or twice in the past. What are the contents of /etc/udev/rules.d/ ?