Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

Current settings:

# ip rule
0:      from all lookup local
1000:   from 84.231.196.14 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 84.231.196.16 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
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I see your default route is pointing to eth0, you will need to point your default route to ppp0 instead. Remove the default route and try "ip route add default dev ppp0".

share|improve this answer
    
Yep, I realized this just when you posted this. Deleted the default route pointing to eth0 and added new default route 'default gw 192.168.254.254 dev ppp0'. Everything seems to work now. –  Spitz Jan 9 '14 at 12:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.