1.12.2014

Change Ubuntu Server from DHCP to a Static IP Address

Change Ubuntu Server from DHCP to a Static IP Address


/etc/network/interfaces

DHCP setup of the "interfaces" file

auto eth0
iface eth0 inet dhcp

Static IP address example of the "interfaces" file
auto eth0
iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

DNS Settings

/etc/resolv.conf
On the line ‘name server xxx.xxx.xxx.xxx’ replace the x with the IP of your name server. 

You need to also remove the dhcp client for this to stick. You might need to remove dhcp-client3 instead.
sudo apt-get remove dhcp-client
Now we’ll just need to restart the networking components:
sudo /etc/init.d/networking restart

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.