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!
-
I realize that although I answered your question, this might be an XY problem: xyproblem.info I can't know if you need veth interfaces in what you want to achieve. veth is almost always used with network namespaces to be useful. This could be a programming API problem. (eg: using setsockopt to disable or enable IP_MULTICAST_LOOP on a socket).– A.BCommented Jun 23, 2021 at 6:52
-
Also IP packets can be larger than Ethernet's MTU: that's what fragmentation is for.– A.BCommented Jun 23, 2021 at 7:12
-
Thank you for the answer! I'm trying to understand it. Also I'm sorry if the question is an XY problem, and just to clarify, what I'm trying to achieve is high speed multicast UDP data transfer using a sender and receiver on the same host, and to achieve that, I read that it's best to have a large MTU size.– AnandCommented Jun 23, 2021 at 7:23
1 Answer
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:
-
Thank you! It really helped, especially the "you need the other side in an other namespace".– AnandCommented Jun 23, 2021 at 8:24