Unix & Linux
networking udp network-namespaces veth
Updated Wed, 21 Sep 2022 10:16:50 GMT

How to setup veth with 9000 MTU to simulate sending and receiving large UDP multicast packets on the same host?

The sender needs to transmit large data packets to the receiver (which is on the same host with 1500 MTU) and I think this can be simulated using veth with 9000 MTU, from my reading on it. But I'm not able to figure out how exactly to do that - most of the veth tutorials/articles on the internet mention network namespaces and I'm not sure if I would need to create a network namespace to achieve this. Any pointers/suggestions would be helpful, thanks!


On Linux this setting isn't specific to veth so isn't documented along veth, but in the generic ip link command:

ip link add [ link DEVICE ] [ name ] NAME
[ txqueuelen PACKETS ]
[ address LLADDR ] [ broadcast LLADDR ]
[ mtu MTU ] [ index IDX ] 
ip link set { DEVICE | group GROUP } 
[ mtu MTU ] 

You can use ip link set ... mtu 9000:

ip link set veth0 mtu 9000

Some interfaces might answer: Error: mtu greater than device maximum. because of hardware limits. That won't be the case for a virtual veth interface, its maximum MTU is 65535:

# ip -details link show veth0
68: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 9000 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 2a:93:f8:8e:bc:b6 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 65535 
    veth addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 

with relevant part:

minmtu 68 maxmtu 65535 

Note that for this to be useful you need the other side in an other namespace. For example here the other side of veth0 is veth1:

ip netns add experiment
ip link set veth1 peer netns experiment
ip -n experiment link set veth1 mtu 9000

etc. (bring interfaces up, add addresses, routes...)

For the multicast part, you might be interested in this:

IP Multicasting with Socat

Comments (1)

  • +0 – Thank you! It really helped, especially the "you need the other side in an other namespace". — Jun 23, 2021 at 08:24