IPv6 RA leak between VLANs

Hi!

I have a configuration with several VLANs that are assigned different IP ranges and it looks like route advertisements leak between interfaces. Here's my config:

I have a VLAN reserved for guest users and my main VLAN. When I connect to either one I'm getting assigned correct IPv6 addresses using stateless configuration, it works as expected. However, after several minutes the interface clients get another set of IPv6 addresses belonging to the other VLAN.

So if I connect to the guest network I get a correct guest address (which works) and after a few minutes I getting an address from the main LAN (which does not work).

I've tried playing with delegated prefix sizes, with disabling built-in IPv6 and so on. No luck so far. Any ideas what I can do to debug this problem?

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have

uci export network; uci export wireless; \
uci export dhcp; uci export firewall; \
head -n -0 /etc/firewall.user; \

1 Like

Here's the configuration. The IP allocations are temporary and so I didn't bother to redact them.

package network

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd82:fd1e:3b57::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'lan0 lan1 lan2 lan3 lan4'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6hint 'BB'
	option ip6assign '64'
	option delegate '0'

config interface 'wan'
	option ifname 'eth2'
	option proto 'static'
	option gateway '76.191.126.81'
	option ipaddr '76.191.126.82'
	option netmask '255.255.255.252'
	option ip6prefix '2600:2104:A::0/48'
	option ip6gw '2600:2104:8::1'
	list ip6addr '2600:2104:8::2/126'

config interface 'lte0'
	option proto 'qmi'
	option metric '10'
	option device '/dev/cdc-wdm0'
	option dhcpv6 'true'
	option apn 'fast.t-mobile.com'
	option delegate '0'
	option auto '0'

config interface 'voice'
	option proto 'static'
	option type 'bridge'
	option ipaddr '192.168.55.10'
	option netmask '255.255.255.0'
	option ifname 'lan4.2 lan3.2 lan2.2 lan1.2 lan0.2'
	option delegate '0'

config interface 'guest'
	option proto 'static'
	option type 'bridge'
	option ipaddr '10.0.0.1'
	option netmask '255.255.255.0'
	option ifname 'lan4.3 lan3.3 lan2.3 lan1.3 lan0.3'
	option ip6assign '64'
	option ip6hint 'AA'
	option delegate '0'

config interface 'realip'
	option proto 'static'
	option type 'bridge'
	option netmask '255.255.255.248'
	option ip6assign '64'
	option ifname 'lan4.5 lan3.5 lan2.5 lan1.5 lan0.5'
	option ip6hint 'EE'
	option ipaddr '76.191.126.89'
	option delegate '0'

config interface 'wg0'
	option proto 'wireguard'
	option listen_port '51820'
	option private_key '...'
	list addresses '76.191.126.85/30'

config wireguard_wg0
	option route_allowed_ips '1'
	option persistent_keepalive '25'
	option endpoint_port '21841'
	list allowed_ips '76.191.126.86/32'
	list allowed_ips '2600:2104:a:ff::0/56'
	option public_key '...'

package wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11a'
	option path 'soc/soc:pcie/pci0000:00/0000:00:02.0/0000:02:00.0'
	option country 'US'
	option channel 'auto'
	option htmode 'VHT80'
	option legacy_rates '1'

config wifi-device 'radio1'
	option type 'mac80211'
	option hwmode '11g'
	option path 'soc/soc:pcie/pci0000:00/0000:00:01.0/0000:01:00.0'
	option country 'US'
	option legacy_rates '1'
	option channel 'auto'
	option htmode 'HT40'

package dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.auto'
	option nonwildcard '1'
	list addnhosts '/tmp/hosts/manual'
	option localservice '1'
	list server '8.8.8.8'

config dhcp 'lan'
	option interface 'lan'
	option leasetime '12h'
	option dhcpv6 'server'
	option ra 'server'
	option start '10'
	option limit '250'
	option force '1'
	option ra_management '1'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'
	list dns '2607:F060:2::1'
	list dns '2607:F060:2:1::1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config dhcp 'guest'
	option interface 'guest'
	option start '50'
	option limit '200'
	option leasetime '1h'
	option ra 'server'

