Linux ip configuration and Network configuration :

For assign IP address:

Run setup command form root user

#setup
setup
 
this will launch a new window select network configuration

network configurations

now a new window will show you all available LAN card select your LAN card ( if you don’t see any LAN card here mean you don’t have install driver)

select lan devices in setup

assign IP in this box and click ok

assign ip address
click on ok, quit and again quit to come back on root prompt.


#service network restart
 
service network restart

The ifconfig command will display the configuration of all active Ethernet card. 

#ifconfig

ifconfig

The ifconfig lo command will display the configuration of loopback Ethernet card. 


#ifconfig lo
 
ifconfig lo

You can activate or deactivate that adapter with the ifup and ifdown commands. Either of the following commands will activate the eth0 network adapter:

#ifup ifcfg-eth0
#ifup eth0

ifup/ifdown

ifup ifdown etho

The netstat program provides real-time information on the status of your network connections, as well as network statistics and the routing table. The netstat command has several options you can use to bring up different sorts of information about your network.

netstat

netstat -r

The Address Resolution Protocol associates the hardware address of a network adapter with an IP address. The arp command (in the /sbin directory) displays a table of hardware and IP addresses on the local computer. With arp, you can detect problems such as duplicate addresses on the network, or you can manually add arp entries as required.

arp

arp

mii-tool command is used to check the link is activated or not. Most use of mii-tool command is to check to physical link of Ethernet card on command line. With this command you can check on command prompt that cable is plugged in LAN card or not.

mii-tool

mii tools

ping command is used to check the physical connectivity. If you get reply mean everything is ok. If you get request time out response means there is some problem it could be unplugged cable power off switch or enabled firewall on destination node. If you get Destination host unreachable means remote node is not in your network. Use CTRL+C to abort the ping sequence

ping



ping


Whatever change you made in network configuration files will not take place until you restart the network services. To implement change this command is used.

service network restart

service network restart

ethtool - Display or change ethernet card settings 

Procedure For assign IP address from configuration file:

Static IP address configuration:  
vim /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
BOOTPROTO=static
BROADCAST=XXX.XXX.XXX.255
IPADDR=XXX.XXX.XXX.XXX
NETMASK=255.255.255.0
NETWORK=XXX.XXX.XXX.0
ONBOOT=yes 
TYPE=Ethernet
HWADDR=XX:XX:XX:XX:XX:XX 
GATEWAY=XXX.XXX.XXX.XXX


DHCP IP configuration: 
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
IPV6INIT=no
USERCTL=no
PEERDNS=yes
TYPE=Ethernet
HWADDR=XX:XX:XX:XX:XX:XX
Assign more than one IP address to one ethernet card: 

cp /etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-eth0:0
vim /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
ONBOOT=yes
BOOTPROTO=static
BROADCAST=192.168.10.255
IPADDR=192.168.10.12
NETMASK=255.255.255.0
NETWORK=192.168.10.0
ONBOOT=yes