1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tomato, OpenVPN and Policy Based Routing

Discussion in 'Tomato Firmware' started by jokerjoe, Jul 12, 2012.

  1. jokerjoe

    jokerjoe Serious Server Member

    Hi, I've got my router running TomatoUSB VPN, set up as an OpenVPN client. I can get it to route all traffic down the tunnel, but I'd like to route only traffic with certain destination IPs. I understand this is called policy-based routing.

    From what I've managed to find, I need something along the lines of

    Code:
    #!/bin/sh
    ip route add default dev ppp0 table 100
    ip rule add to 100.200.0.0/16 table 100
     
    iptables -t nat -I POSTROUTING -o ppp0 -j MASQUERADE
    Where do I put the script? Is that the right interface?

    Thanks for your help.
     

Share This Page