From: bkhl@elektrubadur.se (Björn Lindström)
To: lartc@vger.kernel.org
Subject: [LARTC] Trouble selecting network interface by port
Date: Fri, 29 Dec 2006 23:40:48 +0000 [thread overview]
Message-ID: <871wmixocf.fsf@killalla.dreaming> (raw)
I have a connection to the Internet (on eth1), and over this I also
have a PPTP tunnel set up (on ppp0). Temporarily I use the (slower)
PPTP tunnel for everything, but I really just have to use it for some
specific purposes, which are distinguishable by port.
So, I want to direct only some specific ports to ppp0, using eth1 for
the rest.
I have tried following the instructions on
http://lartc.org/howto/lartc.netfilter.html
CONFIG_IP_ADVANCED_ROUTER, CONFIG_IP_MULTIPLE_TABLES and
CONFIG_IP_ROUTE_FWMARK is enabled in the kernel.
I have added the line "201 tunnel.out" to /etc/iproute2/rt_tables .
After the PPTP tunnel comes up, the following is run.
$TUNNEL is the PPTP tunnel (ppp0), and $EXTIF my regular WAN interface (eth1).
# Open firewall for the tunnel.
iptables -A FORWARD -i ${TUNNEL} -o eth0 -m state --state \
ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth0 -o ${TUNNEL} -j ACCEPT
iptables -t nat -A POSTROUTING -o ${TUNNEL} -j MASQUERADE
# Mark packets that should be routed through the tunnel
iptables -A PREROUTING -i ${EXTIF} -t mangle -p tcp --dport 80 \
-j MARK --set-mark 1
# Generate route for the tunnel
ip rule add fwmark 1 table tunnel.out
ip route add default dev ${TUNNEL} table tunnel.out
I'm testing this with port 80 so that I can check the result by
running a script that returns my IP on a remote server.
After doing all this, the remote server still sees my as the IP for
eth1. Can anyone see what I have overlooked here?
Thank you,
Björn Lindström
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
next reply other threads:[~2006-12-29 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-29 23:40 Björn Lindström [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-01-09 2:41 [LARTC] Trouble selecting network interface by port Grant Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871wmixocf.fsf@killalla.dreaming \
--to=bkhl@elektrubadur.se \
--cc=lartc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox