set MTU in C programmatically

前端 未结 4 543
温柔的废话
温柔的废话 2021-02-10 18:53

A client requested that the MTU limit should be 1492.

Is there a way to do it in the source code (program in C)?

Is there any other way to do it in general? (if

4条回答
  •  悲&欢浪女
    2021-02-10 19:29

    the modern way to set interface parameters is via sysfs

    sudo sh -c 'echo 1492 > /sys/class/net/tun/mtu'
    

    By C, just open and write as files

提交回复
热议问题