Showing posts with label dns. Show all posts
Showing posts with label dns. Show all posts

Thursday, July 10, 2014

How to set static IP and set my DNS in Ubuntu Server 14.04

If you try to edit /etc/resolv.conf as most information on internet suggest, your information will be overriden after reboot. To change DNS modify file:

sudo nano /etc/resolvconf/resolv.conf.d/base

Just add the same lines like in resolv.conf:

nameserver 8.8.8.8 #ip of your DNS server

then update resolv.conf:

sudo resolvconf -u

after that /etc/resolv.conf should contain your DNS ip.

To change ip address to static edit /etc/network/interfaces:

sudo nano /etc/network/interfaces

find and comment default dhcp entry. Next add lines to your config file like below:

# 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

# DHCP not needed
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.99
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.254


then disable/enable network interface

sudo ifdown eth0 && sudo ifup eth0