Skip to content

Commit

Permalink
fix: nic mtu should be 1400
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Mar 15, 2019
1 parent 970f147 commit fd59a2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/daemon/ovs.go
Expand Up @@ -17,7 +17,7 @@ func (csh CniServerHandler) configureNic(podName, podNamespace, netns, container
// NOTE: DO NOT use ovs internal type interface for container.
// Kubernetes will detect 'eth0' nic in pod, so the nic name in pod must be 'eth0'.
// When renaming internal interface to 'eth0', ovs will delete and recreate this interface.
veth := netlink.Veth{LinkAttrs: netlink.LinkAttrs{Name: hostNicName}, PeerName: containerNicName}
veth := netlink.Veth{LinkAttrs: netlink.LinkAttrs{Name: hostNicName, MTU: 1400}, PeerName: containerNicName}
defer func() {
// Remove veth link in case any error during creating pod network.
if err != nil {
Expand Down Expand Up @@ -189,6 +189,11 @@ func configureNodeNic(portName, ip, mac string) error {
return fmt.Errorf("can not set mac address to node nic %v", err)
}

err = netlink.LinkSetMTU(nodeLink, 1400)
if err != nil {
return fmt.Errorf("can not set mtu %v", err)
}

if nodeLink.Attrs().OperState != netlink.OperUp {
err = netlink.LinkSetUp(nodeLink)
if err != nil {
Expand Down

0 comments on commit fd59a2c

Please sign in to comment.