Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out if I can do this via a SOCKS proxy, or if I need to use a VPN.

I have a Ubuntu server, and a dual-boot Ubuntu 11.10/Windows 7 client. What I'd like to do is connect to the server, and then be able to make use of entries in the servers /etc/hosts file - including one which is on the servers LAN.

Is this possible via SOCKS? If not, is there anything special I'd need to do for it to work with openVPN?

share|improve this question
up vote 3 down vote accepted

The /etc/hosts file definitely won't work with a regular VPN, you'll have to set up some kind of DNS server for that to work. That - or just copy your hosts file over to your client.

SOCKS, depending on the client software, does support name resolution being performed by the SOCKS proxy rather than by DNS on the client machine. Depending on the implementation of the SOCKS server you plan on using, it might use the /etc/hosts file on the server for name resolution - or it might not. Try! It might even be configurable.

As a little tip suggestion for a zero-effort SOCKS proxy for an Ubuntu server, use SSH to set up dynamic SSH tunneling with a SOCKS interface generated by the local SSH client. Both PuTTY and OpenSSH may be used in this mode.

share|improve this answer
So something like ssh -C2qTnN -D 8080 ? – James Dec 12 '11 at 20:52
Something like that, yes. Although port 8080 is usually used for a HTTP proxy rather than a SOCKS proxy. I suggest port 3128 instead to be a little more "standard". – Per von Zweigbergk Dec 12 '11 at 21:15

What I'd like to do is connect to the server, and then be able to make use of entries in the servers /etc/hosts file

It doesn't work that way. The entries in /etc/hosts are for the local machine only. You'll either need to create corresponding entries in the client's hosts file or create proper DNS records for them.

With regards to your question about OpenVPN vs. a SOCKS proxy, if all you're doing is browsing website through the tunnel, then there is not an advantage to either. Just pick one and use it.

share|improve this answer

dnsmasq will serve up /etc/hosts data as if it were a DNS database, as well as providing a DHCP server and DNS cache.

share|improve this answer

After some searching, I found something.


After some tweaking and reading the README, I got something that did what I wanted it to.

./sshuttle -r --dns

That sends all my traffic through my server, and gives me access to my LAN. Poor mans proxy and VPN server.

share|improve this answer

Your Answer


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.