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

marked as duplicate by voretaq7 May 14 '12 at 19:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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.

  • I was actually hoping for iptables guru to give me the exact commands rather than abstract. But thanks anyway. – tkane May 8 '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 8 '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 8 '12 at 10:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.