Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [hosts]

/etc/hosts is the configuration file with locally known mappings between domain name and ip address.

-2
votes
0answers
64 views

Blocking some URL of a website [on hold]

I want to block some addresses not all of a website in Ubuntu or debian system. Example; www.facebook.com - allow www.facebook.com/xxx/xxx.php - block www.facebook.com/ARBFxolCIhmdc6h_Rz6Jj8HXpFTkZa ...
9
votes
3answers
1k views

How do `/etc/hosts` and DNS work together to resolve hostnames to IP addresses?

In Linux, how do /etc/hosts and DNS work together to resolve hostnames to IP addresses? if a hostname can be resolved in /etc/hosts, does DNS apply after /etc/hosts to resolve the hostname or treat ...
-1
votes
1answer
67 views

Can browse to an app at localhost.company.com but that isn't in /etc/hosts; where else could the redirection be?

✗ cat /etc/hosts ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 ...
1
vote
1answer
158 views

Understanding why hostname -i returns strange IP address

I am referencing the following question because it's similar but not the same: hostname -i returns strange result in linux On my CentOS 7 system, I get a strange IP address from "hostname -i" after ...
0
votes
1answer
44 views

/etc/hosts file is cluttered with useless content, how should I properly use /etc/hosts ( apache2 )

I recently tried to add a URL in my /etc/hosts file, and because of many different attempts in the past, I realized I most probably have some extra lines in there which are not necessary. I have read ...
1
vote
3answers
82 views

Mapping a range of IP's to a domain name in hosts file

I work with Wi-Fi. Due to that my system's IP changes every time I connect to the network. For my work, I need to map my IP to a specific domain name. So, every day I need to make changes in my hosts ...
0
votes
1answer
199 views

How do I modify my hosts file in Nixos?

Seems my hosts file (/etc/hosts) points to /nix/store/gds7bha3bx0a22pnzw93pgf0666anpyr-etc-hosts and is read only. How am I meant to modify this file?
0
votes
2answers
74 views

program/application or script that reads /etc/hosts

What is the name of the program or script that opens and reads /etc/hosts when name resolution is needed? and is it different for every linux/unix distro? I read the man page for hosts and tried ...
1
vote
2answers
121 views

Use reference to file instead of IP in /etc/hosts

From my host with hostname localhost, I would like to reach an external host with hostname exthost through the internet. The public IP address of exthost is dynamically assigned by the Internet ...
1
vote
0answers
29 views

Remote not using hosts file from server

I am using a hosts file on an Ubuntu Server where is written all the pairs IP domain names. The remote computers (all of them with Windows OS) are connected to the server on the same network and they ...
3
votes
0answers
73 views

Hosts file no longer ignoring midline comments

I've just upgraded from ubuntu 16.04 to 18.04 My /etc/hosts file has a number of lines in the form: 1.1.1.1 domain1.net domain2.net # domain3.net domain4.net (In other words, I had originally ...
5
votes
1answer
487 views

Ubuntu /etc/hosts addresses in the form *.*.*.*

Let's say a website does not have a domain name like www.google.com and the only way to connect to it is to use an IP address like 216.58.212.68. If I add an entry in /etc/hosts that looks likes 0.0.0....
2
votes
2answers
183 views

how to configure /etc/hosts properly [duplicate]

I'm learning about networking, at home I have two physical machines and a bunch of VMs that I use to test my applications each machine has a different hostname and I map them manually in each /etc/...
1
vote
1answer
640 views

IPv6 link-local address in /etc/hosts

I have an entry like this in /etc/hosts: fe80::XXXX:XXff:feXX:XXXX%enp0s25 test-ipv6 This is a link-local address. I've masked out my MAC address (with the 7th most significant bit flipped) for ...
2
votes
1answer
28 views

Some hostnames in hosts file do not resolve [closed]

My hosts file has two entries in the same range: 84.xxx.xxx.111 serverA 84.xxx.xxx.112 serverB I can ping serverA BUT I can't ping serverB for which I get Unknown Host. /etc/resolv is fine [...
0
votes
0answers
76 views

adding a fully qualified name for the server in /etc/hosts for oracle installation

So this is a area I don't clearly understand (adding ip addresses, hostnames and mapping etc...). In the guide for oracle database installation here, it is mentioned that adding a qualified name for ...
0
votes
1answer
125 views

How can I create a multiline entry in /etc/hosts?

