Stop unwanted static IP addresses getting added to /etc/resolv.conf

Stop unwanted static IP addresses getting added to /etc/resolv.conf

Using Linux as a daily driver is usually painless, but when something weird starts happening, it can get hard to resolve, particularly if many others aren't facing similar issues.

One such issue I've been facing on my Manjaro Linux is that a particular static IP (10.0.3.1) always gets added to /etc/resolv.conf. This will just work in my office network but will break the network connectivity on public WiFis. I had to manually remove the below line every time I connected:

nameserver 10.0.3.1        

Tried searching for every possible network config file for a possible 10.0.x.x pattern - but no luck. In the end, it turns out to be a config parameter in dhcpd that caused the issue. I just had to comment out this line:

options classless_static_routes        

It sounds like the system learned that my primary network is 10.0.3.x and had added a stick DNS route to 10.0.3.1 regardless of my network. After the line mentioned above is removed from /etc/dhcpd.conf, restarting dhcpd and reconnecting to the network, the annoying line stopped appearing in /etc/resolv.conf. I can now happily connect to any WiFi :)

要查看或添加评论,请登录

Vannia Rajan的更多文章

社区洞察

其他会员也浏览了