31

I decided to get rid of network-manager for some reason, and now in order to get on the network, I have to run sudo ifup eth0. Here's what cat /etc/network/interfaces gives:

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

How do I ensure I don't perform this laborious process again... how do I get the network started automatically on boot-up?

6 Answers 6

32
sudo vim /etc/network/interfaces

DHCP

# Loopback
#
auto lo
iface lo inet loopback

# network card
auto eth0
iface eth0 inet dhcp

Static

# Loopback
#
auto lo
iface lo inet loopback

# network card
#
auto eth0
iface eth0 inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Restart networking.

sudo /etc/init.d/networking restart

If you use static, you might want to check /etc/resolv.conf to make sure name servers have been specified. It might look like this:

nameserver 208.67.222.222 # OpenDNS
nameserver 8.8.8.8        # Google
domain example.com
search example.com
3
  • [not solved]: 1) vim /etc/network/interfaces; followed your advise 2) rebooted and nothing happens 3) applied ifup eth0 also says "ignoring unknown interface eth0=eth0
    – user25165
    Nov 21, 2011 at 20:59
  • My resolv.conf shows nothing (need to boot? It could be in the answer if so.) I did sudo ifup eth0 and at least he didn't complained like before, and still complains with @YumYumYum. But ip link show still says state DOWN for eth0.
    – Rodrigo
    Sep 30, 2015 at 13:03
  • You can verify if adding "allow-hotplug eth0" in "/etc/network/interfaces" also solves the problem in your case. Thank you. Jul 22, 2020 at 2:55
11

Add eth0 to auto lo, like:

auto lo eth0

This will bring up lo (loopback) and eth0 on running ifup -a (done at boot time).

From man interfaces:

Lines beginning with the word "auto" are used to identify the physical interfaces to be brought up when ifup is run with the -a option. (This option is used by the system boot scripts.) Physical interface names should follow the word "auto" on the same line. There can be multiple "auto" stanzas. ifup brings the named interfaces up in the order listed.

2
  • [not solved]: 1) vim /etc/network/interfaces; auto lo eth0 added 2) rebooted and nothing happens 3) applied ifup -a says "ignoring unknown interface eth0=eth0
    – user25165
    Nov 21, 2011 at 20:57
  • Great! most of setting static ip tutorials only tell to add auto eth0 ..... But none of them mentions that wouldn't work if there is auto lo on top.
    – Mithril
    Dec 15, 2016 at 2:43
4

this is not helpful if you do not wish to setup an IP address on this interface. In my case I wanted to bring up eth0 so it will enter the vswitch config. I had to add the following for the interface in /etc/network/interfaces

# eth0 physical, br0 bridge with ovs

auto eth0
iface eth0 inet manual
up ifconfig eth0 up
auto br0
iface br0 inet dhcp
3
  • these question is 5 years old and has an accepted answer...
    – cmks
    Apr 12, 2016 at 9:35
  • 3
    you want me to delete what i wrote? just say it, dont insinuate it :)
    – ykanello
    Apr 13, 2016 at 12:34
  • This helped me. I wasn't sure if I could make my bridge "auto" also.
    – nomen
    Feb 24, 2019 at 16:59
1

"[not solved]: 1) vim /etc/network/interfaces; followed your advise 2) rebooted and >nothing happens 3) applied ifup eth0 also says "ignoring unknown interface eth0=eth0 – >YumYumYum Nov 21 '11 at 20:59"

Today i had the same "ignoring unknown interface eth0=eth0" issue. For me, the problem was due to the fact that I was configuring eth1 (in static) instead of eth0 (I didn't have eth0 configured).

So I just renamed eth1 to eth0 and it worked.

Hoping it could help anyone who done the same mistake.

P.S.: sorry for my bad english, don't hesitate to tell any mistake ;)

1

For people running into this problem and the selected answer isn't working, run ifconfig -a to make sure your ethernet device is displayed as eth0 which is likely the default in your config as well. Mine is eth1 for whatever reason.

So in /etc/network/interfaces I had to use:

auto lo
iface lo inet loopback 
auto eth1
iface eth1 inet dhcp

I also edited /etc/NetworkManager/NetworkManager.conf and set:

[ifupdown]
managed=true
1
  • OP said he disabled network manager. Aug 3, 2023 at 9:12
0

I had the same problem where ifup ens192 would bring up the interface, but boot or service networking restart would both fail to bring up the ens192 interface ... it was resolved by using only one auto line ...

the new auto line was like this ...

auto lo ens192  
iface lo inet loopback  
iface ens192 inet static  
      address x.x.x.x
      etc..etc.etc
###

the version that was not working looked like this (where I have two auto lines)

auto lo                                                                  
iface lo inet loopback   
auto ens192   
iface ens192 inet static  
   etc...etc..etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .