OpenVPN: push all LAN traffic through an OpenVPN client to the other side

  1. Local variables for this post, adjust to fit your setup:
    1. OpenVPN client server IP
    2. Remote network
  1. Add this to the client server that is using OpenVPN to connect to the remote server:
    1. sudo iptables -A POSTROUTING -o tun0 -j MASQUERADE
    2. as root user, do
      1. echo 1 > /proc/sys/net/ipv4/ip_forward
  2. Add this to your local computer 
    1. Linux: 
      1. ip route add via
    2. Mac:
      1. route -n add
Now, you should be able to ping from your local computer, through the client machine, and to a server in the remote network. Once that works, try ssh.

NOTE: take a look at /etc/sysctl.conf if you want the ip_forward to last through reboots of client server: net.ipv4.ip_forward=1


Popular posts from this blog

Debugging pfsense firewall rules clearly and easily

Direct ssh to a server via proxy using putty/plink on Windows

telnet vs netcat