3

When I connect to the internet in my university, through a PEAP, MSCHAPv2 protected WPA2 wifi network, it changes my resolv.conf to this:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
search ufsc.br

However, when I get home, I can't access the website as it tries to reach a local address which obviously isn't there. I have to manually remove the nameserver/search lines to be able to access it again.

My question is: what process is actually doing this - changing the file as I connect to my university's network? How can I find out which process is doing it and tell it to stop? Or, if this is necessary - how do I automatically roll the file back to an empty version when I leave the university's network?

Arpit Jain
  • 80
  • 7
  • You should probably have a look at https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu – vidarlo May 02 '18 at 18:32
  • 1
    This seems to be the same problem as https://askubuntu.com/q/58781/696245 – Arpit Jain May 02 '18 at 18:34
  • I'll take a look at the second one but the first one seems to break VPN functionality for some users, something I also use (the University's VPN). – Peterson Silva May 05 '18 at 02:22

1 Answers1

0

I'd recommend to set a static IP through Network Manager first. Once connected to the network of your university, modify the settings going to the IPv4 tab and choosing the Manual method. Press the Add button and add your static IP.

Example:

IP 192.168.x.xxx

Netmask 255.255.255.0

Gateway 192.168.x.x

Save your new configuration

To know your Gateway digit the following command in a terminal:

route -n

The output of the command should be something like this:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    600    0        0 wlp2s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlp2s0
192.168.2.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp2s0

As you can see my Gateway is 192.168.2.1 and the IP you will choose will be a 192.168.2.xxx ( example 192.168.2.100 ).

Disable the systemd-resolved service and stop it:

sudo systemctl disable systemd-resolved.service
sudo service systemd-resolved stop

Put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

dns=default

Install resolvconf:

sudo apt-get install resolvconf

and edit or create the file /etc/resolvconf/resolv.conf.d/tail

sudo nano /etc/resolvconf/resolv.conf.d/tail

Add Google nameservers (one per line) to the file

nameserver 8.8.8.8
nameserver 8.8.4.4

Save the file pressing Ctrl+O

RESTART YOUR SYSTEM and connect to your network