0

Possible Duplicate:
iptables - Target to route packet to specific interface?

Ubuntu 12.04. So on the client's machines I've got two NICs eth1 and wlan0. I'd like all the web browsing traffic to go through wlan0 and the rest via eth1. What is the simplest way to achieve that? Thanks

tkane
  • 141
  • 3

1 Answers1

2

you'll have to use a policy based routing - mark outgoing packets to the port 80, then use separate routing table for them. take a look here and just google for linux policy routing.

pQd
  • 29,981
  • 6
  • 66
  • 109
  • I was actually hoping for `iptables` guru to give me the exact commands rather than abstract. But thanks anyway. – tkane May 08 '12 at 10:13
  • Then maybe your question should reflect what answer you are hoping for? i.e. maybe you should include "Could someone provide the exact iptables commands to achieve this?" – EightBitTony May 08 '12 at 10:50
  • @tkane - i've done it few times but do not have example at hand. you'll -j MARK packets on prerouting [eg just for outgoing traffic on port 80], then you'll use "ip rule add fwmark markNumber table someRoutingTableNumber" to direct traffic to separate routing table. you'll need to create that table and add default route to it. – pQd May 08 '12 at 10:52