[Solved] How to create special route (IPv4 and IPv6)

Hi
I have a bit special setup where I route all my traffic from one network card of a device via a vpn tunnel ...

I have added route 210 to the config and then use these commands on the cli after each reboot of the router:

ip route add default via 192.168.34.71 dev wg1 table 210
ip rule add from 192.168.47.31 lookup 210 prio 210

Goal is, to have the OpenWrt routing all pakets from 192.168.47.31 via wg1 to 192.168.34.71 without changing source or destination address of the packets.

It works fine so far but I wonder:

Is there a way to do this with luci?
And how is the similar setup for IPv6 (assuming fd47::31 as device address and fd34::71 as target)?

Any help appreciated.

Ok

root@OpenWrt:~# ip -6 route add default via fd34::71 dev wg1 table 210
root@OpenWrt:~# ip -6 rule add from fd47::31 lookup 210 prio 210

is accepted but it's not working for now. I may need to check the firewall on fd34::71

These won't survive a reboot. Better add them in network config.
https://openwrt.org/docs/guide-user/network/routes_configuration
https://openwrt.org/docs/guide-user/network/ip_rules

Thanks for the reply

Sadly, I didn't manage to get this configured in uci network config.
Those routes described in the links require a target I don't have ...

The default target is 0.0.0.0/0 on ipv4 and ::/0 on ipv6.

1 Like

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