Ubuntu – How to allow the vpn client access to remote LAN(eth1)

iptablespptpdvpn

My ubuntu server has two if: eth0, eth1.

eth0: Public IP  
eth1: 192.168.0.2  

I've configure down eth0 for a vpn server using pptpd.

The vpn ip_range is 192.168.100.234-248

#/etc/pptpd.conf
logwtmp
bcrelay eth2
localip 192.168.100.1
remoteip 192.168.100.234-238,192.168.100.245

Now from my client can connect to vpn server and get 192.168.100.234 address.

But I can't access anything in 192.168.0.2/24 LAN network.

I've try to setup iptables -A FORWARD -j ACCEPT and also a -t nat settings.

But seems no effects.

How to done this work correct?

Thanks a lot.

Here is my server and client related info https://gist.github.com/4635571

Best Answer

I've found a solutions and has been tested. It just works.

My ubuntu server has two network interfaces: eth1 - wan eth2 - lan 192.168.0.2

And the VPN service use 192.168.100.1 as its address.

VPN client will get an address from 192.168.100.234-238.

Following commands let VPN clients access to the other clients behind the server's LAN. e.g. 192.168.0.100

Using iptables to setup nat.

# ubuntu vpn server 
sudo iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -d 192.168.0.0/24 -j MASQUERADE

And client add route manually.

# mac os x client
sudo route add 192.168.0.0/24 192.168.100.1
Related Question