One of my attempts to work around this problem with VPN DNS in 17.04 was to duplicate my existing wifi connection but with different DNS entries.

But Gnome's Network Settings UI appears to have no way to add a connection to a wifi access point if the SSID is already known to another connection profile. If I try to add it as a hidden network (where I can manually enter the SSID), it simply detects that I already have a system wide profile for it and prompts me to authenticate to change it, preventing me from adding a second one.

Is it possible to have two different sets of connection settings to the one wifi access point?


You need to directly manipulate the Network Manager config files.

Start by copying the file for the profile you want to duplicate:

$ cd /etc/NetworkManager/system-connections
$ ls
My Wifi Connection  My VPN  Some Other Connection
$ sudo cp "My Wifi Connection" "My Wifi Connection 2"

You need to change a few things in the new config file for it to work properly. Firstly, the name. If you look inside the config file (you need sudo for this), you'll see it starts with something like:

id=My Wifi Connection

Edit the file (with sudoedit) to change the name to something different eg. "My Wifi Connection 2" or whatever makes it special eg. "My Wifi Connection (special DNS)".

Secondly, it needs a distinct UUID. The problem is, since you just copied this, the "unique" identifier is shared by two connections. Generate a new UUID like so:

$ sudo apt install uuid
$ uuid

...and replace the UUID in the new config file with this.

Restart Network Manager so it sees the new config:

$ sudo systemctl restart NetworkManager

Now for using it — you'll need to change connections via the command line, because Gnome doesn't this situation.

To turn off your existing connection, do:

$ sudo nmcli connection down "My Wifi Connection"

To turn on the new connection, do:

$ sudo nmcli connection up "My Wifi Connection 2"

If you named the connection inside the config file something different from the filename, use the name inside the config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.