Search code examples
linuxescapingmtu

how to escap special character device name for ip link command


I need to change mtu of 2 devices as below.

This work fine:

ip link set dev ethdc1e2470 mtu 9000 

...but this:

ip link set dev ethdc1e2470-emu mtu 9000

...gives:

RTNETLINK answers: Invalid argument)

I believe this error is caused by the dash (-) in device name. So I tried escaping it with \, but that didnt work either:

$ ip link set dev ethdc1e2470\-emu mtu 9000
RTNETLINK answers: Invalid argument

$ ip link set dev ethdc1e2470\\-emu mtu 9000
Cannot find device "ethdc1e2470\-emu"

Can you help me to find out correct escaping?

Changing device name thats not an option, these are auto generated device names by openvswitch.


Solution

  • Actually it seems those emulated interfaces of openvswitch do not support MTU greater than 1500.

    If i use ifconfig command for same, it give more reasonable error, and i can set mtu < 1500 just fine.

    ifconfig eth58fd8938-emu mtu 9000 up
    SIOCSIFMTU: Invalid argument
    

    So it is not really device name issue. Thanks @jos for helpful comment

    Just so if anyone else come across this issue

    If i switch NIC model from default rtl8139 to e1000 in XEN DomU config, then resulted emulated interface can successfully set MTU 9000.

    However Xen stubdomain device model dont let to set MTU > 1500 no matter it is rtl8139 or e1000