4

I've set up a network bridge which I'm using to connect KVM virtual machines on my desktop to my home network; I' ve don this the manual way by creating the bridge in /etc/network/interfaces (the way it's done by the book for best networking performance, and we're using on our company virtualisation servers).

This, however, means that NetworkManager isn't managing the eth0 interface any more, and is refusing to set up VPN connections.

That wouldn't have bothered me so much if I could find an app to connect with instead of NM. But, alas, I couldn't find anything! There was some package called kvpnc, described as a GUI for VPN clients, but it kept crashing. As far as I could see, there wasn't any alternative working VPN GUI.

Other people are having similar problems: network bridge - without destroying network manager but that guy just ended up going back to NM and setting up routing instead of a bridge instead of finding an alternative VPN client.

Any ideas?

Edit: forgot to mention that I'm using PPTP at the moment and might need OpenVPN in the future.

1
  • For now I'm just using pptpsetup on the command line to connect. The connection drops every half hour or so, I have to kill pppd and reconnect. It's a major PITA as I have to use screen over SSH sessions because they are lost after the connection drops.
    – jjakob
    Mar 24, 2013 at 17:01

1 Answer 1

4

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.

2
  • is it imperative to remove network-manager ? Jan 28, 2014 at 18:59
  • Ubuntu Vivid network bridging works now, confirmed. And no, it doesn't appear necessary to remove NM. Just delete connections you are not concerned with, and add them manually to /etc/network/interfaces and friends. Works fine. NetworkManager ignores them.
    – dpb
    Mar 19, 2015 at 5:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .