Setup GL-MT6000: All traffic through VPN (AirVpn)

I have a Fritzbox 6660 as my main router (I need the cable connection for my ISP).

In another room, I have the GL-MT6000, flashed with OpenWrt. I connected the GL-MT6000 to my main router via Wifi (not LAN!) via Mode: Client.

My goal is that all connections to the GL-MT6000, be it LAN or Wifi, should go through a VPN (AirVPN), while all connections to the Fritzbox don't go through any VPN.

What I have done:

  • installed packages: luci-proto-wireguard, kmod-wireguard, wireguard-tools
  • added AirVpn interface (Protocol: WireGuard VPN). Imported config from AirVpn (MTU: 1420, keepalive: 25). Created and assigned firezone "vpn". Saved.
  • configured Firewall as follows
  • changed LAN interface to use custom DNS server of AirVpn
  • rebooted

Problem:

  • Internet works fine via Wifi, but the VPN is not used at all. IP and DNS are both leaked.

Happy about any directions. Cheers!

Please connect to your OpenWrt device using ssh and 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:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall
1 Like

@psherman

root@OpenWrt:~# ubus call system board
{
	"kernel": "5.15.167",
	"hostname": "OpenWrt",
	"system": "ARMv8 Processor rev 4",
	"model": "GL.iNet GL-MT6000",
	"board_name": "glinet,gl-mt6000",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.5",
		"revision": "r24106-10cc5fcd00",
		"target": "mediatek/filogic",
		"description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
	}
}
root@OpenWrt:~# cat /etc/config/network

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

config globals 'globals'
	option ula_prefix 'fdb6:b9b7:2c54::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'
	list ports 'lan5'

config device
	option name 'lan1'
	option macaddr 'xx:xx:xx:xx:xx:xx'

config device
	option name 'lan2'
	option macaddr 'xx:xx:xx:xx:xx:xx'

config device
	option name 'lan3'
	option macaddr 'xx:xx:xx:xx:xx:xx'

config device
	option name 'lan4'
	option macaddr 'xx:xx:xx:xx:xx:xx'

config device
	option name 'lan5'
	option macaddr 'xx:xx:xx:xx:xx:xx'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	list dns '10.128.0.1'

config device
	option name 'eth1'
	option macaddr 'xx:xx:xx:xx:xx:xx'

config interface 'wan'
	option device 'eth1'
	option proto 'dhcp'
	option type 'bridge'

config interface 'wan6'
	option device 'eth1'
	option proto 'dhcpv6'
	option type 'bridge'

config interface 'wwan'
	option proto 'dhcp'

config interface 'AirVpn'
	option proto 'wireguard'
	option private_key 'xxxxxxxxx='
	list addresses 'xx.xxx.xx.xxx/32'
	list addresses 'xxxxxxxxxx/128'
	list dns 'xxxxxxxx'
	list dns 'xxxxxxxx'

config wireguard_AirVpn
	option description 'Imported peer configuration'
	option public_key 'xxxxxxxxxxx='
	option preshared_key 'xxxxxxxxx='
	list allowed_ips '0.0.0.0/0'
	list allowed_ips '::/0'
	option persistent_keepalive '25'
	option endpoint_host 'xxxxx.vpn.airdns.org'
	option endpoint_port '1637'

root@OpenWrt:~# cat /etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/soc/18000000.wifi'
	option channel '1'
	option band '2g'
	option htmode 'HE20'
	option disabled '1'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'platform/soc/18000000.wifi+1'
	option channel 'auto'
	option band '5g'
	option htmode 'HE80'
	option cell_density '0'
	option country 'DE'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'
	option disabled '1'

config wifi-iface 'wifinet2'
	option device 'radio1'
	option mode 'sta'
	option network 'wwan'
	option ssid 'xxxxxxxxxxxxxxxx'
	option encryption 'psk2'
	option key 'xxxxxxxxx'

config wifi-iface 'wifinet3'
	option device 'radio1'
	option mode 'ap'
	option ssid 'xxxxxxxxx'
	option encryption 'sae'
	option key 'x'xxxxxxxxx
	option network 'lan'

root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'
	option filter_aaaa '0'
	option filter_a '0'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

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

root@OpenWrt:~# cat /etc/config/firewall

config defaults
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

config zone
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	option mtu_fix '1'
	option masq '1'

config zone
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option mtu_fix '1'
	list network 'wan'
	list network 'wan6'
	list network 'wwan'
	option masq '1'

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

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 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'
	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'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

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 zone
	option name 'vpn'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list network 'lan'
	list network 'AirVpn'
	option masq '1'