We have a situation where we have many aliases for an IP address and these aliases need to be defined in /etc/hosts. Rather than having extremely long lines containing all the aliases for an IP ...
1
vote
2answers
3k views

How to map an IP address to localhost

So I have an IP Address 5x.2x.2xx.1xx I want to map to localhost. In my hosts file I have: cat /etc/hosts 127.0.1.1 test test 127.0.0.1 localhost # The following lines are desirable for IPv6 capable ...
-1
votes
1answer
104 views

Setting up hostname, hosts & domain correctly [closed]

I'm new to this platform but I try to be as specific as possible. I researched quite a lot but every new answer just adds to the confusion at the moment. I am running Debian on my first server with a ...
0
votes
1answer
74 views

Why do i need www. and non www in /etc/hosts

Why for some website to get blocked by the /etc/hosts file I need the www version and the non www version. While for others the non www version in enough ? on surviv.io I need both 'versions': 0.0.0....
0
votes
2answers
6k views

What is the proper way to display IPv6 Addresses in /etc/hosts

I've been tasked with writing a document on IPv6 for my colleagues to learn how to configure IPv6 addresses on our hosts. We primarily use RHEL6.x/7.x, ESXi, and Ubuntu Server. This only pertains to ...
0
votes
1answer
75 views

How can I apply domain search paths to /etc/hosts lookups?

I have a server with search example.com in resolv.conf, and it works correctly for DNS lookups. That is, if I ping host, and host1.example.com is in DNS, it is found. But if host1.example.com is in /...
1
vote
1answer
46 views

How to see which website an app is trying to access?

Hello Unix StackExchange, I've recently started using StevenBlack's /etc/hosts file, and it seems to have broken some apps I've been using. So far I've noticed that Thunderbird can't log into GMail ...
18
votes
3answers
14k views

What is the purpose of /etc/hosts?

As I understand it, the hosts file is one of several system facilities that assists in addressing network nodes in a computer network. But what should be inside it? When I install Ubuntu by default ...
0
votes
2answers
137 views

IP address in /etc/hosts that will always fail?

I know that you can add hostnames to /etc/hosts so that resolving them doesn't actually perform a DNS lookup. This would be a line such as 123.45.67.89 myhostname My question is, what can I set the ...
1
vote
0answers
305 views

hostname not showing in who command output with RHEL 7.4 after editing in /etc/hosts file

On Redhat 7.4(maipo) server I am seeing issues as below. Prior to RHEL 7.4 let say RHEL 7.3 if I login to server though putty using my local IP 192.168.187.1 and execute who command it was showing ...
1
vote
1answer
28 views

Find where a hosts rule is defined on macOS

Is there a way to find out how my system came up with the IP address for a certain domain? On my machine, pinging analytics.google.com returns 127.0.0.1, and I don't know how it came up with that. my /...
1
vote
1answer
122 views

/etc/hosts not blocking anything

I am trying to use /etc/hosts on my mac to block infamous scumbag sites like mackeeper.com and com-cleaner.systems from ever loading again in popups. While doing that I've found these entries on my ...
3
votes
1answer
1k views

Only use /etc/hosts for resolving hostnames on Linux

I want to disable DNS lookups via DNS server and only resolve host names that are listed in /etc/hosts. I am on Raspbian 9. How would I set this up?
0
votes
0answers
81 views

dnsmasq has no effect on router itself

here is my resolv.conf nameserver 127.0.0.1 nameserver isp_provided Here is my dnsmasq.conf, which will do DHCP also: user=nobody bind-dynamic interface=br0 interface=ppp1* no-dhcp-interface=ppp1* ...
2
votes
1answer
346 views

Is it possible to redirect all wikipedia urls to wikipedia zero via hosts file?

I would like all links and address bar entries in the pattern https://*.wikipedia.org/* to be redirected to https://*.0wikipedia.org/* I tried to achieve this by adding these entries to /etc/hosts ...
0
votes
1answer
73 views

My Linux server forgets its host name every day

I have a Linux server # uname -a Linux site 3.12.39-47-default #1 SMP Thu Mar 26 13:21:16 UTC 2015 (a901594) x86_64 x86_64 x86_64 GNU/Linux # lsb_release -a LSB Version: n/a Distributor ID: SUSE ...
42
votes
5answers
5k views

What is the /etc/hosts size limit?

How can I determine or set the size limit of /etc/hosts? How many lines can it have?
0
votes
1answer
1k views

