WAP VNET Linux MTU size


When using a Linux VM within a VNET you have to set the MTU to 1458, in a VNET the MTU size is 42 Bytes smaller than in a traditional Ethernet network (where it is 1500 Bytes). The reason for this is the NVGRE encapsulation which needs the 42 Bytes to store his additional GRE Header in the packet. So the maximum MTU size with Hyper-V Network Virtualization is 1458 Bytes.

For VMs running Windows Server 2008 or newer this should not be a Problem because Hyper-V has a mechanism which lowers the MTU size for the NIC of the VM automatically if needed.

But with VMs running Linux you could run in a problem because the automatically MTU size reduction seem to not function correctly with Linux VMs.

This may have the effect that the MTU size in the Linux VMs stays at 1500 and therefore you can experience some very strange connection issues.

To resolve this set the MTU size to 1458.
ifconfig eth0 mtu 1458

To change the MTU size permanently change the etho configuration files:

In CentOS the eth0 settings are located in /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE='eth0'
STARTMODE='auto'
BOOTPROTO='static'
IPADDR='x.x.x.x'
NETMASK='x.x.x.x'
MTU="1458"
PEERDNS='no'
IPV6INIT='yes'
IPV6_AUTOCONF='yes'

 

In Ubuntu the eth0 settings are located in /etc/network/interfaces

iface eth0 inet static
address x.x.x.x
network x.x.x.x
gateway x.x.x.x
netmask x.x.x.x
mtu 1458