Having connected to a new provider, which provides access to the network via VPN, I had to deal with a bunch of man and fak on raising two simultaneous vpn-connections in lines. I picked it up in ubunt 9.10 and decided to somehow compile the info in one hopefully clear fact.
This FAQ will be useful to those who want to set up two simultaneous VPN connections for the local and external networks.
First you need to download a package that will provide support for the connection protocol we need, for this we enter in the terminal:
')
sudo apt-get install pptp-linuxAfter the package is installed, we go to write the connection configuration in the
/ etc / ppp / peers folder, for this we need admin rights (if they are not already), for convenience, I will write a standard terminal input with the necessary rights in the terminal editor nano to the connection configuration file :
sudo nano / etc / ppp / peers / connection_name1Where
connection_name1 is the name of the connection being created (you can name it as you like).
Next, enter the connection data in the edit window:
pty "pptp vpn.isp.ru --nolaunchpppd"
user "your login"
password "your password"
unit 0
nodeflate
nobsdcomp
noauth
replacedefaultroute
defaultroute
persist
maxfail 0Where
vpn.isp.ru - vpn-server for Internet access to your provider, and login and password for access to the Internet.
Press
ctrl + x , then confirm saving with
Y.So, the first config is ready, then we write the second for a local connection:
sudo nano / etc / ppp / peers / connection_name2Where, again, the name of the connection can come up with your own =)
There we write:
pty "pptp vpnx.isp.ru --nolaunchpppd"
user "your login"
password "your password"
unit 1
lock
nodeflate
nobsdcomp
noauth
persist
maxfail 0Where
vpnx.isp.ru - vpn-server for access to the local environment of your provider, and login and password for local access.
Save the whole thing
ctrl + x , then
Y.Configs ready.
Now we will configure autorun and routing for lokalku.
To do this, edit
/ etc / network / interfaces :
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
'up route add-net 10.0.0.0 netmask 255.0.0.0 gw 10.66.6.1
auto connection_name1
iface connection_name1 inet ppp
provider connection_name1
auto connection_name2
iface connection_name2 inet ppp
provider connection_name2Here you can add routes for accessing resources directly through an existing connection (without VPN). I commented out an example of such a route, so when you add a route you will have to remove the "
' " symbol from this config.
Where in place of
10.66.6.1 should be your local gateway.
Next we go to write route scripts for
connection_name2 .
We need to create
/etc/ppp/ip-up.d/routeWe write in the terminal:
sudo nano /etc/ppp/ip-up.d/routeWe write the following routes in the opened editor:
#! / bin / sh
ip route add 10.200.0.0/16 dev ppp1Where
ppp1 is a link to
connection_name2Press
ctrl + x , then confirm saving with
Y.Then we make this script executable, for this we write in the terminal:
sudo chmod + x /etc/ppp/ip-up.d/routeNext you need to create a script to delete routes.
We write in the terminal:
sudo nano /etc/ppp/ip-down.d/routeWe write in the editor that opens:
#! / bin / sh
ip route add default gw dev eth0Press
ctrl + x , then confirm saving with
Y.Then we make this script executable, for this we write in the terminal:
sudo chmod + x /etc/ppp/ip-down.d/routeEverything, now we write the command to restart the network in the terminal:
sudo /etc/init.d/networking restartAnd now the Internet is configured, the routes are registered. The ultimate goal is achieved.
Hope not forgot anything.