Scenario:
You have a local area network:
- 192.168.1.1 – Router
- 192.168.1.4 – Laptop
- 192.168.1.5 – Desktop
Solution:
In this scenario, your desktop computer is connected to your corporate VPN. You would also like your laptop connected, but can’t because the VPN only allows 1 connection per username. Your corporate lan is a 10.0.0.0 network. In this example I use VPNC, which creates an interface called ‘tun0′ when I connect (use ifconfig -a to see all of your interfaces).
Commands on Desktop:
#!/bin/bash
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -i eth0 -d 10.0.0.0/8 -j ACCEPT
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
sysctl net.netfilter.nf_conntrack_acct=1
Commands on client:
#!/bin/bash
sudo route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.5
Related posts:
#1 by milad on September 30, 2009 - 3:17 am
Quote
Hi, mr. harms
i have LAN , 1 of pc install ubuntu 9.04 and other pc’s install xp sp2.
linux is install to internet by VPN connection, i need to share vpn connection that other xp client use internet, how can it?
network is ready , clients can ping linux and see shared folder , also linux can see and ping xp’s!.
i used firestater but can not share vpn connection.
help me ples.
sorry for my english!
thanks alot
Milad