3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CentOS6でネットワーク インターフェイスの起動を早くする

Last updated at Posted at 2013-11-26

VLANや死活監視系のためにネットワークインターフェイスが5個とか、多い時で10個以上あるCentOS(RHEL系)でservice network restartとかやると物凄く時間がかかりますよね。
大体1個あたり2秒はかかっていて、ちょっと我慢出来なかったので、時短してみました。

遅い原因は、全てのインターフェイスでarpingしてIPアドレスの重複チェックをしていることです。
/etc/sysconfig/network-scripts/ifup-ethの次の部分です。

if ! /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${ipaddr[$idx]} ; then
    net_log $"Error, some other host already uses address ${ipaddr[$idx]}."
    exit 1
fi

arpingのオプションの関係する部分は次のとおりです。

  • -c 2はARPを打つ回数で、この場合は2回
  • -w 3はARPのタイムアウト秒数で、この場合は3秒
  • -DはIPアドレスの重複チェック

IPアドレスの重複チェックはこんなに入念にやらなくて良い、という場合には次のようにします。

if ! /sbin/arping -q -c 1 -D -I ${REALDEVICE} ${ipaddr[$idx]} ; then

そもそもIPアドレスの重複チェックが不要な場合は、ifブロックそのものを削除してもよいでしょうし、ifブロックを残したい場合には-c 0を指定すればARPは打たれません。

if ! /sbin/arping -q -c 0 -D -I ${REALDEVICE} ${ipaddr[$idx]} ; then
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?