As stated in a previous question I want to connect to 2 VPN servers at the same time and for each connection specify the IPs of computers I want to reach with it.
One of this VPN connection is done with vpnc and a default.conf file, and the other one is done with a Cisco client (I am not able, for now at least to connect with vpnc because I don't have the IPSecrete element required to connect).
I am ok with the connection done through vpnc: I am able to connect configure the targeted IPs to use the created interface as following:
#!/bin/sh
#Get default gateway
DEFGW=`ip route list | grep default | awk -F' ' '{print $3 }'`
DEVICE=`ip route list | grep default | awk -F' ' '{print $5 }'`
echo "Default Gatway is: $DEFGW on device $DEVICE"
echo "Starting vpnc"
sudo vpnc
echo "Adding routes to known computers through VPN network interface"
sudo route add -net 132.181.11.0 netmask 255.255.255.0 dev tun0
echo "Adding all other routes through standard network interface"
sudo route del default
sudo route add default gw $DEFGW dev $DEVICE
Now, before running the two connections simultaneously, I am trying to do the same with the Cisco client but I am facing on problem with resolv.conf. This file is modified by the VPN client with a domain value and to DNS servers values. Running the following script result in DNS resolutions errors (reported by chrome)
#!/bin/sh
#Get default gateway
DEFGW=`ip route list | grep default | awk -F' ' '{print $3 }'`
DEVICE=`ip route list | grep default | awk -F' ' '{print $5 }'`
echo "Default Gatway is: $DEFGW on device $DEVICE"
echo "Starting cisco"
sudo /opt/cisco/vpn/bin/vpn connect 134.214.244.203
echo "Adding routes to computers through VPN network interface"
sudo route add -net 132.212.146.156 netmask 255.255.255.255 dev cscotun0
echo "Adding all other routes through standard network interface"
sudo route del default
sudo route add default gw $DEFGW dev $DEVICE
Any help and comments on this, and solve the issue are welcome.
Thanks