Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to route all requests to 123.123.* normally through eth0 and everything else through VPN (tap0).

This should probably be done with iptables. Any ideas how?

Thanks

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You can do this with route.

route add -net 123.123.0.0 netmask 255.255.0.0 dev eth0
route add default gw 10.8.0.1

Assuming the gateway on your VPN network is 10.8.0.1

share|improve this answer
    
great. that also means dns resolving is being done through gateway? I am asking this because some (not all) subdomains from the 123.123.* cannot be found if try access them in firefox. I just get host not found. but if I "host subdomain" it resolves the right IP. I have this in my resolv.conf (if 10.8.0.1) is vpn: 10.8.0.1 # vpn 123.123.1.1 123.123.1.2 –  user49445 Jul 27 '10 at 11:39
    
"host subdomain" also does not resolve. that was wrong information. ideas? but if "host subdomain" is working from the gateway (it is a publicly accessible subdomain). –  user49445 Jul 27 '10 at 11:45
1  
This doesn't change the behaviour of your DNS. The servers listed in resolv.conf will be queried in the order they're listed. –  theotherreceive Jul 27 '10 at 13:21
    
I improved your answer a little bit and now is everything OK: 1. route del default 2. route add -net 123.123.0.0/16 gw <my current gw> eth0 3. route add default gw <my new gw> thanks. –  user49445 Jul 27 '10 at 13:33
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.