Questions tagged [hosts]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

etc/hosts and Firefox

Today I started having long initial load times for Firefox, Thunderbird and running sudo commands. A Reddit post helpfully diagnosed this as an issue with my /etc/hosts file containing the wrong ...
remote1223's user avatar
1 vote
1 answer
37 views

zsh completion for cssh: complete hosts from /etc/hosts as well as ~/.ssh/config

my zsh completion file _cssh has this line, which completes hosts only from /etc/hosts: '*:userhostport: _alternative hosts:host:_hosts usersathosts:userathost:_user_at_host' how do I make it ...
Martin Vegter's user avatar
0 votes
1 answer
59 views

Why do I get different browser behaviour when attempting to reach bitcoin.stackexchange.com and the alias of its IP in /etc/hosts?

I haven't found any browser that supports aliases defined in /etc/hosts even when single terms (without having to prepend in the browser with http://) are not interpreted as search terms for the ...
John Smith's user avatar
0 votes
1 answer
57 views

/etc/hosts alias or multiple record

I want to know what is different between this two configuration : First : 127.0.0.1 localhost my-hostname 192.168.10.12 host-a a.com Second : 127.0.0.1 localhost my-hostname 192.168.10....
mah454's user avatar
  • 308
0 votes
1 answer
55 views

Can't connect to domain listed in /etc/hosts connects via IP

Debian 12/Bookworm headless host I have a local container running with an IP of 10.88.0.2. I can access the container via IP: root@dev ~# ping -c2 10.88.0.2 PING 10.88.0.2 (10.88.0.2) 56(84) bytes of ...
Jeremy Davis's user avatar
0 votes
3 answers
95 views

Is checking /etc/hosts and /etc/resolv.conf sufficient to know that no server is trying to falsely represent itself as another?

Say I want to make sure that no malicious actor or process has made an attempt to falsely represent a legitimate web server with their own malicious server on Linux, anticipating that the user will ...
Govind Parmar's user avatar
0 votes
0 answers
59 views

Ubuntu: Broadcast CNAMES/Alias to the router/ DHCP server/ DNS server

I am trying to build a portable home server with a Intel NUC. My requirement is to plug my NUC to any of my friends or relatives router and with minimal configuration, preferably no configuration, be ...
Aditya Kumar's user avatar
3 votes
1 answer
3k views

What is the purpose of the 127.0.1.1 entry in /etc/hosts?

Been googling this but found very ambiguous answers and I'm curious if I should modify these values, my VPS hosts file looks like this: 127.0.0.1 localhost 127.0.1.1 debian 144.17.4.xx porter.info ...
Cexoxa's user avatar
  • 33
1 vote
0 answers
762 views

sudo: unable to resolve host debian: Name or service not known. I've already set host name in /etc/hostname and /etc/hosts but it keeps changing?

Hello Linux community. I have a VPS service bought from Vultr, so this is not some home standalone PC with Linux installed on it. I have to deal with all this obscure Control Panel setup they "...
michal roesler's user avatar
0 votes
1 answer
66 views

Create hostnames per IP on Debian

I use a server with multiple IP addresses as a Squid proxy. Sadly every query to every IP address will expose the primary hostname of my webserver. So I added the following lines to my /etc/hosts file:...
Deex's user avatar
  • 103
1 vote
2 answers
328 views

cache /etc/hosts and /etc/resolve.conf forever

I'm looking for a way to cache the hosts file, the resolv.conf file and new DNS entries and the closest thing that doesn't quite work is nscd. Nscd will happily cache DNS requests that are present in ...
mike_s's user avatar
  • 11
1 vote
0 answers
131 views

How to block or whitelist specific webpages or files within a domain but block most of the domain?

I know how to use /etc/hosts to redirect www.herpaderp.com to 0.0.0.0 The problem is I need one page file from the website on a regular basis. I want to whitelist www.herpaderp.com/dir/foo.bar while ...
Max Power's user avatar
  • 264
