Thursday, January 26, 2017

HOWTO : Configure Network Interface For Better Performance on Ubuntu 16.04 LTS

Intel network interface card is configurable. Some other brands can but Realtek do not.

(0) You need to install ethtool if it is not :

sudo apt-get install ethtool

(1) List out the available network interface on your system :

ls /sys/class/net

enp1s0f0 enp1s0f1 enp7s0 enp8s0 lo

(2) To see if the network interface can pause the transmission when neccessary or not in order to prevent packet drop :

ethtool -a enp1s0f0

Pause parameters for enp1s0f0:
Autonegotiate: on
RX: on
TX: on

If the values are not "on", you can set it to :

sudo ethtool -A enp1s0f0 rx on tx on

(3) To see if the buffer is at the maximum value or not :

ethtool -g enp1s0f0

Ring parameters for enp1s0f0:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096
Current hardware settings:
RX: 4096
RX Mini: 0
RX Jumbo: 0
TX: 4096

If the current hardware settings values are not as the Pre-set maximums, you can set them to be :

sudo ethtool -G enp1s0fo rx 4096 tx 4096

(4) If your network interface cannot be configure like Intel, you may see the following result :

ls /sys/class/net

enp2s0 enp3s0 lo wlp4s0

ethtool -a enp2s0

Pause parameters for enp2s0:
Cannot get device pause settings: Operation not supported

(5) Finally, you can put those commands at /etc/rc.local and run the following command to activate the values :

sudo bash /etc/rc.local

That's all! See you.