Okay, this is how I got around the problem:
1. Remove Network Manager
sudo apt-get remove network-manager
note: read the end of this post for a disclaimer
2. Set up pptp on the command line
We'll use a handy tool called pptpsetup
that sets up all the needed config files for us.
Run:
sudo pptpsetup --create $your-connection --server se.rv.er.ip --username $pptp-username --encrypt
replace :
- $your-connection with the a short name for the new connection
- se.rv.er.ip with the IP of the server you want to connect to
- $pptp-username with the username of the connecting user
You will be first asked for the sudo password, then pptpsetup will ask you for the password for the PPTP connection. Enter it, then press enter. Take care, don't mix them up.
This will have created all the configuration files necessary. If you don't want to use the default route pushed to you by the server, add a line saying nodefaultroute
to /etc/ppp/peers/$connection-name
.
3. Starting and stopping the connection manually
sudo pon your-connection
to connect, and
sudo poff your-connection
to disconnect.
4. If you want to automatically add and remove custom routes:
Create two scripts, like this:
(place them somewhere in your home folder, /root is also ok if you don't forget to back it up)
pptp-on.sh:
#!/bin/bash
# This script connects us using pre-configured PPTP VPN,
# and then adds all the routes we specify here.
pon your-connection
a=$?
sleep 5
# add routes
if [ $a == 0 ]; then
# whatever routes you need
route add -net 192.168.1.0 netmask 255.255.255.0 dev ppp0
echo "Connected"
fi
exit $a
pptp-off.sh:
#!/bin/bash
poff your-connection
a=$?
# delete routes
if [ $a == 0 ]; then
#specify whatever routes you have here
route del -net 192.168.1.0 netmask 255.255.255.0 dev ppp0
echo "Disconnected"
fi
exit $a
They have to be owned by root: sudo chown root:root pptp-on.sh pptp-off.sh
. Make them executable: sudo chmod +x pptp-on.sh pptp-off.sh
Name them whatever suits you, so you'll know what they're for.
5. Creating desktop launchers
I wanted to have desktop launchers I can just click on instead of running the scripts manually every time I connect and disconnect. To do this, I created two desktop launchers that run gksudo /path/to/pptp-on.sh
and gksudo /path/to/pptp-off.sh
respectively. I used Marian Lux-es Create Launcher available from Ubuntu's Software Center. Google for how to do this, I'm not going to write this here (cause I'm lazy).
That's it. You can have as many different connections as you want, all turned on and off easily with launchers. Just do all the steps again for every additional connection.
But beware, as said, this is not a fix, but a solution. The fix will be when NM gets
built-in support for network bridges, which is, if I've read correctly, already done in 13.04. This is just intended for people like me, who plan to hold on to 12.04 as long as they can (I've tried 12.10 but had big problems, like incompatibility with my ATI graphics card, lot of bugs, etc.), or at least until the next LTS release or moving to new/er hardware.