route based on incoming eth out ppp - two eth / two ppp

Discussion in 'Linux Networking' started by Chris329, Aug 27, 2004.

  1. Chris329

    Chris329 Guest

    I have two ethernet connections to an internal lan and two
    outbound connections via ppp - two seperate isp's

    I need to be able to route traffic based on incoming source.

    ------->| eth0 | --------->ppp0 ---------> Internet
    | 80 |
    | |
    | 26 |
    ------->| eth0:1 | --------->ppp1 ---------> Internet

    I have two squid and two sendmail daemons running each
    bound to it's interface.
    Outbound mail needs to be able to go through it's
    respective isp's smtp server as a smart host - hence
    the traffic shaping.

    I have scripted the connection and then added the following
    iptables setup. Unfortunately it is not working.

    p0=`/sbin/ifconfig |grep P-t-P | awk '{print $2}' \
    |sed -e 's/addr\://g;' |grep 209`
    p1=`/sbin/ifconfig |grep P-t-P | awk '{print $2}' \
    |sed -e 's/addr\://g;' |grep 129`
    echo $p0
    echo $p1
    # Setup IPTABLES
    iptables -t mangle -A PREROUTING -i eth0 -j MARK --set-mark 20
    iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 21
    ip route add default via $p0 dev ppp0 table 22
    ip route add default via $p1 dev ppp1 table 23
    ip rule add fwmark 20 table 22
    ip rule add fwmark 21 table 23

    Can anyone see where i have made a mistake in this?

    Thanks for any and all help,


    Chris329, Aug 27, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.