Wednesday, 5 November 2014

Mystery of changing IP address on NIC interfaces in Linux

In our lab we  use Linux Server PC, Fedora core 14. It had 8 LAN Network interfaces card and is used as PPPoE server, DHCP server and Radius Server.  All interfaces have static IP addresses assigned to them, but we were facing below issues with it:

1) After  every reboot, one NIC card will take IP Address of another NIC card.

2) One NIC card if goes up and down the default IP address will become 0.0.0.0

So if there is any change of state or PC reboot, we need to again manually assign the IP address of the NIC cards.

We used both the methods to assign ip address:

1) ifconfig  Command  ( ifconfig eth0 8.1.1.1 netmask 255.255.255.0 up)

2)Right corner->Network Configuration-> Edit connection->


It took some time to figure out what was happening once we decided to solve this problem forever.

Analysis

For each interface the configuration files are stored in /etc/sysconfig/network-script/ifcfg-<name>. For example for eth1 we should have /etc/sysconfig/network-script/ifcfg-eth1.

We saw we had different names for the same interfaces in command prompt and config files .The name was eth1, but in config file it was stored as Auto-eth1. For the NIC which was taking IP address of other NIC, the HWADDR field was not present. The NIC which was taking none ip address after up/down was actually configured as DHCP in config files. Below is sample file :


DEVICE=eth1
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=eth1
UUID=9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04
USERCTL=yes
IPADDR0=25.1.1.1
PREFIX0=24
DEFROUTE=no

HWADDR=1C:6F:65:C6:4A:9C

Resolution

To make it work make sure the Edit connection have proper static ip address , no two interfaces should have default gateway. Now edit the /etc/sysconfig/network-script/ifcfg-<name> file and make sure it reflects same name and values as in Edit connections. Make sure below fields are matching properly between "Edit Connections" and config files :

DEVICE, NAME, HWADDR

IF these fields are not present in the config file, edit and give them properly.

After reboot everything worked fine !

Mystery solved.

Keep Trying , Keep Solving !

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...