How to: Set static IP + set OpenDNS as your DNS server on linux

Step 1. You will need to find the following info about the network
1. Available IP Address
2. Network Netmask
3. Broadcast IP
4. Default Gateway

Step 2. Open /etc/network/interfaces:

$ sudo vim /etc/network/interfaces

Once there, we must find the network interface to be configured from a dynamic IP address to a static one. In this case it will be eth0:

auto eth0
iface eth0 inet dhcp

In the above example we can see that the interface eth0 is configured for dhcp (dynamic address). To change to static IP address configuration we must set the following:

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
nerwork 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254

Finally, we need to restart the networking services:

$ sudo /etc/init.d/networking restart

Set OpenDNS as your DNS server

Step 1. Open the resolv.conf file

sudo vim /etc/resolv.conf

Once Open comment out whatever name server is already there. More than likely these are DNS Servers provided to you by your ISP, and are thus worthless.  After commenting out the old DNS server address, append the following two lines of text.

nameserver 208.67.222.222
nameserver 208.67.220.220

Now just save and quit, you are done.

Comments are closed.