routing specific IP to ppp0 tunnel

Posted by gompertz on Server Fault See other posts from Server Fault or by gompertz
Published on 2010-04-01T20:53:49Z Indexed on 2010/04/01 21:03 UTC
Read the original article Hit count: 528

Filed under:
|
|

Hi All,

I feel I've struggled with this long enough and need some help.

I have a pptp tunnel and am trying to route destination traffic from 208.85.40.20 to the pptp tunnel (ppp0). (Keen observers may recognize the ip as being that of pandora.com). I am doing all this configuration on a router... and I know it's not working successfully as traceroute yields nothing but astericks.

I've pasted relevant outputs below: (with some "security" editing to the addresses)

root@OpenWrt:~# ifconfig

br0       Link encap:Ethernet  HWaddr 00:1A:92:BC:XX:XX
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28185 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24936 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4894242 (4.6 MiB)  TX bytes:5941902 (5.6 MiB)

eth0      Link encap:Ethernet  HWaddr 00:1A:92:BC:XX:XX
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:51829 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56824 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:11490288 (10.9 MiB)  TX bytes:11857913 (11.3 MiB)
          Interrupt:4

eth2      Link encap:Ethernet  HWaddr 00:1A:92:BC:XX:XX
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:15426
          TX packets:9529 errors:21 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:423 (423.0 B)  TX bytes:596036 (582.0 KiB)
          Interrupt:2 Base address:0x2000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:30 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2300 (2.2 KiB)  TX bytes:2300 (2.2 KiB)

ppp0      Link encap:Point-Point Protocol
          inet addr:68.68.39.250  P-t-P:172.16.20.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1400  Metric:1
          RX packets:165 errors:2 dropped:0 overruns:0 frame:0
          TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:7006 (6.8 KiB)  TX bytes:3462 (3.3 KiB)

vlan0     Link encap:Ethernet  HWaddr 00:1A:92:BC:XX:XX
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:28182 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33813 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5006544 (4.7 MiB)  TX bytes:6609774 (6.3 MiB)

vlan1     Link encap:Ethernet  HWaddr 00:1A:92:BC:XX:XX
          inet addr:173.183.111.3  Bcast:173.183.111.255  Mask:255.255.224.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23653 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23012 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5522012 (5.2 MiB)  TX bytes:4982944 (4.7 MiB)

wds0.4915 Link encap:Ethernet  HWaddr 00:1A:92:BC:XX:XX
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wds0.4915 Link encap:Ethernet  HWaddr 00:1A:92:BC:XX:XX
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@OpenWrt:~# cat /etc/ppp/ip-up

iptables -A FORWARD -t filter -i br0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -t filter -i ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.1.1/24 -d 0/0 -j MASQUERADE

iptables -A forwarding_rule -o ppp0 -j ACCEPT
iptables -A forwarding_rule -i ppp0 -j ACCEPT
iptables -t nat -A postrouting_rule -o ppp0 -j MASQUERADE

root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.20.1     *               255.255.255.255 UH    0      0        0 ppp0
208.85.40.20    *               255.255.255.255 UH    0      0        0 ppp0
192.168.1.0     *               255.255.255.0   U     0      0        0 br0
173.183.192.0   *               255.255.224.0   U     0      0        0 vlan1
default         d173-183-192-1. 0.0.0.0         UG    0      0        0 vlan1
default         192.168.1.1     0.0.0.0         UG    0      0        0 br0

Any advice is greatly appreciated, I'm not too great with network but am pretty astute at learning ;-)

© Server Fault or respective owner

Related posts about iptables

Related posts about routing