Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have wired connection to intranet / lan of my work (with proxy) and one wireless without proxy that doesn't have access to the office lan. (Like Guest Wifi)

My idea is to route all traffic to eth0 and ONLY some traffic (like ssh) to wlan0.

I have an idea on how to do this but not so sure.

Well, my problem now is that when both are connected, eth0 and wlan0, traffic seems to be intermitent between the 2, Firefox sometimes tries to go out through wlan0 and can not find the proxy server (because its on the ETH0 lan).

~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.254 0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.25.0    0.0.0.0         255.255.255.0   U     2      0        0 wlan0
192.168.100.0   0.0.0.0         255.255.255.0   U     1      0        0 eth0
192.168.200.0   192.168.100.253 255.255.255.0   UG    0      0        0 eth0

How can I fix it, so Firefox doesn't try to go through wlan0 unleast I specify it?

~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.100.254 0.0.0.0         UG    0      0        0 eth0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
192.168.25.0    *               255.255.255.0   U     2      0        0 wlan0
192.168.100.0   *               255.255.255.0   U     1      0        0 eth0
192.168.200.0   192.168.100.253 255.255.255.0   UG    0      0        0 eth0
share|improve this question
    
possible duplicate of Route SSH to host through interface –  warl0ck Mar 5 '13 at 14:41
    
@warl0ck, not a duplicate, I am having a problem here (Firefox is trying to go through wlan0 for port 80 connections, when it shouldnt), so I think its a problem with default gateway updating at the moment the wifi connects. –  Jorge Mar 5 '13 at 15:11
add comment

1 Answer

Firefox can go through wlan0 only in this cases:

1) If it would like to use address 169.254.x.x/16, which is automatically added link-local address - you can disable it by uninstall avahi* stuff.

2) If you would like to go to some address in the 192.168.25.0/24 network.

If you would like to use for address in the 192.168.25.0/24 and for ssh protocol wifi0 interface and for other protocols you would like to use eth0, you have to use policy routing:

echo 100 ssh >> /etc/iproute2/rt_tables
ip rule add fwmark 100 table ssh
ip route add 192.168.25.0/24 dev wifi0 table ssh
ip ro add default via 192.168.100.254 dev eth0 table ssh
ip ro del 192.168.25.0/24 dev wifi0 table main
iptables -A PREROUTING -t mangle -p tcp --dport 22 -j MARK --set-mark 100

Main idea is, that "normal" routing table doesn't know nothing about network 192.168.25.0/24, but ssh protocol does.

You can check Advanced Rounting HOWTO page.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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