Problem
I have installed the RHEL 6.8 on a server and after assigning the IP address to the system when I restarted the network services IP address changed to local IP.
[root@dbappweb ~]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] [root@dbappweb ~]#
Checking the IP details which is showing only the loopback address.
[root@dbappweb ~]# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:914598 errors:0 dropped:0 overruns:0 frame:0 TX packets:914598 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:75014763 (71.5 MiB) TX bytes:75014763 (71.5 MiB)
Reason
The IP address of the system reset to the local because while configuring the IP address on the ethernet card I have selected the value ‘no’ for On boot.
Solution
Use any method of the methods given below:
Change through the command line
- Edit the network configuration file and change the value of the parameter ONBOOT from ‘no’ to ‘yes‘
[root@dbappweb ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 HWADDR=b4:b5:2f:55:ce:a8 TYPE=Ethernet UUID=e2f7b63b-a106-4173-ba85-3b931c9a6718 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none IPADDR=10.20.1.22 NETMASK=255.255.255.0 GATEWAY=10.20.1.1 USERCTL=no PEERDNS=yes IPV6INIT=no
- Restart the network services and check the IP details
[root@dbappweb ~]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining if ip address 10.20.1.22 is already in use for device eth0... [root@dbappweb ~]#
[root@dbappweb ~]# ifconfig eth0 Link encap:Ethernet HWaddr B4:B5:2F:55:CE:A8 inet addr:10.20.1.22 Bcast:10.20.1.255 Mask:255.255.255.0 inet6 addr: fe80::b6b5:2fff:fe55:cea8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5690194 errors:0 dropped:0 overruns:0 frame:0 TX packets:472539 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1016205668 (969.1 MiB) TX bytes:233489969 (222.6 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:914598 errors:0 dropped:0 overruns:0 frame:0 TX packets:914598 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:75014763 (71.5 MiB) TX bytes:75014763 (71.5 MiB)
Change through the graphical interface
- Run the setup command to launch the graphical interface for the network cards on the system.
- You can see the On boot is not selected for the eth0 in the network configuration.
- Select the On boot option for the eth0 in the network configuration and save the network configuration.
- Now restart the network service and check the IP details
[root@dbappweb ~]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining if ip address 10.20.1.22 is already in use for device eth0... [root@dbappweb ~]#
[root@dbappweb ~]# ifconfig eth0 Link encap:Ethernet HWaddr B4:B5:2F:55:CE:A8 inet addr:10.20.1.22 Bcast:10.20.1.255 Mask:255.255.255.0 inet6 addr: fe80::b6b5:2fff:fe55:cea8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5690194 errors:0 dropped:0 overruns:0 frame:0 TX packets:472539 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1016205668 (969.1 MiB) TX bytes:233489969 (222.6 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:914598 errors:0 dropped:0 overruns:0 frame:0 TX packets:914598 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:75014763 (71.5 MiB) TX bytes:75014763 (71.5 MiB)
Note: I have faced this issue in RHEL 6.8.