Friday 14 March 2014

How Set Static IP Address In Ubuntu



root@vik:~# vi /etc/network/interfaces

#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

# make it comment
# iface eth0 inet dhcp

# add these lines
iface eth0 inet static
address 192.168.1.30                                              # define IP address
network 192.168.1.1                                               # define network address
netmask 255.255.255.0                                           # define subnet mask
network 192.168.1.1                                               # define network address
gateway 192.168.1.1                                               # define default gateway
dns-nameservers 192.1.168.10                                # define name server

Now Save and Exit file with press Esc. wq!

root@vik:~# ifdown eth0 && ifup eth0 


Disable IPv6 if not needed.



root@vik:~# echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf 
root@vik:~# reboot
root@vik:~# ifconfig 




No comments: