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:
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: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:
...and replace the UUID in the new config file with this.
Restart Network Manager so it sees the new config:
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:
To turn on the new connection, do:
If you named the connection inside the config file something different from the filename, use the name inside the config file.