Route web traffic through a separate iterface

Posted by tkane on Server Fault See other posts from Server Fault or by tkane
Published on 2012-06-07T08:54:27Z Indexed on 2012/06/07 10:42 UTC
Read the original article Hit count: 212

I'd like to route web traffic through the wlan0 interface and the rest through eth1. Can you please help me with the iptables commands to achieve this. Below is my configuration. Thank you :)

Edit: This is about desktop configuration not a web server set up. Basically I want to use one of my connections to browse the web and the other one for everything else.

ifconfig:

eth1      Link encap:Ethernet  HWaddr 00:1d:09:59:80:70  
          inet addr:192.168.2.164  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::21d:9ff:fe59:8070/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:33 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4771 (4.7 KB)  TX bytes:7081 (7.0 KB)
          Interrupt:17



wlan0     Link encap:Ethernet  HWaddr 00:1c:bf:90:8a:6d  
          inet addr:192.168.1.70  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:bfff:fe90:8a6d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:77 errors:0 dropped:0 overruns:0 frame:0
          TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14256 (14.2 KB)  TX bytes:14764 (14.7 KB)

route:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     1      0        0 eth1
192.168.1.0     *               255.255.255.0   U     2      0        0 wlan0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
default         adsl            0.0.0.0         UG    0      0        0 eth1

© Server Fault or respective owner

Related posts about linux

Related posts about iptables