Menu

Tuesday, March 6, 2012

Assign an IP address to the Linux system



How to assign an IP address to the Linux system?

Step 1: Edit the network scripts file. All the network related script files are in the below location
# ls /etc/sysconfig/network-scripts




 My system has only one Ethernet card. The file that need to be edited to assign the IP address is “ifcfg-eth0”.

If system has multiple Ethernet devices, the files will be like “ifcfg-eth0, ifcfg-eth1, ifcfg-eth2…”.

Step 2: Edit the Ethernet device file and add the IPADDR, GATEWAY, PREFIX/NETMASK…etc. as mentioned below.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0



Step 3:  Bring down the network interface device and then start it.

# ifdown eth0
# ifup eth0

Or else just simply restart the network device.
# network service restart

Step 4:  Type ifconfig to view the available network interface card.

# ifconfig


Step 5: Try to ping this IP address from the other system.