networkop / meshnet-cni

a (K8s) CNI plugin to create arbitrary virtual network topologies
BSD 3-Clause "New" or "Revised" License
116 stars 28 forks source link

Specifying MAC, MTU and other link attrs like IFLA_AF_SPEC #54

Open sar772004 opened 1 year ago

sar772004 commented 1 year ago

Can you please help me with an example to specify the MAC, MTU and other link Attributes of the veth link? I don;t see it currently supported, but just checking if there is some way to do this.

Based on some code browsing , This is what Koko is using internally, and may need to be extended https://github.com/vishvananda/netlink/blob/main/link.go#L24

networkop commented 1 year ago

Yeah, it's not supported. The assumption is that a NOS that runs inside a pod is given enough privileges to change those settings (CAP_NET_ADMIN at least, full privileged at most). So normally, this is controlled by whatever software that runs in a pod.

sar772004 commented 1 year ago

Thanks for the reply. Though the NOS running has the capability to change, it would be good to have this driven with the YAML. One case i see is when using VXLAN between pods, We are not able to set the MTU, so that would probably need to come at the link setup time via the yaml.

When the NOS tries to set the MTU, we get errors and the link remains down.

Dec 1 02:46:22 dut-d : debug|1396|1461|00012|E: NetDeviceSetMTU ioctl(SIOCSIFMTU, "e1-34", 7000): Invalid argument (22) Dec 1 02:46:22 dut-d : debug|1396|1461|00013|E: UpdateAdminState error setting mtu for interface "ethernet-1/34" mtu: 7000

63: e1-34@if63: <BROADCAST,MULTICAST> mtu 1450 qdisc noqueue state DOWN group default qlen 1000 link/ether 02:a0:a7:ff:00:22 brd ff:ff:ff:ff:ff:ff link-netnsid 0

Even when manually attempted    
[root@dut-d /]# ifconfig e1-34 mtu 9000 up
SIOCSIFMTU: Invalid argument
networkop commented 1 year ago

Ah, right, I see. I remember reading about similar things (e.g. adjustable MTU) in the context of gRPC links (worked on by @kingshukdev). I don't think it's supported today, but it should be fairly easy to add.

sar772004 commented 1 year ago

Thanks that will be great, Can you please add MTU support, i guess extending it here ? https://github.com/networkop/meshnet-cni/blob/037ded81bc8b98733f87476774ba5a3b99e9681a/plugin/meshnet.go#L136 Do you know, how long it takes to deploy such a change normally ?

networkop commented 1 year ago

I don't think I'll have the bandwidth to do this in the near future but I'm happy to consider PRs, if you're willing to do it

sar772004 commented 1 year ago

I don't think I'll have the bandwidth to do this in the near future but I'm happy to consider PRs, if you're willing to do it

Sure i can try out the changes and request a PR. Since i am new here, could you point me any documention steps to test out the local changes. Thanks

kingshukdev commented 1 year ago

@sar772004, Yes adding configurable MTU is not a big task. Just to understand your use case - what is the MAX MTU you want to see for a link ? Secondly in a topology you need all links to have same MTU or different links can have different MTU ?

sar772004 commented 1 year ago

@kingshukdev I am trying to achieve the MTU of vxlan bind atleast 9232.

By the way it seems the MTU currently is being picked from the underlying interface and its being tied to the primary address as defined here. https://github.com/networkop/meshnet-cni/blob/master/manifests/base/daemonset.yaml#L41

We want to use a specific NIC for carrying the vxlan binds. and i m not finding a way to define the endpoint IP to be picked up from a specific interface on the computes.

Any idea how i can point to a specific underlay interface for the VXLAN binds to use ?
Once i have the chosen interface i could have a large MTU on that and probably proceed.