Linux – How to start networking on a wired interface before logon in Ubuntu Desktop Edition

linuxnetworkingUbuntuubuntu-9.10

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 its 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?

See-Also

References

Best Answer

To have your network interface automatically configured via DHCP on boot, add the following lines to /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp

This should bring your interface up even without NetworkManager running. You can even remove the package network-manager, if you will.