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?


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.

| improve this answer | |
  • So something like ssh -C2qTnN -D 8080 username@remote_machine.com ? – jrg 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.

| 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.

| 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 jrg@myserver.com:22

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

| improve this answer | |

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.