Hi, I'm having trouble getting OpenWrt to assign a IPv6 address to the wireguard interface.
When configuring an IPv6 address for a wireguard interface in UCI no IPv6 address actually shows up on the interface and net.ipv6.conf.wg0.disable_ipv6 = 1
is set.
ip addr show dev wg0
gives
35: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN qlen 1000
link/[65534]
inet 10.122.122.1/24 brd 10.122.122.255 scope global wg0
valid_lft forever preferred_lft forever
even though the wiregard config in /etc/config/network
includes IPv6 addresses:
config interface 'wg0'
option proto 'wireguard'
option listen_port '51820'
option private_key 'redacted'
list addresses 'fd3a:bb4f:add2:43c2::1/64'
list addresses '10.122.122.1/24'
config wireguard_wg0
option public_key 'redacted'
option route_allowed_ips '1'
option persistent_keepalive '25'
option description 'phone'
list allowed_ips '10.122.122.2/32'
list allowed_ips 'fd3a:bb4f:add2:43c2::2/128'
config wireguard_wg0
option public_key 'redacted'
option route_allowed_ips '1'
option persistent_keepalive '25'
option description 'work'
list allowed_ips '10.122.122.3/32'
list allowed_ips 'fd3a:bb4f:add2:43c2::3/128'
And this is the wg0.conf that's automatically generated by OpenWrt when starting the wg0 interface:
[Interface]
PrivateKey=redacted
ListenPort=51820
[Peer]
PublicKey=redacted
AllowedIPs=10.122.122.2/32
AllowedIPs=fd3a:bb4f:add2:43c2::2/128
PersistentKeepalive=25
[Peer]
PublicKey=redacted
AllowedIPs=10.122.122.3/32
AllowedIPs=fd3a:bb4f:add2:43c2::3/128
PersistentKeepalive=25
Manually adding the IPv6 to the interface also does not work and gives the following error:
root@router:~# ip addr add fd3a:bb4f:add2:43c2::1/64 dev wg0
ip: RTNETLINK answers: Permission denied
This error occurs because the sysctl net.ipv6.conf.wg0.disable_ipv6 = 1
is set by OpenWrt. After manually setting net.ipv6.conf.wg0.disable_ipv6
to zero adding the IPv6 works, but by then the automatic setup of the IPv6 routes has already failed.
My question is why OpenWrt / uci / netifd would set this sysctl.
IPv6 connectivity in general works fine, the other interfaces don't have this sysctl set to 1, have IPv6 addresses assigned to them and can reach the IPv6 internet without problems. My question is not about IPv6 routing for wireguard though, I will figure that out afterwards.
Some info about my setup:
- OpenWrt 22.03.5, r20134-5f15225c1e
- MikroTik RouterBOARD 962UiGS-5HacT2HnT (hAP ac)
- All packages up-to-date
- kernel - 5.10.176-1-9c18dec290150de51248d40d851655cf
- kmod-wireguard - 5.10.176-1
- luci-app-wireguard - git-23.018.72712-6d712c3
- luci-proto-wireguard - git-23.093.40597-18a1842
- wireguard-tools - 1.0.20210424-3