Wednesday, January 5, 2011

How to assign IP in Ubuntu machine

Static IP to Ubuntu Server

Trick: to know what network interface your machine have
$ sudo lshw -class network
$ vim /etc/network/interfaces

Find and remove dhcp entry:

iface eth0 inet dhcp

Append new network settings:

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.254

Save and close the file. Restart the network:

$ sudo /etc/init.d/networking restart

Task: Define new DNS servers or Name Server

$ sudo vim /etc/resolv.conf

search myisp.com
nameserver 192.168.1.254
nameserver 202.54.1.20
nameserver 202.54.1.30

CHANING THE HOSTNAME

$ vim /etc/host
and give the name

$ vim /etc/hostname
and give the name again
$/etc/init.d/hostname.sh start

No comments:

Post a Comment