Change Ubuntu IP Address from DHCP to Static or Vice Versa – HowTo

The default network setting in Ubuntu (or Debian) is to use DHCP.  Often, however, it is desirable to use a static IP address and settings.  To change your network configuration from DHCP to static follow these steps.

Open a terminal session and enter:

sudo nano /etc/network/interfaces

Two network interfaces should be listed, lo and eth0:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

Change eth0 to your desired settings, such as:

auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Save the file and close using Ctl+X, Y, Enter.

Restart the network to apply the new setting, with this command:

sudo /etc/init.d/networking restart

Verify your network settings with:

ifconfig

See also

Leave a Reply

Your email address will not be published. Required fields are marked *