2 votes
2 answers
1k views

Why accessing 0.0.0.0:443 gets redirected to 127.0.0.1:443 on Linux and how to disallow it?

tl;dr: accessing 0.0.0.0:port (eg. curl http://0.0.0.0:443) gets redirected(internally) to 127.0.0.1:port (where port is any port number) (eg. the previous curl command is the same as curl http://127....
correabuscar's user avatar
0 votes
1 answer
219 views

Connection to test server by editing hosts file results certificate error [closed]

My website running from centos 7 VPS have some compatibility issues, so I purchased a VPS and created a copy of the website and tried to fix them without affecting my website. But the problem is I ...
Biju Mathew's user avatar
1 vote
2 answers
3k views

associate IP with hostname without editing /etc/hosts

I know I can associate hostname with my IP address in /etc/hosts: 1.2.3.4 foo and then, for example in tcpdump output, I will see foo instead of my IP address (if -n was not used) Anyways, can I ...
Martin Vegter's user avatar
0 votes
1 answer
236 views

Webserver /etc/hosts file questions

I know that the hostname of the server should be listed in the /etc/hosts file. 1.1.1.1 server1.example.com server1 Do I also need to list every domain hosted on the server within the /etc/hosts file ...
Dwyer's user avatar
  • 1
1 vote
1 answer
697 views

cannot access github.com

I cannot nslookup github: nslookup github 8.8.8.8 ;; connection timed out; no servers could be reached nslookup github.com ;; connection timed out; no servers could be reached nb: default ns server =...
achille's user avatar
  • 203
0 votes
0 answers
1k views

Unable to resolve DNS names that are mentioned in the /etc/hosts file

I am running RHEL8 and running into a very weird issue. I have host entries in my /etc/hosts file, but when I go to ping them, I am getting name resolution errors. Here's an example of my /etc/hosts ...
user3447014's user avatar
0 votes
2 answers
528 views

Debian /etc/hosts has unusual entry

I switched from Ubuntu to Debian And in debian the /etc/hosts file after a new install is (on a cloud server): 127.0.1.1 static.246.62.63.178.clients.your-server.de static # The following lines are ...
run_the_race's user avatar
1 vote
1 answer
627 views

Random DNS errors after change to nsswitch.conf

I recently installed my EPSON L3150 printer's drivers and about the same time I started having weird (and random) DNS name resolution errors in some applications (ssh, nextcloud-client), that I can ...
arielnmz's user avatar
  • 529
0 votes
1 answer
22 views

How to change the host address that my web server listens on?

I am setting up a web server on my Ubuntu host. To be specifically, it is gdbgui. According to its help info, I can use --host to specify the host IP it listens on. And on my host, I have below IP ...
smwikipedia's user avatar
  • 1,203
-1 votes
1 answer
977 views

Trying to block website

I have Linux and i try to block website and i have followed this kind of way to block website in my computer.. Steps to block websites in Linux Open terminal shortcut keys Ctrl + Alt + T. Type sudo ...
Samuel Muroma's user avatar
0 votes
2 answers
3k views

Is it possible to block website through system Linux firewall for browser that used DNS over HTTPS?

OS: Fedora 34 Browser: Mozilla Firefox with DoH enabled I'm trying to block website through core Linux settings (not web browser extension etc). Problem is inside DoH that I'm using. If I disable DoH, ...
PDD's user avatar
  • 21
2 votes
0 answers
1k views

How to synchronizing /etc/hosts files across multiple linux machines

I have 20 linux servers that use /etc/hosts files to see and talk with each other. I'm adding servers to this pool of servers. It is required to do host resolution via the /etc/hosts files. DNS or NIS ...
Cell-o's user avatar
  • 505
0 votes
1 answer
425 views

How can I push to GitHub when it's blocked?

Right now, https://github.com is blocked with 127.0.0.1 github.com www.github.com in the /etc/hosts file. However, I need to push from git to GitHub. How can I achieve this without editing my hosts ...
Cutewarriorlover's user avatar
0 votes
1 answer
73 views

copy files from multiple remote machines to local and create directories for remote machines

Have multiple vm machines that am using for studying, and have come up with this script for copying some files from vm's to my local machine: SG=rohos; date; for i in `cat /etc/hosts | grep "$SG-&...
Ve-Khan's user avatar
0 votes
1 answer
233 views

Blocking domain on host, results in blocking domain on guest VM (QEMU/KVM)

Desired Outcome I want to block a.com on a host machine, but allow it on a guest VM. (I would also like to use dnsmasq to re-point domains on the guest machine independently.) Details On a Linux Mint ...
Micah B.'s user avatar
  • 109
0 votes
1 answer
86 views

How do I get the inside of the network to see the server properly? Inside the network, foobar.net doesn't resolve

I'm running MINT 20.1. I am connected to the net via AT&T UVERSE fiber optic. I have a DNS, foobar.net, set up to point at my router, and when I am outside the network, I can load a website ...
Richard Hasting's user avatar
3 votes
1 answer
172 views

Why is bash listing the effective content of /etc/hosts if I press Super_L+Space?

The title pretty much sums it up. I have some (minimal) content in /etc/hosts. The file looks something like: # some comment 127.0.0.1 localhost foo bar 1.2.3.4 baz ::1 localhost ip6-...
Turysaz's user avatar
  • 35
0 votes
0 answers
52 views

Why is the IP address lookup in /etc/hosts only sometimes work?

The '/etc/hosts' file in a Linux laptop (with LAN IP 172.17.37.21) by default contains : 127.0.1.1 Acer-Aspire-6930G When I want to reach this laptop wirelessly from a smartphone or a PC using an FTP ...
Petoetje59's user avatar
0 votes
1 answer
7k views

The authenticity of host can't be established but that host is in known_hosts file

In order to skip initial SSH negotiation, I have added the public key of the server I am going to connect to inside my known_hosts file, following these suggestions. However, when trying to connect to ...
rudicangiotti's user avatar
0 votes
1 answer
879 views

Is there a distro specific to the LAMP stack?

I tried real hard to get LAMP stack working on my pop_os home pc, but could not get it working. Is there a distro in existence with the LAMP stack preinstalled which I can just add WordPress on top of....
Neil Meyer's user avatar
0 votes
0 answers
113 views

Apache2: Hosting Multiple Sites (Ubuntu Server)

I am new working with system.d and services on ubuntu/debian. I'm trying to serve multiple sites on the same Apache2 (I am note sure if I should have 3 apache2 folders for the each service). The ...
Wiimortal's user avatar
0 votes
2 answers
123 views

My /etc/hosts is having no effect

I added a large number of domains to my /etc/hosts, in the hope of preventing outgoing traffic to those sites. Now I have found however that my /etc/hosts is having no effect. It's meant to serve as a ...
wudude's user avatar
  • 197
0 votes
0 answers
436 views

mDNS instead of IP in /etc/hosts?

I have a laptop that I want to communicate with from my other PC. Sometimes I need to connect with this laptop for various tasks (ssh, scp, ping, to reach some locally hosted website, etc. - dev stuff ...
mnj's user avatar
  • 291
3 votes
1 answer
1k views

Can I use /etc/hosts to whitelist domains?

I set up a little ubuntu box for my son for remote learning and I would like him to only access certain domains in the browser. I was thinking of doing a blanket etc/hosts but I would need to add ...
Frank Conry's user avatar
1 vote
1 answer
1k views

Arch linux: spotify stuck offiline

I have installed spotify on arch linux via yay. When I open spotify it says it is offline even when I have working internet connection and throws error code: 4 This is log of spotify: spotify: /usr/...
Jan Černý's user avatar
  • 1,381
1 vote
0 answers
41 views

Is it possible to configure /etc/hosts on a per network basis?

I have a server at home with a domain name (let's call it domain.name). On my laptop, I have added this line to /etc/hosts: 192.168.1.7 domain.name At home, this is great, but at others places this ...
Melchisedech's user avatar
3 votes
2 answers
787 views

Can a line in /etc/hosts on Linux contain just an IP address?

I am closely working on /etc/hosts file in Linux. I have designed some operations for /etc/hosts file like add, modify and delete. I have read little about /etc/hosts and got to know that it contains &...
Ragini Dahihande's user avatar
0 votes
1 answer
494 views

How do I assign a hostname to a dynamic IP address assigned by DHCP?

On my home network, the IPv4 address changes regularly, probably because when my computer got turned off, another computer was assigned to the same address so when I started my computer, there was an ...
Jonathan Dahlin's user avatar
1 vote
1 answer
3k views

Ansible - Access group variables in tasks

I have my inventory file configured with group variables. Example: all: children: europe: vars: network_id: 3 network_name: "europe-eu" hosts: ...
Maximi's user avatar
  • 113
1 vote
1 answer
158 views

Hosts.deny on FreeBSD suddenly empty?

I'm wondering why a hosts.deny file with about 600 denied IPs and ranges would sudden empty itself. Is there any reason for this to happen automatically? No one else has connected to the server to ...
Tmanok's user avatar
  • 227
1 vote
1 answer
393 views

Unable to resolve entry in hosts file?

I have the following entry in the hosts file: 127.0.0.1 postgres This works most of the time: [root@l25 log]# ping postgres PING postgres (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (...
Nick M's user avatar
  • 121
8 votes
1 answer
5k views

bash like autocompletion for ssh command in zsh shell with /etc/hosts file?

zsh is great so far. I am using zsh-completions but still I am unable to get autocompletion for ssh commands like in bash as shown in below screenshot: How to get hostnames from /etc/hosts for ssh | ...
Akhil's user avatar
  • 1,290
1 vote
1 answer
1k views

How do I write dig output to /etc/hosts file?

I'm a shell beginner and here's an example, I don't know how to implement it. Any help, thanks in advance! Step 1: Get the domain resolution A record via dig. dig @8.8.8.8 liveproduseast.akamaized....
Matthew's user avatar
  • 351
2 votes
2 answers
5k views

Device or resource busy - getaddrinfo

I'm on a CentOS 7 VM running PG, MariaDB, sidekiq and apache httpd. Sometimes my logs are spammed with errors such as: unable to resolve address: System error WARN: Mysql2::Error::ConnectionError: ...
Nick M's user avatar
  • 121
1 vote
1 answer
258 views

What will happen if I add 1 million lines in /etc/hosts/ [duplicate]

I am trying to write a website blocker and the simplest thing I found is putting lines at the end of /etc/hosts. If I want ot have 1 million websites blocked that redirect to localhost would that slow ...
Deyan Dachev's user avatar
-2 votes
2 answers
53 views

How do I modify the lines in a etc/hosts?? Add # in the beginnig of the line which has specific domain?

I have a host file which has about 15 lines of a specific host entry. All these host entries has the text # Entry added by Automation in the entry. For example: 10.122.123.124 file1.auto.test-...
user413120's user avatar
1 vote
1 answer
911 views

Why adding hostnames to /etc/hosts entries change the website viewed

Ippsec does a lot of hackthebox boxes walkthroughs and in many of them he edits the /etc/hosts file. Sometimes he adds multiple hostnames to the same ip address and when he browses those hostnames he ...
Cauan Kazama's user avatar
1 vote
1 answer
519 views

Block all websites except Kahn academy

I am trying to set up a ubuntu user so that they can access the Kahnacademy instructional website, but not anything else. In particular, I want to block youtube. There are instructions here but I ...
Manu's user avatar
  • 131

1
2 3 4 5