config forwarding
	option src 'lan'
	option dest 'vpn'

config forwarding
	option src 'vpn'
	option dest 'wan'

Remove the bridge line from each of these:

Add the following line to the above:

	option route_allowed_ips '1'

Remove masquerading on the lan zone and add the lan network to this zone:

Remove the lan network from the vpn zone. Also change input and forward toREJECT

Delete this:

Then restart and test again.

1 Like

@psherman

I changed everything accordingly. I think so at least (had to start all over, because I messed up). Now I cannot access the Internet any longer. Neither via Wifi nor LAN. I can only access OpenWrt.

I ran your commands again:

root@OpenWrt:~# ubus call system board
{
	"kernel": "5.15.167",
	"hostname": "OpenWrt",
	"system": "ARMv8 Processor rev 4",
	"model": "GL.iNet GL-MT6000",
	"board_name": "glinet,gl-mt6000",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.5",
		"revision": "r24106-10cc5fcd00",
		"target": "mediatek/filogic",
		"description": "OpenWrt 23.05.5 r24106-10cc5fcd00"
	}
}
root@OpenWrt:~# cat /etc/config/network

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

config globals 'globals'
	option ula_prefix 'fd22:cf41:ae7a::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'
	list ports 'lan5'

config device
	option name 'lan1'
	option macaddr 'xxx'

config device
	option name 'lan2'
	option macaddr 'xxx'

config device
	option name 'lan3'
	option macaddr 'xxx'

config device
	option name 'lan4'
	option macaddr 'xxx'

config device
	option name 'lan5'
	option macaddr 'xxx

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config device
	option name 'eth1'
	option macaddr 'xxx'

config interface 'wan'
	option device 'eth1'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth1'
	option proto 'dhcpv6'

config interface 'wwan'
	option proto 'dhcp'

config interface 'AirVpn'
	option proto 'wireguard'
	option private_key 'xxx='
	list addresses 'xxx/32'
	list addresses 'xxx/128'
	list dns 'xxx'
	list dns 'xxx::1'

config wireguard_AirVpn
	option description 'Imported peer configuration'
	option public_key 'xxx='
	option preshared_key 'xxx='
	list allowed_ips '0.0.0.0/0'
	list allowed_ips '::/0'
	option persistent_keepalive '25'
	option endpoint_host 'xxx.vpn.airdns.org'
	option endpoint_port '1637'
	option route_allowed_ips '1'

root@OpenWrt:~# cat /etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/soc/18000000.wifi'
	option channel '1'
	option band '2g'
	option htmode 'HE20'
	option disabled '1'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'platform/soc/18000000.wifi+1'
	option channel '36'
	option band '5g'
	option htmode 'HE80'
	option country 'DE'
	option cell_density '0'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'sae'
	option key 'xxx'

config wifi-iface 'wifinet2'
	option device 'radio1'
	option mode 'sta'
	option network 'wwan'
	option ssid 'xxx'
	option encryption 'psk2'
	option key 'xxx'

root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option boguspriv '1'
	option filterwin2k '0'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option nonegcache '0'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option ednspacket_max '1232'
	option filter_aaaa '0'
	option filter_a '0'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	option ra_slaac '1'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

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

root@OpenWrt:~# cat /etc/config/firewall

config defaults
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

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

config zone
	option name 'vpn'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	list network 'AirVpn'

config zone
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'wan'
	list network 'wan6'
	list network 'wwan'

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

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 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'
	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'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

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 forwarding
	option src 'lan'
	option dest 'vpn'

Enable masquerading on this interface.

If that doesn’t work, please show:

wg show
1 Like

@psherman That worked! Now there are two problems left:

  1. IPv6 doesn't work. When I visit ipleak.net, I only see an IPv4 address. This isn't due to the VPN, since I only saw an IPv4 address even before adding the VPN interface. When I connect directly to my Fritzbox, I see an IPv6 address as well.

  2. While the IPv4 address shown on ipleak.net is from the VPN, the DNS addresses show both my ISP as well as the VPN DNS. Even though I set custom DNS server to 172.16.0.1 on wan and wan6 interfaces. Might this be due to the Fritzbox?

Thanks a lot!

IPv6 is a function of your vpn.

DNS won’t affect your wan/wan6 interfaces because they aren’t active (you have connectivity via wwan). You must have a non-vpn dns in order for the system to resolve the vpn in the first place. But you can use a public dns instead of your isp dns.

2 Likes

@psherman

AirVpn supports IPv6. When I connect to my Fritzbox without VPN, I have a IPv6 address. When I use AirVpn via wireguard on my PC and connect to my Fritzbox, I also have a IPv6 address. So there must be a certain reason why my current router setup doesn't support IPv6?