Curl localhost from within vagrant VM results in 'Empty reply from server'

I started a deepstream server in a vagrant vm. The server says it's Listening for websocket connections on 0.0.0.0:6020/deepstream The /etc/hosts in the vm: # 0.0.0.0 localhost 127.0.0.1 ...
0
votes
1answer
8k views

Set a host name alias in /etc/hosts?

I'm having an issue relating to host names and SSL signing. The certificate signing process works fine if my host name is puppet. With the IP of the puppet master server being set in /etc/hosts. I ...
0
votes
1answer
486 views

ntpdate IPv4 query to localhost ntp server failing

the command ntpdate -q -4 localhost in an NTP server is making two queries to 127.0.0.1 and one of them fails: is this failing because of the /etc/hosts file? ntpdate -q -4 localhost server 127.0.0....
1
vote
2answers
717 views

Blocking telegram using /etc/hosts

I'm using /etc/hosts to block domains that I don't want to be accessible, and it works for most domains. However it doesn't seem to be working for the Telegram webchat (web.telegram.org). I have the ...
0
votes
1answer
39 views

how to allow specifiy incomming ssh users,even after blocking specific hosts?

i want to take ssh by one specific user in linux. also i block all other IP to take ssh except some specific IP. my /etc/hosts.allow file is sshd : localhost : allow sshd : 192.168.1.23 : allow sshd :...
4
votes
0answers
455 views

Make ping show hostnames instead of IPv6 addresses

When I use the command ping ff02::1%eth0 to get a response from all IPv6 hosts in the network segment, I get responses from a bunch of link-local (fe80::) addresses (LLIPs). In order to figure out ...
1
vote
1answer
275 views

Resolve urls within the server

My problem is urls within my PHP scripts are not resolving correctly. Ie, the domain name I am using in a PHP script doesn't resolve back to the server when accessed from within the server. For ...
1
vote
0answers
132 views

How can I connect to my server via its domain name, after redirecting it to the internal IP via /etc/hosts? [closed]

I recently changed my /etc/hosts file so that I can directly connect to my server via its internal IP (rather than using internet bandwidth by sending data out of our intranet). Here is the entirety ...
4
votes
1answer
558 views

Can I map an internal IP address to a domain name, when on a particular network?

I have a server at home, with internal IP 192.168.1.100. I use a dynamic DNS service so that I can reach it at http://foo.dynu.com when I am out. When I have my laptop at home, I know that I could ...
3
votes
1answer
899 views

Why isn't /etc/hosts blocking domains after I add blocked sites via launchd? [closed]

I've been trying to setup Launchd to block several websites from Chrome on osX 10.12.2 from 9AM - 3PM Monday-Friday I set up launchd to cp /etc/hosts_BLOCKED_sites.txt /etc/hosts Launchd seems to be ...
11
votes
1answer
2k views

How is an Elastic IP address different from a static IP address?

More of a Amazon Web Services EC2 question, hopefully not too off topic. I have a vanilla Ubuntu instance with them, and powered it off. On reboot couldn't ssh to the FQDN because the external IP ...
1
vote
1answer
373 views

Why are there so many localhost variations in default /etc/hosts?

Here is my /etc/hosts on a fresh CentOS: 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 ...
1
vote
1answer
51 views

Mac hosts files can't be persisted always been overwritten

Any change I made to /private/etc/hosts file can't be persisted. After a while(like 10 minitues), the file will be overwritten. How can I find out the root cause of this problem? Or can I make the ...
1
vote
0answers
97 views

The correct way of implementing adblocking with uzbl?

I though about running some proxy on localhost, but will I be able to filter https? I've tried to use scripts from wiki, but they are not seem to work. Another idea is to implement adblocking using /...
0
votes
4answers
6k views

Can't ping to another linux machine by hostname

When i try to ping to another linux machine in my local network i didn't work when i insert the host-name in the ping command. sudo ping Raspberry2 It only works when i insert the IP address in the ...
1
vote
2answers
391 views

host resolve setting for one command? [duplicate]

To modify a host's resolved address we can change /etc/hosts I want to have that functionality when running a single script without actually modifying /etc/hosts Something $HOST=foo.bar:10.0.1.256 ...
0
votes
1answer
60 views

Best way to give a user some root privileges in particular apach files and command

I wrote a shell script (this one) to init a new website project. It have to be executed by a user (it isn’t a mater if he got root privileges because this user is me). As you see, the user have to be ...