IPv6 only works after pinging the router

Router have no route rules until my client ping the router's ipv6 address.
Here is my network setting
/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 globals 'globals'                                                                                      
                                                                                                              
config interface 'lan'                                                                                        
        option type 'bridge'                                                                                  
        option ifname 'eth0.1'                                                                                
        option proto 'static'                                                                                 
        option ipaddr '192.168.1.1'                                                                           
        option netmask '255.255.255.0'                                                                        
        option ip6assign '60'                                                                                 
                                                                                                              
config interface 'wan'                                                                                        
        option ifname 'eth0.2'                                                                                
        option proto 'dhcp'                                                                                   
        list dns '8.8.8.8'                                                                                    
        list dns '8.8.4.4'                                                                                    
        option peerdns '0'                                                                                    
                                                                                                              
config device 'wan_dev'                                                                                       
        option name 'eth0.2'                                                                                  
        option macaddr 'ca:79:f8:01:00:be'                                                                    
                                                                                                              
config interface 'wan6'                                                                                       
        option ifname 'eth0.2'                                                                                
        option proto 'dhcpv6'                                                                                 
        list dns '2001:4860:4860::8888'                                                                       
        list dns '2001:4860:4860::8844'                                                                       
        option peerdns '0'                                                                                    
                                                                                                              
config switch                                                                                                 
        option name 'switch0'                                                                                 
        option reset '1'                                                                                      
        option enable_vlan '1'                                                                                
                                                                                                              
config switch_vlan                                                                                            
        option device 'switch0'                                                                               
        option vlan '1'                                                                                       
        option ports '3 4 0t'                                                                                 
                                                                                                              
config switch_vlan                                                                                            
        option device 'switch0'                                                                               
        option vlan '2'                                                                                       
        option ports '5 0t'                                                                                   
                                                                                                              
config interface 'ipt'                                                                                        
        option ifname 'ipt'                                                                                   
        option proto 'none'

/etc/config/dhcp


config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '0'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option nonwildcard '1'
        option localservice '1'
        list server '127.0.0.1#5353'
        option noresolv '1'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'relay'
        option ra 'relay'
        option ndp 'relay'
        option ra_slaac '1'

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

config dhcp 'wan6'
        option dhcpv6 'relay'
        option ra 'relay'
        option ndp 'relay'
        option master '1'
        option interface 'wan'

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

ip -6 -r

2001:250:3002:4650:5406::14a8 dev br-lan proto static metric 1024 pref medium
2001:250:3002:4650::/64 dev eth0.2 proto static metric 256 pref medium
fe80::/64 dev eth0.2 proto kernel metric 256 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
fe80::/64 dev br-lan proto kernel metric 256 pref medium
fe80::/64 dev wlan1 proto kernel metric 256 pref medium
fe80::/64 dev wlan0 proto kernel metric 256 pref medium
fe80::/64 dev ipt proto kernel metric 256 pref medium

It seems to me as a side-effect of the relay option.
Do you experience any issues other than the appearance of the routing table?

No other issues. Until I ping the router,
below line apear in route table.

2001:250:3002:4650:5406::14a8 dev br-lan proto static metric 1024 pref medium

Can I let it auto config when I connect to the lan?

I am not sure I understand your question. Doesn't the host configure itself automatically when you connect it on the LAN? Other than the entry in the routing table that appears after you ping something, is something not working?

I can't reach ipv6-only website before I ping the router.

Adjust your configuration as per documentation first. You could leave it at default, since the hybrid option is able to detect if there is prefix delegated or relaying.
https://openwrt.org/docs/guide-user/network/ipv6/start#router_advertisement_dhcpv6

# cat /etc/config/dhcp
config dhcp wan
    option dhcpv6 relay
    option ra relay
    option ndp relay
    option master 1
 
config dhcp lan
    option dhcpv6 relay
    option ra relay
    option ndp relay

Still not working.

I would also try to disable source routing by the option sourcerouting mentioned here.
Post also the following:
ifstatus wan; ifstatus wan6; ifstatus lan; ip -6 addr; ip -6 ro; ip -6 ru; ip6tables-save

I solve it by close the ss-redir with ipv6 in the router.

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