LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-04-2018, 06:26 PM   #1
mr.travo
Member
 
Registered: Oct 2017
Location: All over the US
Distribution: Mint 18.3 Cinnamon, Gallium, Ubuntu Armbian (headless), Arch (learning)
Posts: 138

Rep: Reputation: 10
Lightbulb 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
 
Old 03-04-2018, 08:06 PM   #2
mr.travo
Member
 
Registered: Oct 2017
Location: All over the US
Distribution: Mint 18.3 Cinnamon, Gallium, Ubuntu Armbian (headless), Arch (learning)
Posts: 138

Original Poster
Rep: Reputation: 10
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:

127.0.0.1 www.disney.com
127.0.0.1 disney.com

Anyone that can explain this would be awesome!

Thanks guys!

T

Last edited by mr.travo; 03-04-2018 at 08:10 PM.
 
Old 03-06-2018, 01:10 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ 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.

Last edited by ondoho; 03-06-2018 at 01:11 AM.
 
Old 03-06-2018, 11:49 AM   #4
mr.travo
Member
 
Registered: Oct 2017
Location: All over the US
Distribution: Mint 18.3 Cinnamon, Gallium, Ubuntu Armbian (headless), Arch (learning)
Posts: 138

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by ondoho View Post
^ no idea, it should work like with the other entries.


PS: some browsers (chrom*) seem to work around /etc/hosts, or at least not update it immediately.
I appreciate it! I have Chromium installed but rarely use it. I refuse to use *G* Chrome.
 
Old 03-27-2018, 01:58 PM   #5
erabaddosi-2116
LQ Newbie
 
Registered: Mar 2018
Posts: 20

Rep: Reputation: Disabled
Hi mr.travo,

What is /etc/nsswitch.conf set to for the "hosts" line?
 
Old 03-27-2018, 09:21 PM   #6
mr.travo
Member
 
Registered: Oct 2017
Location: All over the US
Distribution: Mint 18.3 Cinnamon, Gallium, Ubuntu Armbian (headless), Arch (learning)
Posts: 138

Original Poster
Rep: Reputation: 10
Talking

Quote:
Originally Posted by erabaddosi-2116 View Post
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DNSCrypt craigevil Debian 7 03-15-2012 08:27 AM
apache2 & tomcat5 - how to configure VIRTUAL HOSTS & JSP? nicolasdiogo SUSE / openSUSE 2 04-05-2007 09:06 AM
SUSE Linux 9.3 for Dummies (For Dummies S.) samuelmp SUSE / openSUSE 11 08-01-2005 01:42 PM
SuSE 9.2 - apache2 & tomcat5 - how to configure VIRTUAL HOSTS & JSP? nicolasdiogo Linux - Networking 2 03-20-2005 08:06 AM
hosts.allow & hosts.deny question... jonc Linux - Security 9 03-05-2005 09:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration