I have OpenWrt router (gw: 192.168.4.1, dev: wlan1), connected to another wifi network (gw: 192.168.0.1, dev: wlan0). I setup openVpn on that router (gw: 172.26.254.1, dev: tun0).
When I connect to wlan1 via laptop everything works as expected and routes looks like this:
192.168.0.123 dev wlan1 table 16800 scope link
192.168.4.106 dev wlan1 table 16800 scope link
192.168.0.1 dev wlan0 table 16801 scope link
192.168.0.120 dev wlan0 table 16801 scope link
0.0.0.0/1 via 172.26.254.1 dev tun0
**default via 192.168.0.1 dev wlan0 src 192.168.0.122**
10.0.0.0/8 via 172.26.254.1 dev tun0
11.0.0.0/8 via 172.26.254.1 dev tun0
12.0.0.0/8 via 172.26.254.1 dev tun0
31.13.134.24 via 172.26.254.1 dev tun0
91.142.82.138 via 172.26.254.1 dev tun0
91.142.82.139 via 172.26.254.1 dev tun0
91.142.82.142 via 192.168.0.1 dev wlan0
92.255.60.150 via 172.26.254.1 dev tun0
92.255.60.153 via 172.26.254.1 dev tun0
128.0.0.0/1 via 172.26.254.1 dev tun0
172.16.0.0/12 via 172.26.254.1 dev tun0
172.26.254.0/24 dev tun0 scope link src 172.26.254.145
176.118.20.60 via 172.26.254.1 dev tun0
192.53.244.0/24 via 172.26.254.1 dev tun0
192.168.0.0/24 dev wlan0 scope link src 192.168.0.122
192.168.0.0/16 via 172.26.254.1 dev tun0
192.168.4.0/24 dev wlan1 scope link src 192.168.4.1
But when I connect my android phone to wlan1 routes looks like this:
192.168.0.123 dev wlan1 table 16800 scope link
192.168.4.106 dev wlan1 table 16800 scope link
**default via 192.168.0.1 dev wlan0 table 16801**
192.168.0.1 dev wlan0 table 16801 scope link
192.168.0.102 dev wlan0 table 16801 scope link
192.168.0.104 dev wlan0 table 16801 scope link
192.168.0.120 dev wlan0 table 16801 scope link
0.0.0.0/1 via 172.26.254.1 dev tun0
**default via 192.168.0.1 dev wlan0 src 192.168.0.122**
10.0.0.0/8 via 172.26.254.1 dev tun0
11.0.0.0/8 via 172.26.254.1 dev tun0
12.0.0.0/8 via 172.26.254.1 dev tun0
31.13.134.24 via 172.26.254.1 dev tun0
91.142.82.138 via 172.26.254.1 dev tun0
91.142.82.139 via 172.26.254.1 dev tun0
91.142.82.142 via 192.168.0.1 dev wlan0
92.255.60.150 via 172.26.254.1 dev tun0
92.255.60.153 via 172.26.254.1 dev tun0
128.0.0.0/1 via 172.26.254.1 dev tun0
172.16.0.0/12 via 172.26.254.1 dev tun0
172.26.254.0/24 dev tun0 scope link src 172.26.254.145
176.118.20.60 via 172.26.254.1 dev tun0
192.53.244.0/24 via 172.26.254.1 dev tun0
192.168.0.0/24 dev wlan0 scope link src 192.168.0.122
192.168.0.0/16 via 172.26.254.1 dev tun0
192.168.4.0/24 dev wlan1 scope link src 192.168.4.1
Btw I want to route all traffic via 172.26.254.1 and my guess is that
default via 192.168.0.1 dev wlan0 table 16801
breaks route
0.0.0.0/1 via 172.26.254.1 dev tun0
So I have two questions:
Why second default route added?
How to remove/override/disable secondly added default route?