Have you ever binded a lot of ip addresses to your CentOS?
If your answer is yes, you must have seen some informations like this:
What a anti-human decision to determining a large of ip address in use on boot.
In CentOS, /etc/init.d/network run ifup to bring up your interface, fortunately, ifup is not a binary file but a shell script, so we have a chance to remove this anti-human function.
Change dir to /etc/sysconfig/network-scripts/ and run “ls”, we can see several ifup script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
ifup ifup-aliases ifup-bnep ifup-eth ifup-ippp ifup-ipv6 ifup-ippp ifup-plip ifup-plusb ifup-post ifup-ppp ifup-routes ifup-sit ifup-tunnel ifup-wireles |
We use grep to search key words “Determing if”:
1 |
grep "Determining if" ./ -nir |
Results:
1 2 |
./ifup-eth:244: echo $"Determining if ip address ${ipaddr[$idx]} is already in use for device ${REALDEVICE}..." ./ifup-aliases:265: echo $"Determining if ip address ${IPADDR} is already in use for device ${parent_device}..." |
We need to modify both ifup-eth and ifup-aliases files so as to clean this function.
Open ifup-eth, go to 244 line, we can see some code like this:
ifup uses arping to know whether there a MAC address is using the ip address is going to bind for this host.
ARP packages are broadcast packages, aftering send a arp package to determining ip in use, arping need to wait for a reply broadcast package.
When there is a host using that ip, arping can get that reply package quickly, but if not, arping need to wait for several seconds so as to confirm no host is using the ip address.
According to the code in 243 line, we can know if the device is lo or APRCHECK is set to no, the ARPCHECK will be skip.
So we just need to add such line to the ifcfg files:
1 |
ARPCHECK=no |
Now the “Determing if” does not show on boot anymore.