GL.iNet GL-AR300M untagging port eth1 works but not for eth0

Hi,

I have a GL.iNet GL-AR300M16-ext openwrt 19.03 router (version with two ethernet ports and two external antennas) which is connected to my home network.

I think the router has the cpu port connected to the port 0 of the internal managed switch, port 1 is the WAN port (eth0) and port 2 is the LAN port (eth1), ports 3 and 4 are not used.

Vlan 10 is the native vlan on both ports, but untagging only works for eth1 port (LAN) and not for eth0 (WAN).

I am using this config file, only one port is connected at a time (full config at the end of this post)

config interface 'eth0_vlan10'         
       option ifname 'eth0.10'          
       option proto 'static'                           
       option ipaddr '10.20.30.1' 
       option netmask '255.255.255.0'

config interface 'eth1_vlan10'         
       option ifname 'eth1.10' 
       option proto 'static'                           
       option ipaddr '10.20.30.2' 
       option netmask '255.255.255.0'

with this switch configuration (full config at the end of this post)

config 'switch_vlan'
        option device 'switch0'
        option vlan '10'
        option ports '0t 1 2 3 4'

if I plug the wire at the LAN port (eth1) and execute a ping:


root@gl-ar300m-01:/# ping -c 3 -I eth1.10 10.20.30.10
PING 10.20.30.10 (10.20.30.10): 56 data bytes
64 bytes from 10.20.30.10: seq=0 ttl=64 time=0.571 ms

network capture from the wire (full capture at the end of this post):

22:01:28.516032 fe:ca:c1:98:87:53 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 10.20.30.10 tell 10.20.30.2, length 46
22:01:28.516113 30:8d:99:1f:ef:2a > fe:ca:c1:98:87:53, ethertype ARP (0x0806), length 42: Reply 10.20.30.10 is-at 30:8d:99:1f:ef:2a, length 28
22:01:28.516229 fe:ca:c1:98:87:53 > 30:8d:99:1f:ef:2a, ethertype IPv4 (0x0800), length 98: 10.20.30.2 > 10.20.30.10: ICMP echo request, id 1197, seq 0, length 64
22:01:28.516288 30:8d:99:1f:ef:2a > fe:ca:c1:98:87:53, ethertype IPv4 (0x0800), length 98: 10.20.30.10 > 10.20.30.2: ICMP echo reply, id 1197, seq 0, length 64

the packets are correctly untagged.

but if I try to run it on eth0 this is what i get:

root@gl-ar300m-01:/# ping -c 3 -I eth0.10 10.20.30.10
PING 10.20.30.10 (10.20.30.10): 56 data bytes

--- 10.20.30.10 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

network trace:

22:02:57.940557 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.20.30.10 tell 10.20.30.1, length 42
22:02:58.954332 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.20.30.10 tell 10.20.30.1, length 42
22:02:59.994330 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.20.30.10 tell 10.20.30.1, length 42

the eth0 port is sending tagged packets, but why?

I am missing something?

Full config:

