Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
  • PC1 is connected via VPN to server1 (s1)
  • s1 is connected to pc1 via VPN tunnel and to s2 vie ssh. There is transparent proxy and iptables rules that take traffic from VPN and push to ssh SOCKS5.
  • s2 is connected in local lan with some servers that hosts pages like:
  • s3: app1.name_1.work.com app2.name_1.work.com
  • s4: app1.name_2.work.com app2.name_2.work.com

What I want to is to after entering in web browser on PC1: app1.name_1.work.com get to this site. Now I can do it only by entering IP address.

Edit /etc/hosts on pc1 will solve the problem probably - but I can't do that. Edit /etc/hosts on s1 - didn't help, /etc/hosts on s2 contain all necessary entry but also not solving this problem. I'm looking for some simple solution, maybe some chain for iptables, or very simple DNS. Have you got any ideas?

share|improve this question
add comment

1 Answer

If all your traffic goes though the VPN you simply need to change the secondary dns in your /etc/resolv.conf to point to the dns server used by the servers Lan. By doing so, your browser will know where to look for S1 or S2 services.

If only some traffic goes through the VPN, your setup is similar to mine. Most of my traffic goes through my local lan, but a few requests are redirected to the company servers on another continent. After running my vpn client I have to run the following script to make things work:

ip route add xx.xx.0.0/8 dev ppp0
ip route add 192.168.0.0/16 dev ppp0
ip route add xx.xx.92.151 dev ppp0
ip route add xx.xx.92.137 dev ppp0
vpn="`ifconfig | grep -A1 ppp | grep inet | awk '{ print $2 }' | awk -F":" '{print $2}'`"
sudo route delete default gw $vpn

PS: I have of course replaced the IPs of my company with XX.

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.