That makes sense. I set custom DNS server of the wwan to 172.16.0.1 and DNS leaks are gone.

For wireguard IPv6 you also have to enable masquerading of ipv6 on the wg firewall zone.
Furthermore you either have to disable source routing or easier use this as allowed ips instead of ::/0:
8000::/1 and ::/1

1 Like

@egc I activated IPv6 Masquerading for vpn and wan interfaces and changed allowed ips to: 0.0.0.0/0, 8000::/1, ::/1.

Changed nothing unfortunately. Still no IPv6 according to ipleak.net. Any logs / configs you'd like to see?

@psherman I previously stated that I set custom DNS server of the wwan to 172.16.0.1 and since, DNS leaks are gone. However, this made some trouble whenever I restarted network services or rebooted. I couldn't access webpages any longer, so DNS wasn't working. I had to change it back to Use DNS servers advertised by peer. However, since I just installed AdGuard I saw that there is an option for DNS Forwards under DHCP and DNS. When I add AirVpn DNS there everything is working fine. Actually now I use AdGuard DNS their and add AirVpn DNS in AdGuard. Is that the proper way to do it? Any idea why setting the DNS in the wwan interface led to trouble?

I actually warned about that.

2 Likes

@psherman Ah, I see. I didn't understand that at first. Thanks so much for your help! I learned a lot today :slight_smile: Any idea what I can do to properly handle IPv6?

Great. Glad that helped.

On ipv6, I am not the expert. Hopefully @egc can help you resolve that issue.

3 Likes

Ah, one more question, just for my understanding. Firewall looks like this atm:

In my mind it would have made sense for the vpn zone to forward to wan. So traffic comes from lan through vpn to wan. Why does it work anyway?

The traffic necessary to form and maintain the tunnel comes from the device itself. It always has the ability to route to the wan (unless explicitly blocked)

That DNS is not publicly available probably only after the tunnel is up ( no need to hide private addresses e.g. of wg that makes trouble shootung harder)
But for the tunnel to become up you need DNS resolving.

You only need to activate masq6 on the wg interface not on the wan.

Reboot afterwards and check again.

Do you have proper ipv6 if the vpn is disabled?

If it does not work please show settings again and wg show and ip -6 route show

I am traveling so will not be online whole day

1 Like

@egc

Yeah, that makes sense. So setting the DNS Forward is the way to go, right?

Interesting! DNS now shows up as both IPv4 and IPv6. But my IP address is still only IPv4.

No. Only IPv4. But I get IPv6 when connecting directly to the Fritzbox router:

there you go:

root@OpenWrt:~# wg show
interface: AirVpn
  public key: xxxxx=
  private key: (hidden)
  listening port: 33366

peer: xxxxxxx=
  preshared key: (hidden)
  endpoint: xxx:1637
  allowed ips: 0.0.0.0/0, 8000::/1, ::/1
  latest handshake: 1 minute, 43 seconds ago
  transfer: 1.45 MiB received, 921.36 KiB sent
  persistent keepalive: every 25 seconds
root@OpenWrt:~# ip -6 route show
::/1 dev AirVpn  metric 1024
xxxx:xxxx:xxxx::/64 dev br-lan  metric 1024
unreachable xxxx:xxxx:xxxx::/48 dev lo  metric 2147483647
xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx dev AirVpn  metric 256
fe80::/64 dev eth0  metric 256
fe80::/64 dev br-lan  metric 256
fe80::/64 dev phy1-sta0  metric 256
fe80::/64 dev phy1-ap0  metric 256
8000::/1 dev AirVpn  metric 1024
anycast fd22:cf41:ae7a:: dev br-lan  metric 0
anycast fe80:: dev eth0  metric 0
anycast fe80:: dev br-lan  metric 0
anycast fe80:: dev phy1-sta0  metric 0
anycast fe80:: dev phy1-ap0  metric 0
multicast ff00::/8 dev eth0  metric 256
multicast ff00::/8 dev br-lan  metric 256
multicast ff00::/8 dev phy1-sta0  metric 256
multicast ff00::/8 dev phy1-ap0  metric 256
multicast ff00::/8 dev AirVpn  metric 256

Thank you!

Is my setup effectively a kill-switch now? Because when the VPN doesn't work, I would like for no data to be sent whatsoever.

The problem.

You first have to setup a proper IPv6 for the router, make sure the primary router hands out a Prefix or if not use IPv6 relay

About the killswitch, as far a I see you only have forwarding form lan to vpn zone and NOT from lan to wan zone which effectively is a killswitch