How to bring up network on boot-up when NetworkManager is uninstalled?

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

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.


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

Tags:

Networking