Assigning static ip using terminal or shell on linux

Written By Smart| 31 July 2009| No Comment

to assign static ip manually using terminal or shell.first you need killall dhclient.

run below command

$killall dhclient

then run below step (here i am using my network example)

$ifconfig eth0 up 192.168.1.5 netmask 255.255.255.0

above step is used for assigning the ip

now you need to add default gateway,first you need check your gateway by running below command

$route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

now ping before adding default gateway

$ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=2.34 ms

now add the default gateway using below command

$route add default gw 192.168.1.1

now your done with assigning static ip manually

Related Posts with Thumbnails

Share With Others

Leave your response!




Comment moderation is enabled. Your comment may take some time to appear.