LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Share VPN connection in Home network (https://www.linuxquestions.org/questions/linux-networking-3/share-vpn-connection-in-home-network-924901/)

zzy 01-20-2012 10:05 PM

Share VPN connection in Home network
 
I have several computers at home network. One of the CentOS machine connect to my office network through Cisco anyconnect VPN client. How can I configure this Linux box to let other computers share this VPN connection?

The CentOS computer has em1 interface and cscotun0 virtual interface when the VPN is connected. I set this machine as the gateway in my other computers. I enabled the ip forwarding and used the following MASQUERADE: "iptable -A POSTROUTING -t nat -s x.x.x.x/24 -o cscotun0 -j MASQUERADE". But it does not work. How do I configure the machine?

Thanks for the help.
Zack

eeekster 01-20-2012 10:35 PM

Is IPv4 forwarding turned on?

cat /proc/sys/net/ipv4/ip_forward

zzy 01-20-2012 10:44 PM

Yes.

$ cat /proc/sys/net/ipv4/ip_forward
1


Quote:

Originally Posted by eeekster (Post 4580365)
Is IPv4 forwarding turned on?

cat /proc/sys/net/ipv4/ip_forward


eeekster 01-20-2012 10:55 PM

Does turning off the firewall fix the problem? You might also need something like "iptables -A FORWARD -i eth1" with eth1 being your local network.

zzy 01-22-2012 09:26 AM

Firewall is off in my home network machines as firewall is running on DLink router.

Add "iptables -A FORWARD -i em1" does not solve the problem.

Quote:

Originally Posted by eeekster (Post 4580380)
Does turning off the firewall fix the problem? You might also need something like "iptables -A FORWARD -i eth1" with eth1 being your local network.


eeekster 01-22-2012 10:55 AM

Is the VPN the default route?

zzy 01-25-2012 09:50 PM

I add the following 2 rules and it is working now.

iptables -I ciscovpn -s 192.168.0.0/24 -o cscotun0 -j ACCEPT
iptables -I ciscovpn -d 192.168.0.0/24 -i cscotun0 -j ACCEPT

Thanks

Quote:

Originally Posted by eeekster (Post 4581357)
Is the VPN the default route?



All times are GMT -5. The time now is 08:07 PM.