I encountered this problem once before, but I encountered it today and forgot how to deal with it before, so I recorded it for my own convenience. The CentOS 6 series is an older system. Nowadays, 7 series is commonly used, and many use 8. However, there are still a few users who still insist on 6 series. This article mainly focuses on station cluster servers. Machines with one or two or several IPs are also suitable. Don't encounter this problem.

First check the additional ip binding and confirm that the IP binding is normal. Take the network card eth0 and add the additional ip1.2.3.0/27 segment as an example. For binding under centos6, generally add and edit /etc/sysconfig/network-scripts/ifcfg -eth0-range0 file:

DEVICE=eth0 
BOOTPROTO=static 
IPADDR_START=1.2.3.2 
IPADDR_END=1.2.3.30 
CLONENUM_START=0 
NETMASK=255.255.255.224 
ONBOOT=yes

#Note: centos6 is very different from centos7 in batch binding IP. This binding method is only applicable to centos6 series.

After checking, it was found that there was no abnormality in the IP binding, but some IPs in this segment could not be used normally. I checked the IP information through the ifconfig command and found the clue. The subnet masks of these IPs were all detected as 255.255.255.248. At this time We need to check the binding of the main IP and check /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0 
TYPE=Ethernet 
UUID=f4c750d5-86f5-4a21-903a-435e25685bea 
ONBOOT=yes 
NM_CONTROLLED=yes 
BOOTPROTO=none 
HWADDR=D4:AE:52:BB:A4:C9 
IPADDR=5.4.3.2 
PREFIX=29 
GATEWAY=5.4.3.1 
DNS=8.8.8.8 
DEFROUTE=yes 
IPV4_FAILURE_FATAL=yes 
IPV6INIT=no 
NAME="System eth0"

The above information is automatically generated when we configure the IP during the centos6 system installation process. It can be accessed normally after the installation is completed, but it affects the effectiveness of the additional IP.

amendment

Here we know that although the additional IP binding is correct, the detected mask is incorrect. This is because PREFIX=29 is written in the main IP configuration in the network card configuration file. We can change this paragraph to NETMASK=255.255.255.248( As shown below)

eth0

Then restart the network: service network restart. What needs to be noted here is that centos6 restarts the network card. If there are many IPs, each IP will be started one by one. It will take a long time. Please wait patiently. In addition, it is recommended that you switch to centos7 and above versions as soon as possible!

postid
24673

Leave a Reply