0
0

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 5 years have passed since last update.

NICの各種パラメータの設定

Last updated at Posted at 2017-04-30
/etc/rc.localに下記を設定し、起動時にすべてのNICに対して下記パラメータを設定できるようにしてみました。
  • NICオフロードの無効化
パケット分解処理(tso)とスキャッタギャザー機能(gro)及びチェックサム(rx,tx)を無効化
  • バッファサイズの変更

    設定可能な上限よりも大きい値を指定すると反映されないので
    先にethtool -gで上限を確認した後、ethtool -Gで設定しています。

  • 送信キューのサイズを変更

ifconfigのtxqueuelenオプションで指定しています。

/etc/rc.local
OFFLOADPARAM="tso gro rx tx"
function setofflod() { for param in ${OFFLOADPARAM}; do ethtool -K $1 $param off ; done }
function getmaxbuf() { param=`echo $2 | tr "[:lower:]" "[:upper:]"`; ethtool -g $1 | gawk '$1 ~ /^'"${param}"':/ {print $2}' | head -1; }
function setcurbuf() { for param in tx rx; do max=`getmaxbuf $1 $param` ; ethtool -G $1 $param $max ; done }
function settxqlen() { ifconfig $1 txqueuelen 10000 ; }
function setnicparam() { setofflod $1;setcurbuf $1;settxqlen $1 ;}
for nic in `ip link | gawk -F': ' '$1 ~ /^[0-9]/&&$2 ~ /^eth/ {print $2}'`; do { setnicparam $nic ;} ; done
unset setofflod
unset getmaxbuf
unset setcurbuf
unset settxqlen
unset setnicparam
EOF
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?