-   Linux - Networking (
-   -   Share VPN Internet Connection (

davidolaj 05-29-2009 12:19 AM

Share VPN Internet Connection
I have a linux Box (Debian) conected to internet as VPN client. I have extra one ethernet card (eth0) available on the Box which I will like to connect with my LAN hub for my other computers (both Windows and Linux OS) to also have have Internet access.

How can I shared the Box (VPN Internet connection) with the eth0 and how do I enable the Box DHCP to act as Router for all Computers on the LAN?

Please I need HELP here!

orvaquim 05-29-2009 01:33 AM

Well, do you know how yor interface for VPN is identified?

Just run ifconfig to check that. Let us say that it is tun0

Follow this:
i) Ability packet forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forward

ii) Masquerade every machine on your network
iptable -A POSTROUTING -t nat -s x.x.x.x/24 -o tun0 -j MASQUERADE

iii) Copy the DNS servers from
cat /etc/resolv.conf

and place for everyone on your LAN, if they are static otherwise I advice you to configure a only caching DNS server.

Remember, steps i) and ii) must be executed for each reboot. So, for now place those commands on /etc/rc.local.

Good Luck and Hope this will help

All times are GMT -5. The time now is 12:41 AM.