Skip to contentSkip to conversation

DNAT to a specific interface?

DISCUSSION news.gmane.org 2 participants 2 messages Nov 10, 2008

lore
Share & tools
lore
#0 lore raw

I have a multihomed server. eth0 for internal NAT, eth1 for default internet, and eth3 for VOIP.

VOIP comes into the server with dport set to 19999. What I'd like to do is have all those VOIP packets set to a real VOIP port ( which I think I can figure out ) and go out eth3. I can't set up a static route going out eth3 since the SIP proxies are dynamic, so they don't have a fixed ip address.

So:

iptables -t nat -A POSTROUTING -i eth0 -p udp --dport 19999 -j DNAT --to :5469 iptables -t nat -A PREROUTING -i eth3 -p udp --dport 5469 -j DNAT --to :19999

would change the port, but how can I tell it to use interface eth3?

sean

#1 lore raw
Quoted 1 line · news.gmane.org

how can I tell it to use interface eth3?

Set up an IP rule to match either the source port or a mark set by IPTables watching for the source port.

With the IP rule in place you can use a different routing table that uses a different interface as the source for any traffic using that routing table.

Grant. . . .