Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Mint 18.3 Cinnamon, Gallium, Ubuntu Armbian (headless), Arch (learning)
Posts: 138
Rep:
DNScrypt & /etc/hosts for dummies...
Yes, I titled this for me
A month or so ago I setup DNScrypt and love it. I have put it on both my linux systems now. Today I found out about the /etc/hosts file for blacklisting websites.
What I am wanting to do is download the ready-made list at hostfile.min.nu and put it on my /etc/hosts. The problem that I am seeing is in the setup instructions they say:
"Every hosts file in Linux should have an entry for the IP address "127.0.0.1", with the name "localhost" following it."
While I understand this and know it's true, I was told to change my DNS in my IPv4 connections to 127.0.0.2 in order for DNScrypt to work properly.
Will editing the hosts file and leaving everything setup with 127.0.0.1 cause a conflict between the two or cause the hosts file to not work properly?
Sorry for the question- I'm just trying to learn this stuff as I go.
Thanks for your time!
Last edited by mr.travo; 03-04-2018 at 07:12 PM.
Reason: grammar errors
Distribution: Mint 18.3 Cinnamon, Gallium, Ubuntu Armbian (headless), Arch (learning)
Posts: 138
Original Poster
Rep:
Ok- I went ahead and tried blocking a couple of sites (facebook and instagram) and it worked! I still don't understand why I had to point my connections settings for the DNS in IPv4 to 127.0.0.2 instead of keeping it at 127.0.0.1 for DNScrypt to work. I will see if I can dig up more about that.
Another question I now have about the hosts file is I tired adding another "test site" (disney.com) but it still loaded. I restarted the network and everything and it still loads no matter what. I then added another site to ensure I didn't have anything messed up and it blocked it like it's supposed to.
Can anyone tell me why disney is still going through? I added both:
^ no idea, it should work like with the other entries.
to answer your first Q: the usual way is to append the list of hosts to be blocked to /etc/hosts.
also various scripts float around the 'net that will assist you.
PS: some browsers (chrom*) seem to work around /etc/hosts, or at least not update it immediately.
Distribution: Mint 18.3 Cinnamon, Gallium, Ubuntu Armbian (headless), Arch (learning)
Posts: 138
Original Poster
Rep:
Quote:
Originally Posted by erabaddosi-2116
Hi mr.travo,
What is /etc/nsswitch.conf set to for the "hosts" line?
Hey there! I have recently stopped using DNScrypt and OpenDNS on that system. I went back to a regular DNS loopback 127.0.0.1 and I think I have this one pointed to OpenNIC.
Here is my output:
Code:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.