Ipv6 dns not disabled even uncheck "Use DNS servers advertised by peer"

Hello every one, I have two wan interface, both have ipv4/ipv6,
I use wan1 as my default route , and use wan2 for some other customized route.
but I've found that openwrt write both interface dns settings into same dnsmasq file, that leads some dns query answered by wan2 dns ,which is not suitable for my default route (wan1). I've already uncheck "Use DNS servers advertised by peer" option, but that only disable wan2 ipv4 dns server, wan2 ipv6 dns server still in dnsmasq file, is this expected behavior or a bug ?How can I disable wan2 ipv6 dns server(but still enable wan2 ipv6) ?

here is my /tmp/resolv.conf.auto file

# Interface wan2   ==>   after uncheck Use DNS servers advertised by peer, only wan2 ipv4 server disabled 
# Interface wan2_6  ==> but wan2 ipv6 dns server still preserved 
nameserver 2409:8020:2000::88
nameserver 2409:8020:2000::8

# Interface wan1
nameserver 221.228.255.1
nameserver 218.2.135.1
# Interface wan1_6
nameserver 240e:5a::6666
nameserver 240e:5b::6666

I can write a script to strip these lines and restart dnsmasq each time wan2 connected, is there better solution ?

1 Like

What is the output of uci export network ?

1 Like
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 'fd3c:d363:c897::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth1.1'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'           ==========>  this is my default route
        option ifname 'eth0.2'
        option proto 'pppoe'
        option ipv6 'auto'
        option username 'xxxxx'
        option password 'xxxxx'

config interface 'wan6'
        option ifname 'eth0.2'
        option proto 'dhcpv6'

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

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option vid '1'
        option ports '6t 1 2 3t 4 5t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option vid '2'
        option ports '0t 3t 5t'


config switch_vlan
        option device 'switch0'
        option vlan '3'
        option vid '3'
        option ports '0t 5t'

config interface 'wan2'          =================> this is my second wan
        option ifname 'eth0.3'
        option proto 'pppoe'
        option password 'xxxxxx'
        option ipv6 'auto'
        option username 'xxxxxx'
        option defaultroute '0'
        option peerdns '0'


I've stripped some useless config from output

With this option, OpenWrt spawns a wan_6 and wan2_6 interface automatically with some failsafe settings, but non-configurable.
Change that to '1' or manual in Luci. Then you can configure the IPv6 interface of the wan and wan2 to your liking.

Thanks for the information. set wan2 ipv6 option to 1 just lose wan2 ipv6 address, do you mean I need to run dhcpv6 manually on wan2 (everytime PPPoE up)? if so , I think it makes no big differences to 'strip unwanted lines'

Try this way first:

uci set network.wan.ipv6="auto"
uci set network.wan2.ipv6="auto"
uci set network.wan.peerdns="0"
uci set network.wan6.peerdns="0"
uci set network.wan2.peerdns="0"
uci commit network
/etc/init.d/network restart

If that doesn't help, then use ipv6=1 together with IPv6 aliases for each upstream interface and configure peerdns=0 for each alias.

I didn't use uci command, I just add ipv6 aliases in config based on your advise:


config interface 'wan26'
        option ifname 'eth0.3'
        option proto 'dhcpv6'

and openwrt web page shows it as 'DHCPv6 client' interface, and I set peerdns = 0 on this interface, finally ipv6 dns server didn't appear in resolve.conf.auto

by the way, my wan2 pppoe config still keeps ipv6 = auto. I found if set it to manual, wan2 can not got ipv6 address automatically

1 Like

No you need to create manually the ipv6 wan interfaces once.
In a nutshell:

config interface 'wan'
        option proto 'pppoe'
       option ipv6 '1'
....

config interface 'wan6'
        option proto 'dhcpv6'
        option peerdns '0'
        option ifname '@wan'
...

but if you don't feel comfortable with uci or vi, you can do all these things from Luci.

2 Likes

Thank you for this , I've made it work

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.