Networking – How to Configure Desktop for a Static IP Address

network-managernetworking

By default Ubuntu uses DHCP and Gnome NetworkManger to configure interfaces. This is not optimal in many cases.

How to configure a desktop machine for a static IP address that applies to all users?

Additional background: For 99.9% of users a static DHCP entry is probably the easiest solution, however I have found a conflict with mythtv-background process and any changes to the eth0 interface. If the interface is brought up/down after mythtv is running, it hangs the process (which also broke system suspend). So my questions really needs a static IP address, where the interface is brought up with a known IP, and stays up permanently.

Best Answer

Right click nm, choose Edit connections... find your interface, click Edit..., click IPv4 Settings, choose Manual and configure your interface.

An alternative would be to edit /etc/network/interfaces. an example configuration would be:

auto eth0
iface eth0 inet static
   address 192.168.1.1
    netmask 255.255.255.0
    gateway 192.168.1.1

then run

/etc/init.d/networking restart

Keep in mind that this will deactivate nm for this interface and you will have to delete (or uncomment) the entries to activate nm again.

Edit (see Casey's post): You also have to set a DNS after editing /etc/network/interfaces:

Set one or more desired nameserver in /etc/resolv.conf:

nameserver 192.168.1.1

Related Question