How to change ip address in Linux?

by Ramya 2009-11-10 15:14:48

change IP address in Linux:

To change the IP address in linux, first list the current ip using "ifconfig" command.
# ifconfig eth0


It will list the IP address with subnet mask as,
eth0 Link encap:Ethernet HWaddr 00:22:64:4B:5F:A3
inet addr:192.168.1.5 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::222:64ff:fe4b:5fa3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
.......................................
.......................................

To set IP address from 192.168.1.5 to 192.168.1.10, enter command:
# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up


Finally check the IP address using,
# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:22:64:4B:5F:A3
inet addr:192.168.1.10 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::222:64ff:fe4b:5fa3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
.......................................
.......................................
Now the IP is changed.Razz

Use this command to change IP address in linux.

Tagged in:

1098
like
0
dislike
0
mail
flag

You must LOGIN to add comments