I have a collection of machines in my local network which I would like to get into VPN as easily as possible. I'm thinking using a single PC as a gateway as follows:

{{bunch of machines using DHCP}}--[switch]--[(eth1)PC(eth0)]--{{internet}}-[VPN]

The idea is to put two NICs inside the PC and use eth0 for real internet connection. However, the connection should really be made to VPN. Then I would want to use eth1 as a DHCP router where any device connected to switch thinks it's in the same LAN as VPN. I can accept NAT if I need to use private IPs for my bunch of machines.

I guess I need OpenVPN, dnsmasq and iptables but how do I combine those?

The objective is to be able to connect a new device to the switch and it should magically get suitable DHCP configuration and a working network connection to the VPN.

If this is possible using only one NIC in the PC (static IP configuration) and still providing DHCP service to local machines, it would be even better.

(Note that I'm not trying to merge my local network in the VPN - I just need all my local machine connections masquerade as coming from VPN when viewed by entity outside my bunch of machines.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.