Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to provide VPN split routing via PPPTP' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to provide VPN split routing via PPPTP
Authored by: tapella on Oct 27, '03 08:58:09PM

The "real gateway" is your normal gateway when not connected to the VPN. For example, if you use a little wireless hub or similar, it's probably 192.168.1.1. If you go to the Network Preference Pane details for the non-VPN connection you're using, the "real gateway" IP address is labelled as "Router" (at least in Panther).

Basically those two variables at the top of the code (vpn_server and real_gateway) are the system variables that get swapped. Normally real_gateway is your default Router/Gateway. When you connect to the VPN, vpn_server gets set as the default. The script unsets vpn_server as the default and then sets your normal real_gateway as the default, so that all the traffic that's not specifically designated in the vpn_nets list goes outside your VPN.

The line:
route add -net $vpn_net $vpn_server
is saying route all the IP addresses in the $vpn_net list through the $vpn_server IP (your VPN Router/Gateway). As I mentioned in the last paragraph, things not in that list will go through the "default gateway", which was reset back to your normal Router/Gateway by the script.

I'm not sure if that's clear or not, or if it helps.



[ Reply to This | # ]