How to start networking on a wired interface before logon in Ubuntu Desktop Edition
- by Burly
Problem
Ubuntu 9.10 Desktop Edition (and possibly previous versions as well, I haven't tested them) has no network connections after boot until at least 1 user logs in. This means any services that require networking (e.g. openssh-server) are not available until someone logs in locally either via gdm, kdm, or a TTY.
Background
Ubuntu 9.10 Desktop Edition uses the NetworkManager service to take commands from the nm-applet in Gnome (or it's equivalent in KDE). As I understand it, while NetworkManager is running at boot, it is not issued any commands to connect until you login for the first time because nm-applet isn't running until you login and your Gnome session starts (or similar for KDE). I'm not sure what prompts NetworkManager to connect to the network when you login via a TTY.
There are several relevant variables involved in starting up the network connections including:
Wired vs Wireless (and the resulting drivers, SSID, passwords, and priorities)
Static vs DHCP
Multiple interfaces
Constraints
Support Ubuntu 9.10 Karmic Koala (bonus points for additional supported versions)
Support wired eth0 interface
Receive an IP address via DHCP
Receive DNS information via DHCP (obviously the DHCP server must provide this information)
Enable networking at the proper time (e.g. some time after file systems are loaded but before network services like ssh start)
Switching distros or versions (e.g. to Server Edition) is not an acceptable solution
Switching to a Static IP configuration is not an acceptable solution
Question
How to start networking on a wired interface before logon in Ubuntu Desktop Edition?
What I have tried
Per this guide, adding the following entry into /etc/network/interfaces so that NetworkManager won't manage the eth0 interface:
auth eth0
iface inet dhcp
After reboot eth0 is down.
Issuing ifconfig eth0 up brings the interface up but it receives no IP address.
Issuing dhclient eth0 instead Does bring up the interface and it Does receive an IP address.
Completely removing the NetworkManager package in addition to the settings above.
I'm a bit confused with the whole UpStart/SysVinit mangling that's going in Ubuntu currently (I'm more familiar with the CentOS world). However, directly issuing
sudo /etc/init.d/networking start
Or
sudo start networking
does not bring up the eth0 interface at all, much less get an IP address.
See-Also
How to force NetworkManager to make a connection before login?
References
Ubuntu Desktop Edition
Ubuntu Networking Configuration Using Command Line
Automatic Network Configuration Via Command-Line
Start network connection before login