Showing posts with label Linux Basic. Show all posts
Showing posts with label Linux Basic. Show all posts

Monday, April 23, 2007

Change IP on Linux

To change IP Address on Linux we have to had a root access.
I have tested this on Red Hat Linux AS 3.

After login as root then do the simple step below:

1. Modify the configuration file
with the command line:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
BROADCAST=172.26.11.255
IPADDR=172.26.11.192
NETMASK=255.255.0.0
NETWORK=172.26.11.0
ONBOOT=yes
TYPE=Ethernet


Then modify the entry IPADDR, NETMASK with
your own. You may change like this:

IPADDR=172.26.7.122

You may also modify other entry as you need,
then save the change.

2. Restart the network service with command line:

# /etc/init.d/network restart

If successed will look like below:

Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Setting network parameters: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]


3. You may check the change with this command line:

# ifconfig -a

As a result the following information will display on the screen.
The eth0 interface has changed.

eth0 Link encap:Ethernet HWaddr 00:11:09:06:9A:24
inet addr:172.26.7.122 Bcast:172.26.11.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:673374 errors:0 dropped:0 overruns:0 frame:0
TX packets:513551 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:562369198 (536.3 Mb) TX bytes:92885906 (88.5 Mb)
Interrupt:11 Base address:0xec00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:53122 errors:0 dropped:0 overruns:0 frame:0
TX packets:53122 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1652248 (1.5 Mb) TX bytes:1652248 (1.5 Mb)