Unable to create vlan interface raspberry pi - Ethernet name too long. +Solution

  • Problem:


    When creating a vlan interface via the UI, I get the following in syslog:


    Dec 8 12:13:12 nas-pi ifup[20233]: Error: argument "enxb827eb1e62b3.42" is wrong: "name" too long


    Dec 8 12:13:12 nas-pi ifup[20233]: ifup: ignoring unknown interface enxb827eb1e62b3.42=enxb827eb1e62b3.42


    enxb827eb1e62b3 is the on-board Ethernet interface on the PI.


    I can create a vlan interface via 'ip' on the cli using a shorter name:


    From a shell, I found roughly the same issue, but using a shorter 'name', it works:


    root@nas-pi:~# ip a


    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    2: enxb827eb1e62b3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:1e:62:b3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.45/27 brd 192.168.42.63 scope global dynamic enxb827eb1e62b3
    valid_lft 86365sec preferred_lft 86365sec
    inet6 fe80::25ea:3e02:62e9:4513/64 scope link
    valid_lft forever preferred_lft forever
    3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:4b:37:e6 brd ff:ff:ff:ff:ff:ff
    root@nas-pi:~# ip addr del 192.168.0.45/27 dev enxb827eb1e62b3
    root@nas-pi:~# ip link add link enxb827eb1e62b3 name enxb827eb1e62b3.42 type vlan id 42
    Error: argument "enxb827eb1e62b3.42" is wrong: "name" too long


    root@nas-pi:~# ip link add link enxb827eb1e62b3 name eth0.42 type vlan id 42
    root@nas-pi:~# ip addr add 192.168.0.45/27 dev eth0.42
    root@nas-pi:~# ip link set eth0.42 up
    root@nas-pi:~# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    2: enxb827eb1e62b3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:1e:62:b3 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::25ea:3e02:62e9:4513/64 scope link
    valid_lft forever preferred_lft forever
    3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether b8:27:eb:4b:37:e6 brd ff:ff:ff:ff:ff:ff
    4: eth0.42@enxb827eb1e62b3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether b8:27:eb:1e:62:b3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.45/27 scope global eth0.42
    valid_lft forever preferred_lft forever
    root@nas-pi:~#
    root@nas-pi:~# ping 192.168.0.33


    PING 192.168.0.33 (192.168.0.33) 56(84) bytes of data.
    From 192.168.0.45 icmp_seq=1 Destination Host Unreachable
    From 192.168.0.45 icmp_seq=2 Destination Host Unreachable
    From 192.168.0.45 icmp_seq=3 Destination Host Unreachable
    From 192.168.0.45 icmp_seq=4 Destination Host Unreachable
    From 192.168.0.45 icmp_seq=5 Destination Host Unreachable
    From 192.168.0.45 icmp_seq=6 Destination Host Unreachable
    From 192.168.0.45 icmp_seq=7 Destination Host Unreachable
    64 bytes from 192.168.0.33: icmp_seq=8 ttl=64 time=1042 ms
    64 bytes from 192.168.0.33: icmp_seq=9 ttl=64 time=3.94 ms
    64 bytes from 192.168.0.33: icmp_seq=10 ttl=64 time=0.924 ms
    64 bytes from 192.168.0.33: icmp_seq=11 ttl=64 time=0.923 ms
    64 bytes from 192.168.0.33: icmp_seq=12 ttl=64 time=0.919 ms
    ^C
    --- 192.168.0.33 ping statistics ---
    12 packets transmitted, 5 received, +7 errors, 58% packet loss, time 11228ms
    rtt min/avg/max/mdev = 0.919/209.758/1042.079/416.162 ms, pipe 4
    root@nas-pi:~#


    I noticed that when I create a vlan interface via the UI, there is an option to give it a 'name' but I'm unable to type in that field. It's selectable, but I can't type in it.


    It looks like the max interface name per the kernel docs/headers is 16 bytes (https://elixir.bootlin.com/lin…clude/uapi/linux/if.h#L33) and the 'predictable' interface name is 15 bytes, adding a period & and vlan_id will not work.


    Solution:


    I've created a script that undoes the physical interface IP address, creates a shorter named interface, applies an IP and turns it up:


    root@nas-pi:/$ cat /etc/init.d/vlan_fix
    ip addr del 192.168.42.0/27 dev enxb827eb1e62b3
    ip link add link enxb827eb1e62b3 name eth0.42 type vlan id 42
    ip addr add 192.168.0.45/27 dev eth0.42
    ip link set eth0.42 up
    root@nas-pi:/$


    Added a line to rc.local to start this script and chmoded both:


    root@nas-pi:/$ grep vlan_fix /etc/rc.local
    /etc/init.d/vlan_fix || exit 1
    root@nas-pi:/$ ls -alh /etc/rc.local
    -rwxr-xr-x 1 root root 707 Dec 8 14:19 /etc/rc.local
    root@nas-pi:/$ ls -alh /etc/init.d/vlan_fix
    -rwxr-xr-x 1 root root 175 Dec 8 13:54 /etc/init.d/vlan_fix
    root@nas-pi:/$


    Rebooting or running 'systemctl start rc.local' brought the interface up.


    I'll have to manage future interfaces via '/etc/init.d/vlan_fix'.


    Opened bug issue #230 https://github.com/openmediavault/openmediavault/issues/230

    Einmal editiert, zuletzt von bdk907 () aus folgendem Grund: Adding github bug link

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!