IPv6 routes are not created

Having fixed a problem that prevented creation of IPv4 routes (interface was not configured by UCI), I had hoped that IPv6 routes would be working as well. However, they are not:

config interface 'rath'
	option device 'rath'
	option proto 'static'
	list ipaddr '192.168.12.10/24'
	list ip6addr '2a01:7e01:e002:7212::10/64'
	option ip6gw '2a01:7e01:e002:7212::1'
	option ip6prefix '2a01:7e01:e002:7201::0/64'
[...]

config rule
	option src '192.168.1.243/32'
	option lookup 'custom1'

config rule6
	option src '2a01:7e01:e002:7201::d36/128'
	option lookup 'custom1'

config route
	option table 'custom1'
	option interface 'rath'
	option gateway '192.168.12.1'
	option target '0.0.0.0/0'

config route6
	option table 'custom1'
	option interface 'rath'
	option gateway '2a01:7e01:e002:7212::1'
	option target '0::/0'

This gives me the following IPv4 setup:

root@awr ~# ip -4 rule
0:	from all lookup local 
1:	from 192.168.1.193 lookup custom1 
32766:	from all lookup main 
32767:	from all lookup default 

root@awr ~# ip -4 route show table custom1
default via 192.168.12.1 dev rat

All good! But for IPv6, the routing table is empty:

root@awr ~# ip -6 rule
0:	from all lookup local 
1:	from 2a01:7e01:e002:7201::d36 lookup custom1 
32766:	from all lookup main 
4200000000:	from 2a01:7e01:e002:7201::1/64 iif br-lan lookup unspec unreachable
4200000001:	from all iif lo lookup unspec 12
4200000066:	from all iif rath lookup unspec 12
4200000072:	from all iif br-lan lookup unspec 12
4200000074:	from all iif eth0.2 lookup unspec 12
root@awr ~# ip -6 route show table custom1
root@awr ~# 

What am I missing this time?

Config looks correct to me, try to restart network/reboot.

Tried both, but it did not help :-(.

Are you trying to configure from Luci, uci commands, or direct edit of the configuration files?

I directly edited the network file and then ran /etc/init.d/network restart

Try to do it from Luci. There might be some special character or keyboard layout issue. The default route in ipv6 is ::/0 although 0::/0 can work too.

Tried recreating it from Luci - but still no effect at all.

What is the output of ip -6 ro list table all ?

root@awr ~# ip -6 ro list table all
2a01:7e01:e002:7201::/64 dev br-lan  metric 1024 
unreachable 2a01:7e01:e002:7201::/64 dev lo  metric 2147483647 
2a01:7e01:e002:7212::/64 dev rath  metric 256 
fe80::/64 dev rath  metric 256 
fe80::/64 dev eth0  metric 256 
fe80::/64 dev eth0.2  metric 256 
fe80::/64 dev br-lan  metric 256 
fe80::/64 dev wlan1  metric 256 
fe80::/64 dev wlan0  metric 256 
default via 2a01:7e01:e002:7212::1 dev rath  metric 1024 
local ::1 dev lo table local  metric 0 
anycast 2a01:7e01:e002:7201:: dev br-lan table local  metric 0 
local 2a01:7e01:e002:7201::1 dev br-lan table local  metric 0 
anycast 2a01:7e01:e002:7212:: dev rath table local  metric 0 
local 2a01:7e01:e002:7212::10 dev rath table local  metric 0 
anycast fe80:: dev rath table local  metric 0 
anycast fe80:: dev eth0 table local  metric 0 
anycast fe80:: dev eth0.2 table local  metric 0 
anycast fe80:: dev br-lan table local  metric 0 
anycast fe80:: dev wlan1 table local  metric 0 
anycast fe80:: dev wlan0 table local  metric 0 
local fe80::7521:7515:7418:90c4 dev rath table local  metric 0 
local fe80::86a4:23ff:fe04:4e dev wlan1 table local  metric 0 
local fe80::86a4:23ff:fe04:4f dev wlan0 table local  metric 0 
local fe80::e4fb:75ff:fefb:cd95 dev eth0 table local  metric 0 
local fe80::e4fb:75ff:fefb:cd95 dev eth0.2 table local  metric 0 
local fe80::e4fb:75ff:fefb:cd95 dev br-lan table local  metric 0 
multicast ff00::/8 dev rath table local  metric 256 
multicast ff00::/8 dev br-lan table local  metric 256 
multicast ff00::/8 dev eth0 table local  metric 256 
multicast ff00::/8 dev eth0.2 table local  metric 256 
multicast ff00::/8 dev wlan1 table local  metric 256 
multicast ff00::/8 dev wlan0 table local  metric 256 

Try to use the numeric value of the table in uci commands rather than the name. Just wondering if that would work.

That did it!

root@awr ~# tail -6 /etc/config/network
config route6
	option table '8'
	option interface 'rath'
	option target '0::/0'
	option gateway '2a01:7e01:e002:7212::2'

root@awr ~# /etc/init.d/network restart
root@awr ~# ip -6 ro list table all
default via 2a01:7e01:e002:7212::2 dev rath table 8  metric 1024 
2a01:7e01:e002:7201::/64 dev br-lan  metric 1024 
unreachable 2a01:7e01:e002:7201::/64 dev lo  metric 2147483647 
[....]

Should I file a bug?

I am not able to reproduce that:

root@magiatiko:[~]#ip -6 ro list table all | grep test
default via fd00:bbbb:0:30::100 dev eth0.3 table test proto static metric 1024 pref medium

root@magiatiko:[~]#ip -6 ro list table test
default via fd00:bbbb:0:30::100 dev eth0.3 proto static metric 1024 pref medium

root@magiatiko:[~]#uci show network.@route6[2]
network.cfg1ddf6a=route6
network.cfg1ddf6a.target='::/0'
network.cfg1ddf6a.gateway='fd00:bbbb:0:30::100'
network.cfg1ddf6a.interface='iot'
network.cfg1ddf6a.table='test'

However in first case you have ::1 address and in the second ::2
Was there anything on ::1 in the first place?

1 Like

I changed this at some point just to make sure that there wasn't anything special about the gateway IP address.

I tried it again now, and it it's getting more confusing:

root@awr /e/config# grep custom1 /etc/iproute2/rt_tables 
5       custom1

root@awr /e/config [1]# uci show network.@route6[0]
network.cfg13df6a=route6
network.cfg13df6a.table='custom1'
network.cfg13df6a.interface='rath'
network.cfg13df6a.gateway='2a01:7e01:e002:7212::2'
network.cfg13df6a.target='::/0'

root@awr /e/config# /etc/init.d/network restart
root@awr /e/config# ip -6 ro list table custom1
root@awr /e/config# ip -6 ro list table 5
root@awr /e/config# ip -6 ro list table all | grep 2a01:7e01:e002:7212::2
default via 2a01:7e01:e002:7212::2 dev rath table custom1  metric 1024 

root@awr /e/config# uci set network.@route6[0].table='5'
root@awr /e/config# uci commit network
root@awr /e/config# uci show network.@route6[0]
network.cfg13df6a=route6
network.cfg13df6a.interface='rath'
network.cfg13df6a.gateway='2a01:7e01:e002:7212::2'
network.cfg13df6a.target='::/0'
network.cfg13df6a.table='5'

root@awr /e/config# /etc/init.d/network restart
root@awr /e/config# ip -6 ro list table custom1
root@awr /e/config# ip -6 ro list table 5
root@awr /e/config# ip -6 ro list table all | grep 2a01:7e01:e002:7212::2
default via 2a01:7e01:e002:7212::2 dev rath table custom1  metric 1024 
root@awr /e/config# 

One last thing, try not to use numbers in the table name. custom not custom1

1 Like