update-resolv-conf script does not restore old values
Bug #226185 reported by
Cory Albrecht
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openvpn (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
The installed script, /etc/openvpn/
Because the computer no longer knows any nameservers to contact for resolution, internet connection all but lost.
The script should copy the existing resolv.conf (or it's settings) to a backup in order to restore them when the VPN terminates.
To post a comment you must log in.
Thanks for your bug report.
update-resolv-conf uses /sbin/resolvconf (if installed) -a and -d options to handle the update of the /etc/resolv.conf file. If you have resolvconf installed, the /etc/resolv.conf file should no longer be edited by hand, otherwise your changes will be lost at next update : resolvconf doesn't backup/restore configurations, it builds resolv.conf dynamically.
Try : resolv. conf
$ cp /etc/resolv.conf my_backup_
$ echo nameserver 10.0.0.1 | sudo /sbin/resolvconf -a eth0
$ cat /etc/resolv.conf
$ echo nameserver 192.168.0.1 | sudo /sbin/resolvconf -a eth1
$ cat /etc/resolv.conf
$ sudo /sbin/resolvconf -d eth1 resolv. conf /etc/resolv.conf
$ cat /etc/resolv.conf
$ sudo mv my_backup_
You can see that if the original configuration of the /etc/resolv.conf file was created by resolvconf, everything works ok.
So you should decide if you want to use resolvconf to handle your /etc/resolv.conf file : if yes, you should provide the original configuration using /sbin/resolvconf -a to make sure it will not be overwritten by update-resolv-conf. If not, you should create scripts to backup/restore your resolv.conf file and use them (instead of update-resolv-conf) in your openvpn config files.
AFAICT the behavior you're experiencing is the way resolvconf is designed to work. I'll close this bug as invalid, please feel free to reopen it if you think I did not properly understand.