0

I have two network interfaces.

One wired (eth0) which is filtered by proxy.
One is wireless (wlan0) which is free.

I need to route specific URLs via the wireless interface to avoid the proxy.

2

Add a route with a lower cost (e.g. lower hop-count or other appropriate metric)

E.g. route add -host 1.2.3.4 dev wlan0 metric 1 (untested)

  • s/eth1/wlan0? – Hennes Oct 4 '13 at 15:12
  • @Hennes: Thanks for the correction. Answer updated. – RedGrittyBrick Oct 4 '13 at 15:19
0

I suppose that you want that all your request to lan goes to eth0, and all other requests (internet addresses) are for wlan0.

Everything depend on the configuration of your network. You need to know the ip of your lan gateway. You can obtain it with the following command:

route

You must play with your route table. My solution for the same problem (eth0/ppp0) is: 1. Delete default gateway:

route del default gw

2. Add a default gw that point to wlan0:

route add default gw youripwlan0

3. Add a route rule that send all lan requests to eth0:

route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0

Where you must replace -net and netmask with values that fit your lan configuration. 4. Then add another gateway that is used for the requests done inside the lan:

route add -net 192.168.1.0 netmask 255.255.255.0  gw 192.168.1.1

Again -net netmask and gw must be changed according to your configuration. And maybe you want to edit the /etc/resolv.conf file to add a DNS server reachable from the wlan network.

  • A small hint: not my all lan . I need eth0 still the default but with some exceptions. – Ahmed Aswani Jan 10 '12 at 12:34
  • what kind of exceptions? – Ivan Jan 10 '12 at 12:43
  • some addresses are blocked I want to route them to the wlan – Ahmed Aswani Jan 10 '12 at 12:45
  • You can do something similar, for example you can add ip based routes. My solution try to separate the internet addresses to the lan addressess. But if you want that only 2 or 3 sites be redirected to wlan, then get the ip of these sites, and simply modify my routes, probably you don't need the step 1 and 2 but you need step 3 and 4, replacing -net with -host – Ivan Jan 10 '12 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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