How to write script for VPN gateway switch?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to write script for VPN gateway switch?
# 1  
Old 12-21-2013
Router How to write script for VPN gateway switch?

I have a VPN subscription at Private Internet Access. I mainly use the Switzerland gateway. Now I use it with their client. Many times the Switzerland gateway is down so I have to find another gateway. I want to setup my DD-WRT router (WRT54GL) with the VPN and I want it to automatically switch between the best possible gateways or at least the ones which are working. So basically a script for this or any other solution is also most welcome.

I was discussing this issue at another forum with somebody. He advised me to ask somebody who has UNIX experience. Since I have no UNIX experience, I do not know how to do that. I quote some of what he advised me.
"In any case the basic configuration is the same as if you would say have 2 remote offices. You build a VPN connection to both from your central location. Unlike a office situation where you would route certain networks to each tunnel in your case you need to route the default route. Since the router likes to always has a BEST route even though there are 2 default routes in the routing table it will choose one or the other based on some metric value you set. If the primary link would go down this default route will get removed and it will use only other one that is left. When the primary comes back it will get the better default route back and it will switch back. The only problem with this design is when the VPN stays active but just does not pass any traffic or is getting 90% packet loss. You would have to write a script that could detect something that advanced and cause it to change the metrics on the other default route to make it be selected."
So here it is.

Previously I was seeking advice on how to connect 3 routers wirelessly. Now I am over that, I will connect them with a wire. But I want my DD-WRT router to do the DHCP server. He adviced me this:
"If you want all your traffic to flow only via vpn then what you do is lie to your end devices. Say your main gateway is 192.168.1.1 and your vpn router is 192.168.1.2 You would set the DHCP server (can be any router) to tell the client devices to send all the traffic to 192.168.1.2. The 192.168.1.2 router would know to send all the traffic into the VPN tunnel to the remote site but it also would know that the gateway to the internet was really 192.168.1.1. It would send the tunnel traffic itself to 192.168.1.1 but it would send any other non tunnel internet traffic though the tunnel."

So can somebody help me with my case? Much appreciated.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Inconsistency between RedHat 6.5 global gateway and single gateway leads to loss of default gateway

Dear friends I use RedHat 6.5, which sets the gateway in the configuration file / etc / sysconfig / network as GATEWAY = 192.168.1.26, and the gateway in the configuration file / etc / sysconfig / network-scripts / ifcfg-eth11 as GATEWAY = 192.168.1.256. The two gateways are different.... (6 Replies)
Discussion started by: tanpeng
6 Replies

2. Shell Programming and Scripting

Script to execute with switch

Hello I want to create a script which will require a mandatory value and optional values which can be supplied using switch. If optional values are not supplied, the script will use the default values mentioned in the script. For example, how we create user in linux systems. Please... (3 Replies)
Discussion started by: atanubanerji
3 Replies

3. IP Networking

Cisco 3750 Switch ASA VPN Routing

Hi,I want connect my ASA 5510 firewall to a 3750 switch with RIP routing. Unfortunately,I am having issues passing the VPN subnet through rip to the 3750.I don't understand how the routing table is populated on the ASA. Any suggestions? (0 Replies)
Discussion started by: Ayaerlee
0 Replies

4. Linux

GNUGK-How to setup static gateway to gateway routing

Dear Sir I am a newbie in the world of IP telephony. I have been working with Asterisk PBX (SIP) and Cisco Call Manager (MGCP) but now I am learning on how to work GNUGK for H.323 Gatekeeper. I am having a problem, configuring static call routing on GNUGK in the section ... (0 Replies)
Discussion started by: mfondoum
0 Replies

5. Shell Programming and Scripting

Switch from one database to other using shell script

Hi all, This is my first ever post to any forum so, dont let this go in vain...........:) Here is the scenario........ I have logged into the unix where oracle_sid is initialized for some X database in the .profile. I have a unix script where some sql query which fetches data from X... (3 Replies)
Discussion started by: sachinkl
3 Replies

6. Shell Programming and Scripting

vpn connect/disconnect shell script

Hi I am not so good in scripting..trying ot learn it...need guidance of the experts in shell scripting.. Let me explain the scenario first.. a server MX1 is connected to another server MX2 through vpn..every 5 minute a script runs to test vpn connectivity between the 2 servers.when the vpn... (12 Replies)
Discussion started by: renuka
12 Replies

7. IP Networking

start a new terminal from a script after opening VPN

Hi all, I am trying to write a script that launch the cisco vpn client from the command line and then connects to a remote host using ssh. When i connect to the cisco vpn using vpnclient client connect the last lines of output from that client is Encryption: 168-bit 3-DES Authentication:... (0 Replies)
Discussion started by: borderblaster
0 Replies

8. Shell Programming and Scripting

script with more then one switch

Hi, have managed to code a script that has a simple menu so for instance if I run: this will call a help function that displays the programs help, I have coded this in using a case statement so if: case is h) call the help function The problem is I don't know how to code in the... (3 Replies)
Discussion started by: Del33t
3 Replies

9. Shell Programming and Scripting

ftp-gw(gateway) script help

What is the best method to ftp files to a machine that is outside of a gateway (0 Replies)
Discussion started by: coburn
0 Replies
Login or Register to Ask a Question