Sunday, 29 August 2021
MTU for LINUX
Show MTU running
----------------
# ip a | grep mtu
Temporarily changing the MTU Size – Using ifconfig command
We can use the ifconfig command to change the MTU size of a system’s network interface. However, remember that this change does survive a reboot and returns to the default value i.e. 1500.
Setup MTU
-----------------
ifconfig mtu up
Oracle Linux: How to Change MTU Size (Doc ID 2520148.1) To BottomTo Bottom
Solution
Check the current MTU settings
You can use both ifconfig and ip command to check it:
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 02:00:17:00:XX:XX
inet addr: Bcast:XXX.XXX.XXX.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:9000 Metric:1
RX packets:2786436 errors:0 dropped:0 overruns:0 frame:0
TX packets:3744195 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:789337509 (752.7 MiB) TX bytes:654466831 (624.1 MiB)
[root@j-ol6-8324 opc]# ip link list
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 9000 qdisc mq state UP qlen 1000
link/ether 02:00:17:00:XX:XX brd ff:ff:ff:ff:ff:ff
Change the MTU size by ifconfig or ip commands
# ifconfig $DEV mtu 1400
or
# ip link set $DEV mtu 1400
For instance:
# ifconfig eth0 mtu 1500
Or:
# ip link set dev eth0 mtu 1500
# ip link list
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 1500 qdisc mq state UP qlen 1000
link/ether 02:00:17:00:XX:XX brd ff:ff:ff:ff:ff:ff
Make the setting permanent by appending the line 'MTU=' in /etc/sysconfig/network-scripts/ifcfg-*:
# grep MTU /etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/ifcfg-eth0:MTU=9000
Restart the network service(for Oralce Linux 6):
# service network restart
Or (OL7)
# systemctl restart network
Test it from a remote machine by ping to probe the packet path:
$ for x in 1462 1463 1472 1473 1500 9000; do echo Lenth $x; ping -c 3 -M do -s $x xxx.xxx.xxx.xxx; done
Lenth 1462
PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 1462(1490) bytes of data.
1470 bytes from xxx.xxx.xxx.xxx: icmp_seq=1 ttl=39 time=231 ms
1470 bytes from xxx.xxx.xxx.xxx: icmp_seq=2 ttl=39 time=231 ms
1470 bytes from xxx.xxx.xxx.xxx: icmp_seq=3 ttl=39 time=243 ms
--- xxx.xxx.xxx.xxx ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2244ms
rtt min/avg/max/mdev = 231.508/235.597/243.448/5.553 ms
Lenth 1463
PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 1463(1491) bytes of data.
1471 bytes from xxx.xxx.xxx.xxx: icmp_seq=1 ttl=39 time=243 ms
1471 bytes from xxx.xxx.xxx.xxx: icmp_seq=2 ttl=39 time=231 ms
1471 bytes from xxx.xxx.xxx.xxx: icmp_seq=3 ttl=39 time=243 ms
--- xxx.xxx.xxx.xxx ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2246ms
rtt min/avg/max/mdev = 231.495/239.439/243.632/5.634 ms
Lenth 1472 >>>>>>>>>>>> Remote instance MTU Size=Data Size+IP header(20 bytes) +ICMP header(8 bytes)=1472+20+8=1500
PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 1472(1500) bytes of data.
1480 bytes from xxx.xxx.xxx.xxx: icmp_seq=1 ttl=39 time=243 ms
1480 bytes from xxx.xxx.xxx.xxx: icmp_seq=2 ttl=39 time=231 ms
1480 bytes from xxx.xxx.xxx.xxx: icmp_seq=3 ttl=39 time=231 ms
--- xxx.xxx.xxx.xxx ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2234ms
rtt min/avg/max/mdev = 231.344/235.478/243.590/5.749 ms
Lenth 1473
PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 1473(1501) bytes of data.
--- xxx.xxx.xxx.xxx ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 11999ms
Lenth 1500
PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 1500(1528) bytes of data.
--- xxx.xxx.xxx.xxx ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 11999ms
Lenth 9000
PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 9000(9028) bytes of data.
ping: local error: Message too long, mtu=9000
ping: local error: Message too long, mtu=9000
ping: local error: Message too long, mtu=9000
--- xxx.xxx.xxx.xxx ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2999ms
Subscribe to:
Posts (Atom)