Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PPTP Routing secrets revealed

Few months ago somebody asked how to route only the neccessary traffic through PPTP. I forgot to answer as I promised.

Now i needed the script again because i had to reinstall my win2k. I attach the script i use to route the traffic.

This script is tested only in win2k. Hope this helps you all  [:)] 

Any comments and fixes are welcome. At least is works for me.


REM ROUTING PPTP TRAFFIC
REM
REM By default w2k routes all traffic though PPTP when VPN in active
REM
REM with this little script you can route the traffic though VPN interface
REM when it is neccessary
REM
REM Configure your VPN, open the connection and run this script.
REM You need to run it once only.
REM
REM Remember uncheck option 'Use default gateway of remote network'
REM it messes up whole routing
REM
REM Jouni Rajala
REM jouni.rajala@kolumbus.fi

REM ------------------------
REM SETTINGS
REM ------------------------

REM RWIP is the IP address you get from astaro
set RWIP=

REM DEFAULTGW is your own gateway you want to use when accessing internet
set DEFAULTGW=

REM VPN network is the private network of your roadwarrior-ip
set VPNNET=
set VPNMASK=

REM REMOTE network is the network you want to access through PPTP
set REMOTENET=
set REMOTEMASK=

REM ------------------------
REM THE ADDING OF THE ROUTES
REM ------------------------

route DELETE 0.0.0.0
route DELETE %VPNNET%
route DELETE %REMOTENET%

route -p add %VPNNET% mask %VPNMASK% %RWIP%
route -p add %REMOTENET% mask %REMOTEMASK% %RWIP%
route add 0.0.0.0 mask 0.0.0.0 %DEFAULTGW%

REM ---------------------------------------------------
REM TEST ROUTING
REM ----------------------------------------------------
tracert -d 
tracert -d 


This thread was automatically locked due to age.
  • I once wrote a similar script, but was quickly told that all that is needed to do this is to:
    1)  Go to Properties of your VPN Connection
    2)  Select the Networking tab
    3)  Highlight TCP/IP and hit "Properties"
    4)  Select the "Advanced" button.
    5)  Uncheck the "Use default gateway on remote network" box.

    Done.
  • it doesn't work. if you need to access public network behind your private network the traffic needs to be routed through private network.

    When you disable 'use default gateway of remote network' you can only access the private network astaro gives you ip.

    If you use that default gateway of remote net then all traffic is routed through it.

    So if i get IP 192.168.0.2/24 from astaro I can access only network 192.168.0.0/24. But if i need to access the network 195.100.100.0/24 the traffic is routed through default gateway. Of course firewall will block all traffic. So I need to configure traffic to 195.100.100.0/24 network through that private network 192.168.0.0/24.

    (The network 195.100.100.0 is not ours  [;)]
  • grimphyre 

    Nice code, but it may be unneccessary.

    All I had to do (in Win98) was to run a bat that said:

    route add 192.168.21.0 mask 255.255.255.0 10.79.21.0

    192 = my internal net
    10  = pptp net

    This way it's pointing at the interface instead of just the IP.  After you VPN in just run the bat and you're in!  Of course the routing has to be set up on Astaro too, back and forth.

    gf
  • I didn't get any routing working with w2k without first deleting ´some routes

    I made the script because i had to instruct our employees to do the dirty work.

    It was much easier to tell them what to do this. I were only required to fill info about their own network and not really understand what happens  [;)]