``` /etc/config/network
root@gl-ar300m-01:/# cat /etc/config/network
config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config 'switch' 'switch0'
        option 'enable_vlan' '1'
        option 'enable' '1'
        option 'reset' '1'

config 'switch_vlan'
        option device 'switch0'
        option vlan '10'
        option ports '0t 1 2 3 4'

config interface 'eth0_vlan10'         
       option ifname 'eth0.10'          
       option proto 'static'                           
       option ipaddr '10.20.30.1' 
       option netmask '255.255.255.0'

config interface 'eth1_vlan10'         
       option ifname 'eth1.10' 
       option proto 'static'                           
       option ipaddr '10.20.30.2' 
       option netmask '255.255.255.0'
ip address show
root@gl-ar300m-01:/# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 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: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN qlen 1000
    link/ether e4:95:6e:43:a0:3d brd ff:ff:ff:ff:ff:ff
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN qlen 1000
    link/ether fe:ca:c1:98:87:53 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether e4:95:6e:43:a0:3d brd ff:ff:ff:ff:ff:ff
5: eth0.10@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN qlen 1000
    link/ether e4:95:6e:43:a0:3d brd ff:ff:ff:ff:ff:ff
    inet 10.20.30.1/24 brd 10.20.30.255 scope global eth0.10
       valid_lft forever preferred_lft forever
6: eth1.10@eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN qlen 1000
    link/ether fe:ca:c1:98:87:53 brd ff:ff:ff:ff:ff:ff
    inet 10.20.30.2/24 brd 10.20.30.255 scope global eth1.10
       valid_lft forever preferred_lft forever
swconfig list
root@gl-ar300m-01:/# swconfig list
Found: switch0 - eth1
swconfig dev switch0 help
root@gl-ar300m-01:/# swconfig dev switch0 help
switch0: eth1(AR934X built-in switch), ports: 5 (cpu @ 0), vlans: 16
     --switch
        Attribute 1 (int): enable_vlan (Enable VLAN mode)
        Attribute 2 (int): mirror_monitor_port (Mirror monitor port)
        Attribute 3 (none): apply (Activate changes in the hardware)
        Attribute 4 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (int): vid (VLAN ID)
        Attribute 2 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (int): enable_mirror_rx (Enable mirroring of RX packets)
        Attribute 2 (int): enable_mirror_tx (Enable mirroring of TX packets)
        Attribute 3 (int): pvid (Primary VLAN ID)
        Attribute 4 (unknown): link (Get port link information)
swconfig dev switch0 show
root@gl-ar300m-01:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 1
        mirror_monitor_port: 15
Port 0:
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        pvid: 0
        link: port:0 link:up speed:1000baseT full-duplex txflow rxflow 
Port 1:
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        pvid: 10
        link: port:1 link:down
Port 2:
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        pvid: 10
        link: port:2 link:down
Port 3:
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        pvid: 10
        link: port:3 link:down
Port 4:
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        pvid: 10
        link: port:4 link:down
VLAN 0:
        vid: 0
        ports: 0t 
VLAN 10:
        vid: 10
        ports: 0t 1 2 3 4 
plug wire to lan port
root@gl-ar300m-01:/# [  131.846812] eth1: link up (1000Mbps/Full duplex)
[  131.851614] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[  131.862123] IPv6: ADDRCONF(NETDEV_CHANGE): eth1.10: link becomes ready
ip address show dev eth1.10
root@gl-ar300m-01:/# ip a s dev eth1.10
6: eth1.10@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether fe:ca:c1:98:87:53 brd ff:ff:ff:ff:ff:ff
    inet 10.20.30.2/24 brd 10.20.30.255 scope global eth1.10
       valid_lft forever preferred_lft forever
    inet6 fe80::fcca:c1ff:fe98:8753/64 scope link 
       valid_lft forever preferred_lft forever
ping -c 3 -I eth1.10 10.20.30.10
root@gl-ar300m-01:/# ping -c 3 -I eth1.10 10.20.30.10
PING 10.20.30.10 (10.20.30.10): 56 data bytes
64 bytes from 10.20.30.10: seq=0 ttl=64 time=0.571 ms
64 bytes from 10.20.30.10: seq=1 ttl=64 time=0.578 ms
64 bytes from 10.20.30.10: seq=2 ttl=64 time=0.444 ms

--- 10.20.30.10 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.444/0.531/0.578 ms
packet capture for ping from eth1
22:01:28.516032 fe:ca:c1:98:87:53 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 10.20.30.10 tell 10.20.30.2, length 46
22:01:28.516113 30:8d:99:1f:ef:2a > fe:ca:c1:98:87:53, ethertype ARP (0x0806), length 42: Reply 10.20.30.10 is-at 30:8d:99:1f:ef:2a, length 28
22:01:28.516229 fe:ca:c1:98:87:53 > 30:8d:99:1f:ef:2a, ethertype IPv4 (0x0800), length 98: 10.20.30.2 > 10.20.30.10: ICMP echo request, id 1197, seq 0, length 64
22:01:28.516288 30:8d:99:1f:ef:2a > fe:ca:c1:98:87:53, ethertype IPv4 (0x0800), length 98: 10.20.30.10 > 10.20.30.2: ICMP echo reply, id 1197, seq 0, length 64
22:01:29.516424 fe:ca:c1:98:87:53 > 30:8d:99:1f:ef:2a, ethertype IPv4 (0x0800), length 98: 10.20.30.2 > 10.20.30.10: ICMP echo request, id 1197, seq 1, length 64
22:01:29.516501 30:8d:99:1f:ef:2a > fe:ca:c1:98:87:53, ethertype IPv4 (0x0800), length 98: 10.20.30.10 > 10.20.30.2: ICMP echo reply, id 1197, seq 1, length 64
22:01:30.516481 fe:ca:c1:98:87:53 > 30:8d:99:1f:ef:2a, ethertype IPv4 (0x0800), length 98: 10.20.30.2 > 10.20.30.10: ICMP echo request, id 1197, seq 2, length 64
22:01:30.516577 30:8d:99:1f:ef:2a > fe:ca:c1:98:87:53, ethertype IPv4 (0x0800), length 98: 10.20.30.10 > 10.20.30.2: ICMP echo reply, id 1197, seq 2, length 64
unplug wire from eth1 and plug it to eth0
root@gl-ar300m-01:/# [  354.206736] eth1: link down
[  356.908937] eth0: link up (100Mbps/Full duplex)
[  356.913665] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[  356.924190] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.10: link becomes ready
ip address show dev eth0.10
root@gl-ar300m-01:/# ip a s dev eth0.10
5: eth0.10@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether e4:95:6e:43:a0:3d brd ff:ff:ff:ff:ff:ff
    inet 10.20.30.1/24 brd 10.20.30.255 scope global eth0.10
       valid_lft forever preferred_lft forever
    inet6 fe80::e695:6eff:fe43:a03d/64 scope link 
       valid_lft forever preferred_lft forever

ping -c 3 -I eth0.10 10.20.30.10
root@gl-ar300m-01:/# ping -c 3 -I eth0.10 10.20.30.10
PING 10.20.30.10 (10.20.30.10): 56 data bytes

--- 10.20.30.10 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
packet capture for ping from eth0
22:02:57.940557 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.20.30.10 tell 10.20.30.1, length 42
22:02:58.954332 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.20.30.10 tell 10.20.30.1, length 42
22:02:59.994330 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.20.30.10 tell 10.20.30.1, length 42
dmesg
root@gl-ar300m-01:/# dmesg
[    0.000000] Linux version 4.14.180 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11063-85e04e9f46)) #0 Sat May 16 18:32:20 2020
[    0.000000] MyLoader: sysp=5f106d88, boardp=16e3fdbe, parts=afddffb9
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000] free_area_init_node: node 0, pgdat 804ecd30, node_mem_map 81000020
[    0.000000]   Normal zone: 256 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] random: get_random_bytes called from 0x804f0740 with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line:  board=GL-AR300M mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro console=ttyS0,115200 rootfstype=squashfsd
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 124292K/131072K available (3949K kernel code, 199K rwdata, 516K rodata, 320K init, 212K bss, 6780K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] Clocks: CPU:650.000MHz, DDR:597.363MHz, AHB:216.666MHz, Ref:25.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5880801374 ns
[    0.000008] sched_clock: 32 bits at 325MHz, resolution 3ns, wraps every 6607641598ns
[    0.008234] Calibrating delay loop... 432.53 BogoMIPS (lpj=2162688)
[    0.074858] pid_max: default: 32768 minimum: 301
[    0.079937] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.086908] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.096509] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.106924] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.114518] NET: Registered protocol family 16
[    0.120599] MIPS: machine is GL.iNet GL-AR300M
[    0.359523] ar71xx: using random MAC address for eth1
[    0.605660] ar724x-pci ar724x-pci.0: PCIe link is down
[    0.611121] registering PCI controller with io_map_base unset
[    0.629099] PCI host bridge to bus 0000:00
[    0.633481] pci_bus 0000:00: root bus resource [mem 0x10000000-0x11ffffff]
[    0.640722] pci_bus 0000:00: root bus resource [io  0x0000]
[    0.646597] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.653744] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.662112] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
[    0.665356] clocksource: Switched to clocksource MIPS
[    0.671694] NET: Registered protocol family 2
[    0.677208] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.684568] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.691330] TCP: Hash tables configured (established 1024 bind 1024)
[    0.698179] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.704348] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.711239] NET: Registered protocol family 1
[    0.715889] PCI: CLS 0 bytes, default 32
[    0.718693] Crashlog allocated RAM at address 0x3f00000
[    0.725553] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.737402] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.743546] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.763300] io scheduler noop registered
[    0.767485] io scheduler deadline registered (default)
[    0.773291] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.782066] console [ttyS0] disabled
[    0.805986] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    0.815083] console [ttyS0] enabled
[    0.822638] bootconsole [early0] disabled
[    0.838205] m25p80 spi0.0: found w25q128, expected m25p80
[    0.854963] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.859870] 4 cmdlinepart partitions found on MTD device spi0.0
[    0.865988] Creating 4 MTD partitions on "spi0.0":
[    0.870943] 0x000000000000-0x000000040000 : "u-boot"
[    0.877788] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.884581] 0x000000050000-0x000000ff0000 : "firmware"
[    0.913567] 2 uimage-fw partitions found on MTD device firmware
[    0.919719] 0x000000050000-0x0000001e0000 : "kernel"
[    0.925624] 0x0000001e0000-0x000000ff0000 : "rootfs"
[    0.931428] mtd: device 4 (rootfs) set to be root filesystem
[    0.937366] 1 squashfs-split partitions found on MTD device rootfs
[    0.943758] 0x000000450000-0x000000ff0000 : "rootfs_data"
[    0.952029] 0x000000ff0000-0x000001000000 : "art"
[    0.959227] libphy: Fixed MDIO Bus: probed
[    0.991646] libphy: ag71xx_mdio: probed
[    1.628351] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    1.638379] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: mii
[    2.267914] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.321108] eth1: Atheros AG71xx at 0xba000000, irq 5, mode: gmii
[    2.329195] NET: Registered protocol family 10
[    2.338360] Segment Routing with IPv6
[    2.342238] NET: Registered protocol family 17
[    2.346939] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    2.360871] 8021q: 802.1Q VLAN Support v1.8
[    2.366878] hctosys: unable to open rtc device (rtc0)
[    2.377742] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[    2.386818] Freeing unused kernel memory: 320K
[    2.391407] This architecture does not have kernel memory protection.
[    2.555363] random: fast init done
[    3.107785] init: Console is alive
[    3.111542] init: - watchdog -
[    4.163010] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.223911] usbcore: registered new interface driver usbfs
[    4.229737] usbcore: registered new interface driver hub
[    4.235311] usbcore: registered new device driver usb
[    4.245611] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.253910] ehci-platform: EHCI generic platform driver
[    4.259463] ehci-platform ehci-platform: EHCI Host Controller
[    4.265461] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    4.275759] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    4.305393] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    4.312700] hub 1-0:1.0: USB hub found
[    4.316981] hub 1-0:1.0: 1 port detected
[    4.322094] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.340053] init: - preinit -
[    4.928604] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    4.956832] random: procd: uninitialized urandom read (4 bytes read)
[    8.350659] jffs2: notice: (420) jffs2_build_xattr_subsystem: complete building xattr subsystem, 54 of xdatum (3 unchecked, 51 orphan) and 165 of xref (55 dead, 3 or.
[    8.376113] mount_root: loading kmods from internal overlay
[    8.439708] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[    8.452580] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[    8.724820] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[    8.737001] block: extroot: not configured
[    8.742219] mount_root: switching to jffs2 overlay
[    8.769968] overlayfs: upper fs does not support tmpfile.
[    8.780154] urandom-seed: Seeding with /etc/urandom.seed
[    9.118871] procd: - early -
[    9.121962] procd: - watchdog -
[    9.754115] procd: - watchdog -
[    9.757723] procd: - ubus -
[    9.811214] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.818298] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.824899] random: ubusd: uninitialized urandom read (4 bytes read)
[    9.832361] procd: - init -
[   10.760706] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.900820] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   10.923110] Loading modules backported from Linux version v4.19.120-0-gfdc072324f3c
[   10.931081] Backport generated by backports.git v4.19.120-1-0-g60c3a249
[   10.957663] ip_tables: (C) 2000-2006 Netfilter Core Team
[   10.983047] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
[   11.106260] xt_time: kernel timezone is -0000
[   11.210273] PPP generic driver version 2.4.2
[   11.226317] NET: Registered protocol family 24
[   11.299212] ath: EEPROM regdomain: 0x0
[   11.299221] ath: EEPROM indicates default country code should be used
[   11.299224] ath: doing EEPROM country->regdmn map search
[   11.299238] ath: country maps to regdmn code: 0x3a
[   11.299244] ath: Country alpha2 being used: US
[   11.299247] ath: Regpair used: 0x3a
[   11.312084] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   11.313988] ieee80211 phy0: Atheros AR9531 Rev:2 mem=0xb8100000, irq=47
[   11.391550] urngd: v1.0.2 started.
[   11.395936] kmodloader: done loading kernel modules from /etc/modules.d/*
[   11.994803] random: crng init done
[   11.998399] random: 6 urandom warning(s) missed due to ratelimiting
[   20.462080] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   20.472401] IPv6: ADDRCONF(NETDEV_UP): eth0.10: link is not ready
[   20.558160] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[   20.576429] IPv6: ADDRCONF(NETDEV_UP): eth1.10: link is not ready

First of all this configuration is wrong.
You have 2 separate interfaces, not bridged, belonging to the same subnet 10.20.30.0/24
eth1 will always tag.
eth0 belongs to internal vlan 10 but doesn't tag. Also the incoming packets are not assigned to some pvid.

now two different networks:

config interface 'eth0_vlan10'         
       option ifname 'eth0.10'          
       option proto 'static'                           
       option ipaddr '10.0.1.1'
       option netmask '255.255.255.0'

config interface 'eth1_vlan10'         
       option ifname 'eth1.10' 
       option proto 'static'                           
       option ipaddr '10.0.2.1' 
       option netmask '255.255.255.0'

switch config:

config 'switch' 'switch0'
        option 'enable_vlan' '1'
        option 'enable' '1'
        option 'reset' '1'

config 'switch_vlan'
        option device 'switch0'
        option vlan '10'
        option ports '0t 1 2 3 4'

testing with eth1:

root@gl-ar300m-01:/# ip a s dev eth1.10
6: eth1.10@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 86:a3:d2:ea:41:dd brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.1/24 brd 10.0.2.255 scope global eth1.10
       valid_lft forever preferred_lft forever
    inet6 fe80::84a3:d2ff:feea:41dd/64 scope link 
       valid_lft forever preferred_lft forever

root@gl-ar300m-01:/# ping -c 3 -I eth1.10 10.0.2.2
PING 10.0.2.2 (10.0.2.2): 56 data bytes
64 bytes from 10.0.2.2: seq=0 ttl=64 time=0.751 ms
64 bytes from 10.0.2.2: seq=1 ttl=64 time=0.576 ms
64 bytes from 10.0.2.2: seq=2 ttl=64 time=0.440 ms

--- 10.0.2.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.440/0.589/0.751 ms

network trace:

13:24:37.135947 86:a3:d2:ea:41:dd > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 10.0.2.2 tell 10.0.2.1, length 46
13:24:37.136021 30:8d:99:1f:ef:2a > 86:a3:d2:ea:41:dd, ethertype ARP (0x0806), length 42: Reply 10.0.2.2 is-at 30:8d:99:1f:ef:2a, length 28
13:24:37.136134 86:a3:d2:ea:41:dd > 30:8d:99:1f:ef:2a, ethertype IPv4 (0x0800), length 98: 10.0.2.1 > 10.0.2.2: ICMP echo request, id 1189, seq 0, length 64
13:24:37.136186 30:8d:99:1f:ef:2a > 86:a3:d2:ea:41:dd, ethertype IPv4 (0x0800), length 98: 10.0.2.2 > 10.0.2.1: ICMP echo reply, id 1189, seq 0, length 64
13:24:38.136156 86:a3:d2:ea:41:dd > 30:8d:99:1f:ef:2a, ethertype IPv4 (0x0800), length 98: 10.0.2.1 > 10.0.2.2: ICMP echo request, id 1189, seq 1, length 64
13:24:38.136234 30:8d:99:1f:ef:2a > 86:a3:d2:ea:41:dd, ethertype IPv4 (0x0800), length 98: 10.0.2.2 > 10.0.2.1: ICMP echo reply, id 1189, seq 1, length 64
13:24:39.136231 86:a3:d2:ea:41:dd > 30:8d:99:1f:ef:2a, ethertype IPv4 (0x0800), length 98: 10.0.2.1 > 10.0.2.2: ICMP echo request, id 1189, seq 2, length 64
13:24:39.136303 30:8d:99:1f:ef:2a > 86:a3:d2:ea:41:dd, ethertype IPv4 (0x0800), length 98: 10.0.2.2 > 10.0.2.1: ICMP echo reply, id 1189, seq 2, length 64

testing with eth0

root@gl-ar300m-01:/# ip a s dev eth0.10
5: eth0.10@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether e4:95:6e:43:a0:3d brd ff:ff:ff:ff:ff:ff
    inet 10.0.1.1/24 brd 10.0.1.255 scope global eth0.10
       valid_lft forever preferred_lft forever
    inet6 fe80::e695:6eff:fe43:a03d/64 scope link 
       valid_lft forever preferred_lft forever


root@gl-ar300m-01:/# ping -c 3 -I eth0.10 10.0.2.2
PING 10.0.2.2 (10.0.2.2): 56 data bytes

--- 10.0.2.2 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

network trace:

13:25:59.356876 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.0.2.2 tell 10.0.1.1, length 42
13:26:00.359887 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.0.2.2 tell 10.0.1.1, length 42
13:26:01.399689 e4:95:6e:43:a0:3d > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 10, p 0, ethertype ARP, Request who-has 10.0.2.2 tell 10.0.1.1, length 42

and again it doesn't work, outgoing packets from eth1 are correctly untagged but not from eth0.

Any idea what is happening?

last ping I run was to the 10.0.2.0/24 network instead 10.0.1.0/24, anyway it fails to untag outgoing packets

At a guess, the WAN port probably isn't part of the internal switch, so its VLAN is controlled by the interface config, i.e. option ifname 'eth0.10'. The LAN port on the other hand is part of the switch so while it has option ifname 'eth1.10' in the interface config, the switch config is set to strip the vlan tag when traffic leaves the port.

1 Like

You have the .10 subinterface. It will tag. If you don't want tagging remove the .10

yes, I know I can remove the vlan for eth0, what I was asking is the why of the inconsistency between eth0 and eth1, just to know how things work.

eth1 is behind a switch. You can assign ports to vlans and have them tagged or untagged.
eth0 is straight forward, you add a vlan subinterface it will tag.

Try this:

1 Like