I have a small embedded computer running busybox. It has a wired eth0 interface, which is connected to an on-board wlan-module's wired interface by a cable. Also there's an 3G module on ppp0.
I need to route traffic from 192.168.2.1 (localhost) to 192.168.2.10 (wlan-module) through eth0 and everything else should go through ppp0.
# ip rule 0: from all lookup local 1000: from 22.214.171.124 lookup mobile 32766: from all lookup main 32767: from all lookup default # ip route show table mobile default via 192.168.254.254 dev ppp0 # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.2.10 0.0.0.0 UG 0 0 0 eth0 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.254.254 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
This works partly. I can connect to 192.168.2.10 from 192.168.2.1 and I can connect to this computer from outside over ppp0 but I can't make any connections from this computer to outside using ppp0.
I tried adding
# ip rule add from all lookup mobile # ip route flush table cache # ip rule 0: from all lookup local 999: from all lookup mobile 1000: from 126.96.36.199 lookup mobile 32766: from all lookup main 32767: from all lookup default
This will of course route all traffic through ppp0 but I lose my connection to 192.168.2.10
I have tried several different rules and routes to make this work but I'm not having any luck with it. What kind of rule/route should I make?
- ip rule, ip route and route are available