Skip to main content

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
39 views

how to add multiple interfaces in `/etc/hosts.allow` file?

SSH is listening on all the available 10 Ethernet interfaces in my system. I have tested using nc 160.49.198.97 22 command in Linux. To allow only particular interface and block others, i have created ...
0 votes
0 answers
22 views

Passing last IP octet to a host alias and have it added to complete full proxycommand with ip address

I wish to have this all done in the ssh config file for a specific user. The site has hard-coded ip addresses into there various software and using the naming convention is not really an option. Host ...
5 votes
1 answer
4k 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 this ...
0 votes
1 answer
2k views

Browse by hostname from internet browser

I can browse my server site using ip:8080 which is inside my home network.But I am not able to browse using hostname:8080 I do not have dns server. I have edited /etc/hosts file to include ...
1 vote
1 answer
42 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 ...
0 votes
1 answer
2k views

Make user made entries in /etc/hosts permanent

I use Juniper Networks network connect to connect to the office network. Once i am inside the office network, i check the server ips and add entries for them in /etc/hosts file like, 10.199.xx.yy ...
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 ...
0 votes
1 answer
65 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....
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 | ...
25 votes
6 answers
16k views

Host lookup that respects /etc/hosts

Utilities like host and dig let you see the IP address corresponding to the host name. There is also the getent utility that can be used to query /etc/hosts or other NSS databases. I am looking for ...
267 votes
9 answers
166k views

Can I create a user-specific hosts file to complement /etc/hosts?

Is it possible to add a list of hosts that are only specific to a certain user? Perhaps a user-specific hosts file? This mechanism should also complement the entries in the /etc/hosts file.
0 votes
1 answer
58 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 ...
0 votes
3 answers
102 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 ...
5 votes
2 answers
18k views

How to edit /etc/hosts without sudo?

I have a machine that I can only access using SSH. I was messing with the hostnames, and now it says: ssh: unable to resolve hostname I know how to fix it in /etc/hosts. Problem is, I need sudo ...
7 votes
3 answers
62k views

/etc/hosts for Debian

I was trying to get a perl script that contacts a PostgreSQL database to work on a server. This script was mysteriously failing. I then realised that localhost was not in the /etc/hosts file. The ...
22 votes
2 answers
14k 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
1 answer
11k views

DRBD - 'node1' not defined in your config (for this host) - Error when setting Primary

I am getting the following error when trying to set the Primary node for DRBD. 'node1' not defined in your config (for this host). I know this is related to DNS/Hostname/Hosts and the config ...
3 votes
0 answers
227 views

Unblocking websites using /etc/hosts

I cannot unblock certain websites that were previously blocked from /etc/hosts. Here is what the file looks like: 0.0.0.0 facebook.com :: facebook.com 0.0.0.0 youtube.com :: youtube.com When I ...
1 vote
1 answer
27k 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 ...
1 vote
0 answers
906 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 "...
0 votes
0 answers
60 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 ...
0 votes
2 answers
5k views

Why is my /etc/hosts file not being read?

My /etc/hosts file looks like this: # Your system has configured 'manage_etc_hosts' as True. # As a result, if you wish for changes to this file to persist # then you will need to either # a.) make ...
35 votes
3 answers
62k views

Blocking Websites with /etc/hosts

There's a website, www.example.com, that I tried to block myself from accessing because it wastes too much of my time. So I configured my /etc/hosts file. I added the following lines, to block the ...
51 votes
5 answers
54k views

/etc/hosts file refer to another configuration file

How can I get the /etc/hosts file to refer to another configuration file for it's list of hosts? Example /etc/hosts: ## My Hosts 127.0.0.1 localhost 255.255.255.255 broadcasthost #Other ...
3 votes
1 answer
4k 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 ...
0 votes
1 answer
70 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:...
1 vote
2 answers
382 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 ...
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....
1 vote
0 answers
133 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 ...
22 votes
3 answers
43k 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 ...
0 votes
1 answer
264 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 ...
1 vote
2 answers
4k 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 ...
0 votes
1 answer
242 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 ...
45 votes
5 answers
11k 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?
41 votes
4 answers
105k views

Creating alias to domain name with /etc/hosts

I have a domain setup to point to my LAN's external IP using dynamic DNS, because my external IP address changes frequently. However, I want to create an alias to this host, so I can access it with ...
1 vote
1 answer
713 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 =...
0 votes
0 answers
2k 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 ...
0 votes
2 answers
548 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 ...
1 vote
1 answer
668 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 ...
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 ...
7 votes
2 answers
14k views

Postfix email bounced (mail for domain loops back to myself)

I have a problem when I send a mail to [email protected] for [email protected] My emails has bounced for this error: status=bounced (mail for orbialia.es loops back to myself) May 9 09:33:58 ...
-1 votes
1 answer
1k 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 ...
2 votes
3 answers
3k 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
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, ...
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 ...
26 votes
4 answers
106k views

Understand hostname and /etc/hosts

In /etc/hostname, I have myname. In /etc/hosts, I have : 127.0.0.1 localhost.localdomain localhost myname ::1 localhost.localdomain localhost myname I have a vague understanding of what ...
0 votes
1 answer
442 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 ...
0 votes
1 answer
82 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-&...
0 votes
1 answer
237 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 ...
0 votes
1 answer
87 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 ...

1
2 3 4 5