Sometimes you want to enable a VPN connection from your command line. The NetworkManager package on Ubuntu brings the nmcli script, which can be used to do exactly that.
First, list all available connections:
$ nmcli con NAME UUID TYPE TIMESTAMP-REAL netresearch 4a595227-... vpn Sun Dec 4 13:47:19 2011 home.cweiske.de 2bf6c562-... 802-11-wireless Tue Oct 11 18:24:06 2011 customer 15b4b51f-... vpn never
Then establish the connection:
$ nmcli con up id netresearch Active connection state: unknown Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/7 state: VPN connecting (need authentication) (2) state: VPN connecting (3) state: VPN connecting (getting IP configuration) (4) Connection activated