config dhcp 'wan6'
	option start '100'
	option leasetime '12h'
	option limit '150'
	option interface 'wan6'
	option ra 'server'
	option dhcpv6 'server'
	option ra_management '1'
	option ra_default '1'

config dhcp 'realip'
	option interface 'realip'
	option limit '6'
	option leasetime '10m'
	option start '2'

package firewall

config defaults
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config zone
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	option network 'lan'

config zone
	option name 'wan'
	option output 'ACCEPT'
	option input 'ACCEPT'
	option forward 'ACCEPT'
	option masq '1'
	option mtu_fix '1'
	option network 'wan'
	list masq_src '192.168.0.0/16'
	list masq_src '10.0.0.0/8'

config rule
	option name 'Allow-DHCP-Renew'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'
	option src 'lan'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option src_ip 'fc00::/6'
	option dest_ip 'fc00::/6'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'
	option icmp_type 'echo-reply destination-unreachable echo-request router-advertisement router-solicitation time-exceeded'
	option dest '*'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config include
	option path '/etc/firewall.user'

config zone
	option name 'lte'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option masq '1'
	option forward 'ACCEPT'
	option network 'lte0 lte0v6'

config rule
	option target 'ACCEPT'
	option proto 'tcp udp'
	option dest_port '53'
	option name 'Allow DNS'
	option src '*'

config rule
	option target 'ACCEPT'
	option src 'wan'
	option proto 'tcp'
	option dest_port '22'
	option name 'SSH'

config rule
	option target 'ACCEPT'
	option src 'wan'
	option proto 'tcp'
	option dest_port '443'
	option name 'HTTPS'

config rule
	option target 'ACCEPT'
	option src 'wan'
	option proto 'tcp'
	option dest_port '80'
	option name 'HTTP'

config zone
	option name 'guest'
	option output 'ACCEPT'
	option network 'guest'
	option input 'ACCEPT'
	option forward 'ACCEPT'

config rule
	option name 'Allow DNS Queries'
	option src 'guest'
	option dest_port '53'
	option proto 'tcp udp'
	option target 'ACCEPT'

config rule
	option name 'Allow DHCP request'
	option src 'guest'
	option src_port '67-68'
	option dest_port '67-68'
	option proto 'udp'
	option target 'ACCEPT'

config include 'miniupnpd'
	option type 'script'
	option path '/usr/share/miniupnpd/firewall.include'
	option family 'any'
	option reload '1'

config rule
	option target 'ACCEPT'
	option proto 'tcp udp'
	option name 'Allow DHCP-67'
	option src 'lan'
	option src_port '67-68'

config rule
	option target 'ACCEPT'
	option proto 'udp'
	option name 'Allow outbound'
	option dest 'lan'

config rule
	option target 'ACCEPT'
	option dest_port '51820'
	option name 'Allow Wireguard'
	option proto 'tcp udp'
	option src 'wan'
	option dest 'real'

config zone
	option input 'ACCEPT'
	option forward 'ACCEPT'
	option output 'ACCEPT'
	option name 'real'
	option network 'realip wg0'

config forwarding
	option dest 'lan'
	option src 'lte'

config forwarding
	option dest 'lan'
	option src 'real'

config forwarding
	option dest 'lte'
	option src 'lan'

config forwarding
	option dest 'real'
	option src 'lan'

config forwarding
	option dest 'wan'
	option src 'guest'

config forwarding
	option dest 'wan'
	option src 'lan'

config forwarding
	option dest 'wan'
	option src 'real'

config forwarding
	option dest 'guest'
	option src 'wan'

config forwarding
	option dest 'lan'
	option src 'wan'

config forwarding
	option dest 'real'
	option src 'wan'

config rule
	option enabled '1'
	option target 'ACCEPT'
	option src 'real'
	option name 'Allow outbound UDP'
	option proto 'udp'
	option dest 'wan'

config zone
	option network 'voice'
	option input 'ACCEPT'
	option forward 'ACCEPT'
	option name 'isolated'
	option output 'ACCEPT'
	option family 'ipv4'
	option masq '1'

config forwarding
	option dest 'lan'
	option src 'isolated'

config forwarding
	option dest 'isolated'
	option src 'lan'

# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.

# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.

FYI limit is the pool size, not the last IP. To serve from 10 to 250, you need to change the limit to 151.

Remove them from dhcp and add them under wan interface. Although it would be best to separate the IPv6 part of wan interface with a separate wan6 interface.

You may want to change input and forward to REJECT or DROP. Otherwise your router is wide open.

Source is wan not lan.

You should not allow access to DNS from wan, so the wildcard * is wrong here.

Opening the uhttpd server on the wan is very bad practice, as it is not hardened to withstand attacks.

Same here, input and forward REJECT or DROP.

Unnecessary.

Unnecessary.

Wireguard running on OpenWrt listens to 51820, so nothing will be forwarded to lan. And WG uses only udp.

I won't go into more detail, I have spotted enough problems already to make me think it would be best to reset to defaults and start from scratch. Regarding your topic, I believe the managed you are using is not configured properly with the native vlan which is the lan interface and you have frames jumping from one vlan to the other. Assign a vlan on lan interface (it could be 10) and allow only tagged frames on the switch.

1 Like

Lots of these notes are actually intended, like publiclly available DNS and permissive forwarding rules (OpenWRT actually serves as an authoritative DNS, with public recursion disabled). The management on the WAN interface is enabled for now to allow easier debugging from outside the network.

I've looked into the configuration several times and I don't see how RAs from one interface can leak into another.

I'm going to try to allow only tagged frames, let's see if it helps...

1 Like

OK, I tried adding the VLAN tagging filtering on the switch. Didn't help at all, the router advertisements still leak.

However, everything started working fine when I removed the PD support from the LAN interface. I'm not sure why it mattered. Will try to debug it with tcpdump.

No point to add multiple bridges for VLAN here - the default br-lan already allow VLAN tagged frames to forward as is.

I mean that I have a managed switch in front of the OpenWRT box and I disabled untagged frames for the OpenWRT port.

That was already turned off from what I see here. You assigned a /64. The delegate 0 is for DSlite/map/646xlate.
Could be another device that receives a delegated prefix from LAN and redistributes it in guest?

Indeed, I guess I left it on during one of my experiments.

I had the leakage even with my computer directly connected to the router and I can reproduce it again by using this config. The leakage disappeared after I tried a couple of small changes, like switching from a combined V4/V6 connection to V4 and a separate V6.

It definitely seems like a strange setting interaction somewhere in the stack. I'm going to try to debug this in a test environment.

I have still a problem with ipv6 RA in wrong/all vlans on E8450. Offload is not related as it is disabled.
A (DSA) bridge br-lan with lan1-4 and some vlans br-lan.X is configured.
Every bridge interface has a unique MAC set and got a public ipv6 (or ULA!) and then odhcp (or dnsmasq-v6) sends RAs for every bridge-interface.
Now RAs for all existings MACs/LL-IPv6 are send to every Vlan. To force: service odhcpd restart.

IPtable logs show that the RAs exit the device on the correct br-lan.X interface - but tcpdump on a host on the lan sees all RAs - and with SLAAC it get s many IPv6s of which only 1 works
I'm not sure if this is a problem of DSA or IPv6. As IPv6 also does not work with sw-offloading it could be IPv6

I don't have problems with the RAs sent out on my vlans. I am not using bridge however. Can you try to create an vlan subinterface without bridge and verify?

Its not a bug, its a feature ... of Windows!
All Windows versions strip the Vlan tags and used the RAs. So all router of all vlans are assigned and slaac then add many the ips. Even when a vlan-capable nertwork driver is installed and you set a Vlan you get all RAs.
Amusing: DHCP with IPv4 works well - maybe there are some workarounds in the OS
Solutions:

  • Disable all RAs and use static Ipv6 ^^
  • Use only wlan (different AP for each vlan)
  • Or use a managed switch Microsoft devices

What a crap!

This goes without saying, vlans are not propagated in wifi.

This should be the default when dealing with vlans. If there is only one host connected on a port, then the port should be set to send unttaged frames.