date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,391,839,012,000 |
i recently installed Debian 10 Buster with KDE Plasma Desktop to my laptop. When i logon, system starts up the apps while they were open before shutdown.
I edited the file /etc/initramfs-tools/conf.d/resume
as RESUME=none and ran sudo update-initramfs, but Debian still resuming from disk when i restarted my computer.... |
It seems like this is a feature of KDE. It'll restart applications that were previously open in the last session.
Go to:
System Settings > Startup and Shutdown > Session Management
and select something other than "Restore previous session".
You'll probably want to re-enable hibernation.
| Disabling Hibernation Boot on Debian Buster |
1,391,839,012,000 |
I have a Dell Inspiron laptop with Gentoo and OpenRC. It has no trouble entering hibernation and suspend via gui or keyboard. It also restores normally.
I have configured xfce4-power-manager to put it to sleep and hibernation with lid event. And here comes the most fascinating thing: it wakes up as if normal, but its... |
More detailed answer follows for anyone interested
My failing kernel was for some reason lacking CONFIG_DRM_FBDEV_EMULATION=y
TL;DR end
Suddenly I have remembered that I once had genkernel kernel with initramfs, that probably worked fine.
It used the config from LiveCD, so I got that config and compiled the kernel wit... | Black screen after resume from syspend/hibernate on Dell Inspiron |
1,301,653,026,000 |
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 Configurations
<Link to /myPath/to/MyConfig/ConfigFile.txt>
#Other Addresses
3.3.3.3 MyAwesomeDomain.com
4.4.4.4 Someplac... |
You can't. The format for /etc/hosts is quite simple, and doesn't support including extra files.
There are a couple approaches you could use instead:
Set up a (possibly local-only) DNS server. Some of these give a lot of flexibility, and you can definitely spread your host files over multiple files, or even machines.... | /etc/hosts file refer to another configuration file |
1,301,653,026,000 |
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
127.0.0.1 localhost
will be there. Why?
How does /etc/hosts work in case of JVM systems like Cassandra?
When is DNS a... |
The file /etc/hosts started in the old days of DARPA as the resolution file for all the hosts connected to the internet (before DNS existed). It has the maximum priority, meaning this file is preferred ahead of any other name system.1
However, as a single file, it doesn't scale well: the size of the file becomes too b... | What is the purpose of /etc/hosts? |
1,301,653,026,000 |
How can I determine or set the size limit of /etc/hosts? How many lines can it have?
|
Problematical effects include slow hostname resolution (unless the OS somehow converts the linear list into a faster-to-search structure?) and the potential for surprising interaction with shell tab completion well before any meaningful file size is reached.
For example! If one places 500,000 host entries in /etc/host... | What is the /etc/hosts size limit? |
1,301,653,026,000 |
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 home. So I appended the following to my /etc/hosts:
example.com home
However, it doesn’t seem to like the domain name. If... |
The file /etc/hosts contains IP addresses and host names only. You cannot alias the string "home" in the way that you want by this method.
If you were running your own DNS server you'd be able to add a CNAME record to make home.example.com an alias for domain.example, but otherwise you're out of luck.
The best thing y... | Creating alias to domain name with /etc/hosts |
1,301,653,026,000 |
For a while I have been formatting my hosts file like this. Notice the same ip on two lines:
e.f.g.h foo.mydevsite.com
e.f.g.h foo.myOtherDevSite.com
I read recently that aliases are supposed to be consolidated on one line:
e.f.g.h foo.mydevsite.com foo.myOtherDevSite.com
However, I don't like this method because ... |
I found this thread that discusses doing something along these lines. The thread is pretty adamant about not having multiple lines line the /etc/hosts file.
excerpt - Re: /etc/hosts: Two lines with the same IP address?
No, it will not. The resolvers stop at the first resolution. Having
something like:
127.0.0.1 ... | Hosts file: Is it incorrect to have the same IP address on multiple lines? |
1,301,653,026,000 |
Pasted below this question is a sample of a /etc/hosts file from a Linux (CentOS) and a Windows machine. The Linux file has two tabbed entries after the IP address (that is localhost.localdomain localhost) and Windows has only one. If I want to edit the hosts file in Windows to have the machine name (etest) instead of... |
You always want the 127.0.0.1 address to resolve first to localhost. If there is a domain you can use that too, but then make sure localhost is listed second. If you want to add aliases for your machine that will lookup to the loopback address you can keep adding them as space separated values on that line. Specifying... | Format of /etc/hosts on Linux (different from Windows?) |
1,301,653,026,000 |
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 website on both IPv4 and IPv6:
127.0.0.1 www.example.com
::1 www.example.com
127.0.0.1 http://www.example.com
::1 http:... |
Rather then make this block using /etc/hosts I'd suggest using a browser addon/plugin such as this one named: BlockSite for Firefox or StayFocusd for Chrome.
BlockSite
StayFocusd
But I want to really use /etc/hosts file
If you must do it this way you can try adding your entries like this instea... | Blocking Websites with /etc/hosts |
1,301,653,026,000 |
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 a convenient standard utility (which is available in Debian, say) which resolves a host name regardless of where it is de... |
The only command that I am aware that does what you want is resolveip:
http://linux.die.net/man/1/resolveip
However it only comes with mysql-server, which may not be ideal to install everywhere.
| Host lookup that respects /etc/hosts |
1,301,653,026,000 |
What is the practical usage of /etc/networks file? As I understand, one can give names to networks in this file. For example:
root@fw-test:~# cat /etc/networks
default 0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0
google-dns 8.8.4.4
root@fw-test:~#
However, if I try to use this network n... |
As written in the manual page, the /etc/networks file is to describe symbolic names for networks. With network, it is meant the network address with tailing .0 at the end. Only simple Class A, B or C networks are supported.
In your example the google-dns entry is wrong. It's not a A,B or C network. It's an ip-address... | practical usage of /etc/networks file |
1,301,653,026,000 |
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 the resolved IP address by
/etc/hosts as a "hostname" to resolve recursively?
In my browser (firefox and google chrome)... |
This is dictated by the NSS (Name Service Switch) configuration i.e. /etc/nsswitch.conf file's hosts directive. For example, on my system:
hosts: files mdns4_minimal [NOTFOUND=return] dns
Here, files refers to the /etc/hosts file, and dns refers to the DNS system. And as you can imagine whichever comes first wins.... | How do `/etc/hosts` and DNS work together to resolve hostnames to IP addresses? |
1,301,653,026,000 |
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?
|
Modify the nixos config (usually in /etc/nixos/configuration.nix) with:
networking.extraHosts =
''
127.0.0.2 other-localhost
10.0.0.1 server
'';
This is documented at NixOS Wiki and defined here.
| How do I modify my hosts file in Nixos? |
1,301,653,026,000 |
Changes to /etc/hosts file seem to take effect immediately. I'm curious about the implementation. What magic is used to achieve this feature?
Ask Ubuntu: After modifying /etc/hosts which service needs to be restarted?
NetApp Support: How the /etc/hosts file works
|
The magic is opening the /etc/hosts file and reading it:
strace -e trace=file wget -O /dev/null http://www.google.com http://www.facebook.com http://unix.stackexchange.com 2>&1 | grep hosts
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 4
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 5
open("/etc/hosts", O_RDONLY|O_CLOEXEC) =... | Why do changes to /etc/hosts take effect immediately? |
1,301,653,026,000 |
It seems that wildcards are not supported in the /etc/hosts file.
What is the best solution for me to resolve all *.local domains to localhost?
|
You'd really need to run your own DNS server and use wildcards. Exactly how you'd do that would depend on the DNS package you ran.
| Wildcard in /etc/hosts file |
1,301,653,026,000 |
I'm administrating a networked environment where the users authenticate over NIS.
All machines can be used to SSH into the server but one.
On the machine in question, I get the message
ssh: connect to host servername port 22: Connection refused
I compared strace outputs from the machine in question and a machine th... |
It sounds to me like the problem host does not have a correctly configured nsswitch.conf.
The hosts line of /etc/nsswitch.conf should look something like this:
hosts: files nisplus nis dns
However, the exact contents will vary due to your environment. You should compare against working hosts and make changes accordi... | Why does SSH not consult /etc/hosts? |
1,301,653,026,000 |
What's the best way to confirm that your /etc/hosts file is mapping a hostname to the correct IP address?
Using a tool like dig queries an external DNS directly, bypassing the hosts file.
|
I tried this out and it seems to work as expected:
echo "1.2.3.4 facebook.com" >> /etc/hosts
Then I ran:
$ getent ahosts facebook.com
1.2.3.4 STREAM facebook.com
1.2.3.4 DGRAM
1.2.3.4 RA
| How to test /etc/hosts |
1,301,653,026,000 |
Possible Duplicate:
Can I create a user-specific hosts file to complement /etc/hosts?
In short: I would like to know if it is possible to get a ~/hosts file that could override the /etc/hosts file, since I don't have any privileged access.
A machine I am working on does seem to be properly configured with a correc... |
Beside the LD_PRELOAD tricks. A simple alternative if you're not using nscd is to copy libnss_files.so to some location of your own like:
mkdir -p -- ~/lib &&
cp /lib/x86_64-linux-gnu/libnss_files.so.2 ~/lib
Binary-edit the copy to replace /etc/hosts in there to something the same length like /tmp/hosts.
perl -pi -e ... | How can I override the /etc/hosts file at user level? [duplicate] |
1,301,653,026,000 |
The HOSTALIASES environment variable allows users to set their own host aliases instead of having to sudoedit /etc/hosts (more details, e.g., at http://blog.tremily.us/posts/HOSTALIASES/)
However, with /etc/hosts I can alias IP addresses to names and names to names, whereas HOSTALIASES only seems to work with name to ... |
HOSTALIASES feature is provided by the resolver funtion gethostbyname() in glibc. In this function an alias look up result is passed as-is to subsequent libnss module calls specified by hosts: in /etc/nsswitch.conf, therefore if there's no module which can handle it, gethostbyname() will end up with failure.
Note tha... | Hostaliases file with an IP address |
1,301,653,026,000 |
I am trying to make a productivity suite for myself. My first goal is to block Facebook, Gmail and Stackexchange from 0900 to 1600.
As of now, I have edited my /etc/hosts and added 0.0.0.0 www.facebook.com and similar ones for gmail and stackexchange.
But I am a little confused about how to include the blocking durat... |
Use cron.
Say crontab -e as root — or sudo crontab -e if you have sudo set up — and put the following in the file that comes up in the text editor:
0 9 * * * cp /etc/hosts_worktime /etc/hosts
0 16 * * * cp /etc/hosts_playtime /etc/hosts
This says that on the zeroth minute of the 9th and 16th hours of every day of th... | Two different /etc/hosts depending upon the time |
1,301,653,026,000 |
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 address had changed.
It costs extra for a "static", or even static, IP address? I would settle for semi-permanent. Elas... |
The main difference between the two is that:
You will lose your Public IP when you Stop and Start the instance, while the EIP remains linked to the instance even after the Stop/Start operation (or until you don't explicitly detach it from the instance)
Concerning the costs, there's no recurring fee you will pay ... | How is an Elastic IP address different from a static IP address? |
1,301,653,026,000 |
With getent hosts localhost, I only get ::1, although I expect 127.0.0.1. I have IPv6 disabled, so getting ::1 is even more surprising. To add to the confusion, when I ping localhost, pings are sent to 127.0.0.1 which works. Can someone explain this?
~: getent hosts localhost
::1 localhost
~: grep 'hosts:... |
Finding this wasn't easy (but fun :)).
Short answer
gethostbyname2(), which uses __lookup_name(), has some hard-coded values for the loopback ('lo') interface. When you specify 'localhost' to the 'getent hosts' command it ends up using the default value for IPv6 before it tries IPv4, thus you end up with ::1. You can ... | Why does localhost resolve to ::1 but not 127.0.0.1 |
1,301,653,026,000 |
I can parse the /etc/passwd with augtool:
myuser=bob
usershome=`augtool -L -A --transform "Passwd incl /etc/passwd" print "/files/etc/passwd/$myuser/home" | sed -En 's/\/.* = (.*)/\1/p'`
...but it seems a little too convoluted.
Is there any simple, dedicated tool for displaying users'home (like usermod can be used t... |
You should never parse /etc/passwd directly. You might be on a system with remote users, in which case they won't be in /etc/passwd. The /etc/passwd file might be somewhere else. Etc.
If you need direct access to the user database, use getent.
$ getent passwd phemmer
phemmer:*:1000:4:phemmer:/home/phemmer:/bin/zsh
$ ... | What is the reliable way of getting each user's .ssh directory from bash? |
1,301,653,026,000 |
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 | scp | telnet command autocompletion in zsh shell ?
Update 1:
https://github.com/sunlei/zsh-ssh : This SSH completion o... |
Zsh won't offer you host completions until you enable its full completion system. You can do so by adding the following to your .zshrc file:
autoload -Uz compinit
compinit
Once initialized, Zsh's completion system will retrieve host names from /etc/hosts, /etc/ssh/ssh_known_hosts, ~/.ssh/known_hosts and Host .../Name... | bash like autocompletion for ssh command in zsh shell with /etc/hosts file? |
1,301,653,026,000 |
On my local DHCP network I have different PC's that I need to access remotely. Problem is that their IP's change. Sometimes I plug my laptop and netbook into other people's DHCP networks.
My current solution is to update the /etc/hosts file every time the target IP's change.
My /etc/hosts file looks like this:
# <ip-... |
It depends on what is doing the DHCP?
Most home routers use dnsmasq and you can use that as your local DNS server. You just need to set dnsmasq to return itself as the DNS server. Next, you need to make sure that your PCs broadcast a hostname during the DHCP request.
Then, voila, you should be able to resolve all you... | Maintaining `/etc/hosts` for hosts on DHCP |
1,301,653,026,000 |
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 file for this machine (currently running Debian lenny) currently looks like
127.0.0.1 machinename.domain machinenam... |
On my system, I have the following in /var/lib/dpkg/info/netbase.postinst:
create_hosts_file() {
if [ -e /etc/hosts ]; then return 0; fi
cat > /etc/hosts <<-EOF
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ... | /etc/hosts for Debian |
1,301,653,026,000 |
I use a hosts file to block ads/malware domains. When I use ssh or scp in zsh and try to tab-complete, it takes a good 5-10 seconds before anything appears and what does appear is usually a list of 20+ domains I have blocked, and buried in there is the file I need.
I've search online quite a bit, and found helpful hin... |
Try adding the following to your zshrc
zstyle ':completion:*' hosts off
| ignore hosts file in ZSH ssh/scp tab-complete |
1,301,653,026,000 |
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 ns3285243 postfix/smtpd[1606]: connect from localhost.localdomain[127.0.0.1]
May 9 09:33:58 ns3285243 postfix/smtpd[1606]: 1EF... |
From comment:
The problem in this case is that the domain has not been marked as active, so when mysql is queried for active domains this one is not returned.
| Postfix email bounced (mail for domain loops back to myself) |
1,301,653,026,000 |
I would like to set one IP for a zone (livejournal.com)
currently I am having to directly type the subdomains like:
11.11.11.11 sub1.livejournal.com
11.11.11.11 sub2.livejournal.com
11.11.11.11 sub3.livejournal.com
etc.
I tried
11.11.11.11 *.livejournal.com
and
11.11.11.11 .livejournal.com
didn't help.
So I want to... |
This can be implemented with a DNS forwarder than acts like a very basic DNS server. The popular implementation is Dnsmaq, however this might be possible with services like OpenDNS that can perform DNS filtering for you.
| /etc/hosts file syntax. Is it possible to set one IP for a zone? |
1,301,653,026,000 |
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 hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allr... |
/etc/hosts can be used if you want to map a specific DNS name to a different IP address than it really has, but if the IP address is already specified by the application, that and any other techniques based on manipulating hostname resolution will be useless: the application already has a perfectly good IP address to ... | How to map an IP address to localhost |
1,301,653,026,000 |
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.0 216.58.212.68, will it block connections to that website? Would a web browser be blocked from visiting it too?
Addit... |
No. The hosts file doesn't affect any routing. It only affects name lookups. Since 216.58.212.68 is an IP address, the system won't look it up in the hosts table.
Read here for more info on the hosts file: http://manpages.ubuntu.com/manpages/trusty/man5/hosts.5.html
If you want to block connections to an IP address ... | Ubuntu /etc/hosts addresses in the form *.*.*.* |
1,301,653,026,000 |
If I want to add an entry to /etc/hosts to resolve all traffic for example.com to 1.2.3.4, do I need to add
1.2.3.4 example.com
1.2.3.4 www.example.com
1.2.3.4 smtp.example.com
1.2.3.4 pop.example.com
...
Or will just adding
1.2.3.4 example.com
suffice?
|
You will need to specify each and every subdomain. If that is not what you want, you should look into installing a real DNS server (e.g. bind9).
This is rather easy to check by first adding just example.com to /etc/hosts and then do
ping -c 2 example.com
ping -c 2 www.example.com
The first will succeed with the prov... | Should /etc/hosts contain the domain name or the FQDN? |
1,301,653,026,000 |
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 to fix them because my normal account doesn't have permissions.
What's the best way to fix the hosts?
|
You don't need sudo to fix that, try pkexec,
pkexec nano /etc/hosts
pkexec nano /etc/hostname
After running pkexec nano /etc/hosts, add your new hostname in the line that starts with 127.0.1.1 like below,
127.0.0.1 localhost
127.0.1.1 your-hostname
And also don't forget to add your hostname inside /etc/hostname ... | How to edit /etc/hosts without sudo? |
1,301,653,026,000 |
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/hosts files
I would like to know what's the difference between home IP adress (127.0.0.1) and a real IP address given by ... |
Question #1
I would like to know what's the difference between home IP adress (127.0.0.1) and a real IP address given by the network in /etc/hosts
2 key characteristics of 127.0.0.1:
It's not routable outside of your computer on the Internet.
The IP address 127.0.0.1 is part of a block of IP addresses that are asso... | how to configure /etc/hosts properly [duplicate] |
1,301,653,026,000 |
I have a Ubuntu Server 12.04 (amd64) machine on which, when I change /etc/hosts, the changes aren't picked up, even after a reboot. I am using /usr/bin/host to test, but none of the other programs seems to pick it up either.
This is a server and nscd and dnsmasq aren't installed. Also, the file /etc/nsswitch.conf cont... |
The host command doesn't check the hosts file. From the manpage:
host is a simple utility for performing DNS lookups.
If you want to test lookups while respecting the hosts file, then use ping or getent.
$ tail -1 /etc/hosts
127.0.0.1 google.com
$ ping -c1 google.com | head -1
PING google.com (127.0.0.1) 56(84) by... | /usr/bin/host not picking up changes to /etc/hosts even after reboot |
1,301,653,026,000 |
I have a computer with Debian at home, acting as a server with two Ethernet cards: eth0 connected to the router in DHCP mode and eth1 to a switch (static address) that holds four more computers.
I'm using the PC to be the gateway-firewall of the others. Since I only have four more PCs in the internal network, I don't ... |
That's because the /etc/hosts is simply a file on your Debian server that it utilizes for its own name resolution.
It doesn't use the file to provide any DNS services.
Since you don't want to set up BIND can I recommend that you look at dnsmasq instead?
It's lightweight and can act as a DNS and DHCP server, simply by... | How to make my server use the hosts file to resolve names? |
1,301,653,026,000 |
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?
|
Remove dns from hosts field in /etc/nsswitch.conf:
hosts: files
You might also want to remove the DNS servers from /etc/resolv.conf.
| Only use /etc/hosts for resolving hostnames on Linux |
1,301,653,026,000 |
I've been having a problem where when our vps provider decides to restart the server (running Debian 5.0.8), the server fails to remember changes to /etc/hosts. All I need is an database alias that is used for the web applications on the server which points to 127.0.0.1 (localhost).
I want it to look like this:
# The... |
Removing the #Auto-generated hostname line and then making the changes caused whatever was generating the host names to remember it now. Works for me but this may not work for everyone.
| /etc/hosts in debian resets itself on reboot |
1,301,653,026,000 |
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 directly connect to the server by adding the following line to /etc/hosts.
192.168.1.100 foo.dynu.com
However, is ther... |
As per @garethTheRed's suggestion in the comments, I created a Network Manager Dispatcher hook.
Create the following file at /etc/NetworkManager/dispatcher.d/99_foo.dynu.com.sh. This progresses when a new network connection is detected (i.e. ethernet or wifi). It then identifies my "home network" in two ways: the BSSI... | Can I map an internal IP address to a domain name, when on a particular network? |
1,301,653,026,000 |
I'm looking for a DRY solution that would allow me both
ssh server-alias
and
ping server-alias
I know the former is reading .ssh/config, and the latter /etc/hosts, but I'd rather not repeat the same aliases in both files. Is it a good idea to have a single source for both? If so, how can I accomplish it?
I can simp... |
Yes. There is no need to clutter your .ssh/config with Hostnames if all you want is tab expansion.
Entries in /etc/hosts will be sufficient.
.ssh/config is for specifying login names etc.
Maybe you should use wildcards in your hostnames in .ssh/config if you really want to specify connection details there at all.
http... | Single source for both .ssh/config and /etc/hosts |
1,301,653,026,000 |
A company I'm working in has a local site, with documentation and etc. where all references are set to "srv-moss" as a domain name, which should be defined in hosts file. I added it there but it doesn't seem to work. Even though I can ping srv-moss just fine, but attempts to open it in Firefox or Chromium results in S... |
If you are behind a proxy check that Firefox has that configured as well. I am behind a proxy and yes, I had to configure Firefox (when I used it) to connect to certain IPs (or aliases). Just insert the exception for srv-moss in the proper Network tab.
If your proxy configured via some kind of a system settings, then ... | Browsers doesn't see aliases in /etc/hosts |
1,396,511,032,000 |
How is 127.0.0.1 related to 127.0.0.2?
Using ssh to login to tleilax (OpenSuSE):
tleilax:~ #
tleilax:~ # hostname
tleilax
tleilax:~ #
tleilax:~ # hostname -f
tleilax.bounceme.net
tleilax:~ #
tleilax:~ # cat /etc/hosts
#
# hosts This file describes a number of hostname-to-address
# mappings for... |
your loopback devicelo is bound to the network 127/8 (aka 127.0.0.1/255.0.0.0), thus any address in the range 127.0.0.1 to 127.255.255.254 is your local loopback.
therefore, it doesn't matter whether you use 127.0.0.1 or 127.0.0.2.
the reason why they (Debian) chose the scheme they chose are explained in the Debian-re... | why are there different formats for the hosts file between OpenSuSE and Ubuntu? |
1,396,511,032,000 |
I'm being trolled by China, and don't know why I can't block their request to my server.
//host.deny
ALL: item.taobao.com
ALL: 117.25.128.*
But when I watch the error log on my webserver tail -f /var/log/apache2/error.log the requests are still being allowed through.
Question: Why isn't my /etc/hosts.deny config work... |
The file is called /etc/hosts.deny, not host.deny
Not all services use tcp-wrappers. sshd, for example, doesn't by default. Neither does apache.
You can use iptables to block all packets from 117.25.128/24, e.g.:
iptables -I INPUT -s 117.25.128.0/24 -j DROP
Even better, you can use fail2ban to monitor a log file ... | Editing my /etc/hosts.deny |
1,396,511,032,000 |
I'm very new in bash scripting and unix so I will need some help on this.I have 7-10 hosts which I want to ping from one of the servers via cronjobs. What I want is when host is up to execute command on it. When is down do nothing.
I don't want logs or any messages.
So far I have this and unfortunately don't have abi... |
I've made some comments in line to explain what different parts of the script are doing. I've then made a concise version of the script below.
#!/bin/bash
servers=( "1.1.1.1" "2.2.2.2" "3.3.3.3" "4.4.4.4" "5.5.5.5" "6.6.6.6" "7.7.7.7" )
# As is, this bit doesn't do anything. It just pings each server one time
# bu... | Ping multiple hosts and execute command |
1,396,511,032,000 |
I am trying to capture some IP packets in my personal LAN with tcpdump, through the command
tcpdump -A -i eth0 'tcp and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0) and host 192.168.1.x'
where 192.168.1.x is the target host in the network. But it works only if the target host is my ip, that is the IP o... |
That's probably because a switch only sends traffic down a port if it believes the destination MAC address is attached to that port.
On a managed switch, you'd set up monitor mode.
On an unmanaged switch, you're left with a couple of options:
ARP spoofing, to trick the rest of the network about which MAC address corr... | tcpdump command works only on local ip |
1,396,511,032,000 |
I'd like to have my system automatically take me to https://facebook.com even if I put http://facebook.com into my browser. I can get /etc/hosts to redirect to me to different domains, but it seems to ignore it if I put https:// into it.
This works, and it redirects facebook.com to google.com:
74.125.95.103 facebo... |
No, it is not possible using iptables.
If you used it to redirect port 80 to port 443, your browser would still speak to it using http rather than https, and all you would get is garbage.
Maybe something using a Squid proxy would work. You could make it a transparent proxy if you can't change everyone's proxy setting... | Using /etc/hosts or iptables to redirect site to https:// version |
1,396,511,032,000 |
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-loopback ip6-localhost
I accidentally pressed Super_L+Space today when typing in bash, which immediately presented me someth... |
It's Konsole-specific feature introduced in commit 5ba34471
back in 2012.
Reference: this Super User
question
A short summary of the mechanism as originally described in the linked Super User question is as follows:
Super_L+letter in Konsole sends ^X@s<letter>.
The first part is "translated" into "possible-hostname-c... | Why is bash listing the effective content of /etc/hosts if I press Super_L+Space? |
1,396,511,032,000 |
We have a Debian 8.2 system foo provided by our IT department for production. Its /etc/hosts file contains these two lines:
127.0.0.1 localhost
127.0.1.1 foo.example.com foo
This maps the FQDN of the system to 127.0.1.1, while the real IP address of the system is 10.5.1.38 (which is not given in hosts)... |
I regard this as a bad practice, I have seen developers doing that. While it can be used in testing environments, I do not recommend using it in production environments.
By definition, the kernel has a very defined behaviour for the localhost.
There could be also problems too, I do remember having a service opened to... | Should /etc/hosts contain an entry for the FQDN that maps to a loopback address? [closed] |
1,396,511,032,000 |
I'm running a CentOS server (7.0) and I'd like to login via sshd as a user, not root. So I set PermitRootLogin no in the config file and su - after login. I've received lots of hacking activities and I decided to allow only one user to login via sshd. Since the username is not my real name or any common name, I think ... |
I don't think it is possible to do what you are asking. If you could, someone could "brute force" to find valid usernames on your server. I am also pretty sure that the username and the password are sent simultaneously by the client, you could verify this by capturing packets using Wireshark on an unencrypted SSH conn... | allow only specific users to login via sshd, but refuse connect to non-listed users |
1,396,511,032,000 |
I am setting up a RHEL-based server that is associated with dynamic DNS from DynDNS, with a domain of, say, "abc.dyndns.org" that is dynamically updated with the server's IP address.
I have read that in order to ensure access to your server's services, you need to have at least the following in your /etc/hosts:
127.0... |
Some context:
When a program asks your machine to resolve a hostname into a IP address it looks into your /etc/hosts and, if not found, it then makes a DNS query.
You don't need to keep a non-loopback IP address on it. You can just usually keep the localhost entries and an alias.
See, that's my /etc/hosts contents:
[... | Hosts file on server with dynamic DNS? |
1,396,511,032,000 |
I'm having trouble using the r-commands between my servers to do a tape backup. I've been making changes in the .rhosts file, but I'm not sure if the OS reads that file everytime it's called, or just when it's booted, or some other time.
After I modify the .rhosts file, do I need to do anything to then have it be use... |
The .rhosts file is read by the daemon (rshd or rlogind or sshd) at each login attempt. (Since ordinary users can edit their .rhosts file whenever they want, it wouldn't make sense to require root to restart the daemon.)
Make sure that the .rhosts file doesn't contain Windows line ending, and that it has proper permis... | rhosts changes and re-initializing |
1,396,511,032,000 |
I have following line in my /etc/hosts.allow
sshd: 1.2.3.4 : spawn (echo `date` ALLOWED from %a >> /var/log/%d.log) &
The problem is, the date command prints time in the standard format, such as
Thu May 16 15:54:55 CEST 2013
which is complicated to process with my script. I would like to have date to specify my own... |
Double the percent sign, and it should work:
sshd: 1.2.3.4 : spawn (echo `date "+%%F %%T"` ALLOWED from %a >> /var/log/%d.log) &
For more information, see the "% Expansion" section of the corresponding man page (hosts_access(5)).
| date format in /etc/hosts.allow |
1,396,511,032,000 |
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 porter
...
Everything works fine but I'm curious about the "127.0.1.1 debian" part, should I keep it or rename it... |
The Debian Installer creates this entry for a system without a permanent IP address as a workaround for some software (e.g., GNOME)
For a system with a permanent IP address, that permanent IP address should be used here instead of 127.0.1.1
here is the complete document
| What is the purpose of the 127.0.1.1 entry in /etc/hosts? |
1,396,511,032,000 |
Is there some de-facto way for rewriting certain hostnames to other ones? Something like /etc/hosts for host to host instead of ip to host. Is this possible or should I create a local dns cname for that host?
Update regarding the comments
I want to use the local name that resolves to remote domain. The browser is just... |
DNS CNAMEs would be the de-facto way to do this.
Edit: In light of comments below...
I don't think you'll be able to do what you are trying to do. You're trying to trick the browser or some other program into thinking something is an address it's not. The problem is that something is also going pass the name of the re... | Local DNS rewrite from host to host for web requests |
1,396,511,032,000 |
I'd like to add shorthands for various FQDNs into the /etc/hosts file, such as:
pyrrha.compsci.university.org. pyrrha
Is there a way to force the local DNS resolver to process the /etc/hosts entries recursively?
Why? Inserting full FQDNs into every config file feels redundant. Creating an alias in a central location ... |
resolv.conf allows you to specify searchdomains. An entry like the following:
search cse.iitb.ac.in it.iitb.ac.in iitb.ac.in
Allows me to:
$ ping -c1 www
PING www.cse.iitb.ac.in (10.105.1.3) 56(84) bytes of data.
64 bytes from cse.iitb.ac.in (10.105.1.3): icmp_seq=1 ttl=64 time=0.803 ms
--- www.cse.iitb.ac.in ping ... | Adding recursive entries into `/etc/hosts` |
1,396,511,032,000 |
Assume I have a VM running on OSX with private IP 10.0.0.1 which can be accessed from the host machine.
I was wondering how can I map a pseudo domain, *.app.dev, to the private IP on my host machine so that on my host machine I can resolve the domain *.app.dev to 10.0.0.1.
The purpose of this setup is to have virtual ... |
You can do this with dnsmasq.
Dnsmasq is a very small DNS server usually used as a proxy. It offers a lot of ways to manipulate DNS lookups, one of which is to respond to all DNS queries for a domain with a single IP.
The example dnsmasq.conf file has specific example for this:
# Add domains which you want to force to... | Resolving pseudo domain name to private IP |
1,396,511,032,000 |
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 file, but it didn't work:
0wikipedia.org wikipedia.org
en.0wikipedia.org en.wikipedia.org
Any suggestions please?
|
Yes it is, but it's not the best way. I would look into browser extensions for redirecting requests.
Here is how to do it on the network layer:
You need to use a hosts file with one entry per subdomain (or a dns-server with wildcards), like this:
127.0.0.1 en.wikipedia.org
Then you run a webserver on localhost, whic... | Is it possible to redirect all wikipedia urls to wikipedia zero via hosts file? |
1,396,511,032,000 |
I was trying for few hours to make my custom script work when using hosts.allow/hosts.deny, to prevent connections to SSH and other services supporting TCP wrappers from unlisted countries.
Example with SSH:
hosts.deny file
sshd : ALL
hosts.allow file
sshd: ALL: spawn /usr/local/bin/country_filter %h
country_filter s... |
As documented in the hosts_options(5) man page, the standard output is redirected to /dev/null, so that there's no chance for you to get the output from echo. And as you want the exit status to be taken into account, you should use aclexec instead of spawn. Indeed the man page says for aclexec: "The connection will be... | Reject SSH connections from unlisted countries, using hosts.allow/hosts.deny on CentOS |
1,396,511,032,000 |
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.0.0.1:443); why does this happen and how to block connections destined to 0.0.0.0 ?
UPDATE2: I've found a way to block ... |
Why this happens is explained in Connecting to IP 0.0.0.0 succeeds. How? Why? — in short, packets with no destination address (0.0.0.0) have their source address copied into their destination address, and packets with no source or destination have their source and destination addresses set to the loopback address (INA... | Why accessing 0.0.0.0:443 gets redirected to 127.0.0.1:443 on Linux and how to disallow it? |
1,396,511,032,000 |
To clean out my custom hosts file and remove dead domains on Windows I ping the hosts from domains.txt, and if I get a reply I add that host to result.txt:
@echo off
>result.txt (
for /f %%i in (domain.txt) do ping -n 1 %%i >nul && echo 127.0.0.1 %%i
)
Can anyone help me to implement the same functionality via a... |
Funceble https://github.com/funilrys/funceble is the best tool which i recommend using today.
$ ./funceble -f domain.txt
Domain Status Expiration Date Source Analyse Date
------------------------------------------- ----------- ----------------- ---------- ------... | Ping a host, check if alive or not, and send result to file via a shell script |
1,396,511,032,000 |
What if one host is defined in /etc/hosts like:
192.168.0.100 server
and one is defined in ~/.ssh/config like:
Host server
HostName 192.168.0.101
and you ssh into server: ssh server.
How would such a conflict be resolved? I guess one has higher priority than the other.
|
If you do ssh server the server part could be a real host name or some ssh internal "nickname". ssh first looks for some nickname in .ssh/config, if it finds a configuration there it will use this. If it does not find a configuration it assumes a real hostname and tries to resolve it via /etc/host and dns.
| What will be prioritized in a conflict between ~/.ssh/config hostname and /etc/hosts? |
1,396,511,032,000 |
I have a text file, modifyhostslist.txt, which contains entries that correspond to entries found in my hosts file. Not every entry in my hosts file needs to be modified, only entries also found in modifyhostslist.txt.
The entries found in modifyhostslist.txt are to be commented out in the hosts file.
Sample line (entr... |
You used the command:
while read line; do
sed -i 's/'"$line"'/#%%#'"$line"'/' /system/etc/hosts;
done < modifyhostslist.txt
As long as the lines in modifyhostslist.txt match the lines in /system/etc/hosts, that command really should work.
If the lines look identical to the eye but the command still does not work... | Sed to Modfiy Hosts File |
1,396,511,032,000 |
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 temporarily add such IP -> hostname mapping on the commandline, without actually editing the file?
Lets suppose I connect... |
The hostname resolution service of the C library (which is used by almost all software that needs hostname resolution) is controlled primarily by the hosts: line in the /etc/nsswitch.conf file. Each keyword on that line causes the corresponding libnss_*.so library to be loaded, and those libraries will ultimately hand... | associate IP with hostname without editing /etc/hosts |
1,396,511,032,000 |
I puchased a domain, say fireworks.com, and I would like to call my server ubuntu-18-04. How am I expected to edit /etc/hosts?
Is it possible to add multiple aliases as follows?
127.0.0.1 localhost
127.0.1.1 ubuntu-18-04.fireworks.com fireworks.com ubuntu-18-04
5.247.221.66 ubuntu-18-04.fireworks.com fireworks.co... |
From man hosts:
This manual page describes the format of the /etc/hosts file. This
file is a simple text file that associates IP addresses with
hostnames, one line per IP address. For each host a single line
should be present with the following information:
IP_address canonical_... | /etc/hosts and aliases |
1,396,511,032,000 |
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 I change my hostname, and I am trying to figure out why this is the case.
I change the hostname with following command:... |
Unlike the hostname -I command, which just lists all configured IP addresses on all network interfaces, the hostname -i command performs name resolution (see the hostname man page).
Since your newly assigned hostname cannot be resolved using the /etc/hosts file, running hostname -i will cause your system's name resol... | Understanding why hostname -i returns strange IP address |
1,556,108,912,000 |
I need to know if there is a web browser using its own "hosts" file or simply ignoring the "hosts" file from OS.
UPDATE 1: This is the situation:
certain program requires certain URL for validation : not wanted
I need that URL for getting help : wanted
I tested with Firefox, Chromium, Vivaldi, Midori, and all of th... |
I do not know if there is browser based utility to do this. But you can do it for the entire OS. The key file is /etc/nsswitch.conf. To support only DNS records you should have record inside like:
hosts: DNS
if you need to have /etc/hosts and the file have precedence over DNS you need to have record like:
hosts: file... | How to ignore hosts file? [closed] |
1,556,108,912,000 |
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 hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. D... |
macOS has a DNS cache, and if the IP addresses of the problem sites are already in your DNS cache, editing /etc/hosts won't have an immediate effect.
The procedure for flushing the DNS cache is annoyingly version-dependent:
https://help.dreamhost.com/hc/en-us/articles/214981288-Flushing-your-DNS-cache-in-Mac-OS-X-and-... | /etc/hosts not blocking anything |
1,556,108,912,000 |
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 don't want to use the IP as it will likely change and I'll have to update /etc/hosts again.
Instead I point directly to th... |
Is there anyway to set a host to url? E.g. something like the following in /etc/hosts
That is not a URL. Its a hostname. The point of the /etc/hosts file is that it provides an alternative to DNS for resolving hostnames to addresses.
The files nameservice (the bit of code that sits between your application and the /... | Set a host name alias in /etc/hosts? |
1,556,108,912,000 |
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 Provider.
I would like to refer to exthost using always its name, and mapping this name to its actual IP address, according ... |
There is no such thing as a user defined hosts file on Linux, you can use HOSTALIASES which works with canonical names.
If I got your question correctly you can use a dynamic DNS service like DynDNS or No-IP to always have a correct public IP address your ISP assigned.
You can then use HOSTSALIASES to map exthost to F... | Use reference to file instead of IP in /etc/hosts |
1,556,108,912,000 |
I've added a few hostnames in /etc/hosts to resolve to my LXD container:
$ less /etc/hosts
127.0.0.1 localhost
127.0.1.1 HOST
lemh 10.0.3.219
pma.lemh 10.0.3.219
wp.lemh 10.0.3.219
But ping, getent ahosts or Firefox cannot resolve them. I don't want to restart right now.
I've tri... |
in /etc/hosts you have to write:
ip alias
so the correct form is:
127.0.0.1 localhost
127.0.1.1 HOST
10.0.3.219 lemh pma.lemh wp.lemh
| Custom hostnames on /etc/hosts not resolved |
1,556,108,912,000 |
I need to use the a custom URL name which is accessible from all devices in a LAN.
I know that it can be set in the /etc/hosts file
127.0.0.1 myname
127.0.1.1 system09-System-Product-Name
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6... |
Localhost as its name says can only be accessed from your local system.
If you need other users to access yout custom URL you need to map your system IP address with the name used and then add this entry on all your LAN workstations by editing theirs /etc/hosts files for example:
127.0.0.1 <custom_name> # this... | How to change the name of localhost to a custom name which is available to other users in LAN |
1,556,108,912,000 |
I am using /etc/host to map localhost to a web domain. I would like a fast way of doing this rather than searching and replacing every time. I put this in my .bashrc file.
alias hostchange='
nowdir=$PWD;
cd /etc;
mv hosts hoststempname;
mv hostssecondary hosts;
mv hoststempname hostssecondary;
cd $nowdir'
I am gettin... |
You are on the right track! A couple comments about this. It is usually better practice to leave multi-line actions like this to functions. I'd probably write it like this:
change_etc_hosts_file() {
set -e # stop running if we encounter an error
sudo \mv -f /etc/hosts /etc/hoststempname
sudo \mv -f /etc/hosts... | Simple command that switches between two host files |
1,556,108,912,000 |
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.net +short | tail -n1
Step 2: Form the obtained IP address and domain name into a line that looks like this.
23.1.236.106... |
One way to do that is basically replacing the old ip with the new one:
$ cat /root/test.sh
#!/bin/sh
current_ip=$(awk '/liveproduseast.akamaized.net/ {print $1}' /etc/hosts)
new_ip=$(dig @8.8.8.8 liveproduseast.akamaized.net +short | tail -n1 | grep '^[.0-9]*$')
[[ -z $new_ip ]] && exit
if sed "s/$current_ip/$new_i... | How do I write dig output to /etc/hosts file? |
1,556,108,912,000 |
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 gets different webpages. Shouldn't all hostnames return the same webpage? Because my understanding(may be very wrong) i... |
Web servers see the host header (IE the website name) that the browser is attempting to contact. The host header is sent regardless of how the IP was resolved. A single web server can host multiple sites on a single IP and thus uses the host header to determine which site/content to respond with.
| Why adding hostnames to /etc/hosts entries change the website viewed |
1,556,108,912,000 |
My question is similar but opposite to to Telnetting the Local port not working but trying the ip working
For me, telnet to the local port works but trying with IP does not work :(
I am running pgbouncer on port 6432:
$ telnet 192.x.x.x 6432
Trying 192.x.x.x...
telnet: Unable to connect to remote host: Connection refu... |
A quick Google shows that recommended safe configurations for pgbouncer often set up the listening port only on the loopback interface (localhost). Here is one example:
[pgbouncer]
listen_port = 5433
listen_addr = localhost
auth_type = any
logfile = pgbouncer.log
pidfile = pgbouncer.pid
The configuration documentatio... | Telnetting the local port working but trying with ip not working |
1,556,108,912,000 |
If you have a list of servers all linking to each other by static addresses, is there some kind of hosts.additional you can use as some kind of file based DNS?
ie The hosts file contains static information and the hosts.additional contains the address which change regularly.
|
No, there's only one /etc/hosts. You could rebuild it with a cron entry every so often, perhaps by downloading it from a central server which you can update. rsync will do the work for you. Of course, this assumes you have a good reason to avoid setting up DNS.
| Is there some kind kind of hosts.additional file for Linux |
1,556,108,912,000 |
I have my inventory file configured with group variables. Example:
all:
children:
europe:
vars:
network_id: 3
network_name: "europe-eu"
hosts:
europe-eu-1254:
ansible_host: 8.8.8.8
ansible_ssh_pass: password
ansible_ssh_user: user
...
I would lik... |
Simply reference the variables. For example the playbook
shell> cat playbook.yml
- hosts: all
tasks:
- debug:
var: network_name
- debug:
msg: "{{ network_name }}"
gives (abridged)
shell> ansible-playbook playbook.yml
ok: [europe-eu-1254] => {
"network_name": "europe-eu"
}
ok: [europe-eu... | Ansible - Access group variables in tasks |
1,556,108,912,000 |
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 (127.0.0.1): icmp_seq=1 ttl=64 time=0.031 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.020 ms
Sometim... |
This was caused by having only 4096 inotify handlers. I've increased the limits and the issue is gone.
fs.file-max = 131070
fs.inotify.max_user_watches = 65536
| Unable to resolve entry in hosts file? |
1,556,108,912,000 |
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 accounts using Oauth2 anymore, and the BBC Weather widget broke as well. It's very clear to me that these have been cause... |
"It would be of much use to me if there was a way to know which server/website exactly an application is failing to connect to."
Unfortunately we can't guess, so you'll have to find out for yourself. What you'd want to do is see where the packets go. So, open up Wireshark or an alternative and attempt to access a webs... | How to see which website an app is trying to access? |
1,556,108,912,000 |
I have deployed a CentOS 6.6 VM (hortonwoks sandbox VM) on my Windows 7 OS. The VM publishes apache spark applications through a http url. The url's have the hostname as "sandbox.hortonworks.com" (e.g.http://sandbox.hortonworks.com:8088/proxy/application_1430918431488_0001/). All the port forwarding is set up and is w... |
The address 10.0.2.15 is a internal address for your VM which can not be reached from the Host OS because of the NAT mode.
You need to change your network adapter to use bridged mode or host-only-adapter.
In bridged mode the guest will try to get an address in the host network and using host-only-adapter you will crea... | Adding alias in /etc/hosts for Linux OVM |
1,556,108,912,000 |
how do I set the hostname, FQDN, in yast?
I ran yast => network devices => network services => hostname/DNS:
YaST2 - lan @ arrakis
Network Settings
┌Global Options──Overview──Hostname/DNS──Routing──────────────────────────────────────... |
In order for your changes to be visible in your current shell you need to terminate the current session and log back in. Your hostname will have changed to arakis.
Explanation: a terminal session needs to be closed and re-opened for the profile to be re-read.
| how do I set a hostname in yast? |
1,556,108,912,000 |
I want to deny access to a specific URL. It isn't a whole website, it's a specific URL. I want to do it simply so that some applications including browsers can't make requests for it. I tried this:
$ cat /etc/hosts
127.0.0.1 http://url_to_block/url_to_block2/url_to_block3
but it didn't help me, for example, in th... |
The file /etc/hosts is only for mapping hostnames with IP addresses, not for URLs. There isn't any method that I'm aware which will allow you to do this across the board for all applications (that's built into a typical Linux distro), but you have a couple of options that will allow you to do it either per browser, vi... | Block a certain URL? |
1,556,108,912,000 |
I'm running dropbear as SSH daemon on Debian (actually Raspbian). I tried setting
# /etc/hosts.allow
dropbear:192.168.1.1
# my static ip from which I SSH connect to the device
and
# /etc/hosts.deny
ALL:ALL
# block all others
Then I restarted the whole device. I could still SSH into the device from different IP addre... |
Dropbear doesn't include any support for /etc/hosts.allow and /etc/hosts.deny. These files are managed by the TCP wrapper library (libwrap), which Dropbear doesn't use. Some third-party packages patch Dropbear for TCP wrapper support, but not Debian.
You can start Dropbear via tcpd to get TCP wrapper support.
/usr/sbi... | Does dropbear take care of hosts.allow and hosts.deny? |
1,556,108,912,000 |
There seem to be more questions like this, excuse me if this is similar. I want to redirect to an IP address om my server computer.
This is what I put in my hosts file on the client computer (IMac):
192.168.3.2:8080. dev.dev
It does not resolve to that IP address. Should this normally work, or do I have to do extra t... |
You do not specify the port in a hosts file. The hosts file expects IP and hostname on each line. Try removing the port, as well as the dot after the IP that I also see in your entry.
e.g.
192.168.3.2 dev
then try http://dev:8080 in your browser to get to that host:port. You may need to flush the cache on your ... | Directing hostname to another computer within lan using hosts file |
1,556,108,912,000 |
I changed the name of the hosts in /etc/hosts to
IP.GOES.HERE newname
Apache does recognize the new server name; but still, via ssh i get this on the ssh prompt:
[root@oldname]
Why? Where else do I need to change the server name?
I'm using CentOS 6.3
|
On CentOS you set the system hostname in /etc/sysconfig/network.
This setting change takes effect on reboot. To change the hostname on a running system without rebooting use the hostname command.
| Changing the server name |
1,556,108,912,000 |
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 only fix by restarting the NetworkManager service:
systemctl restart NetworkManager
For example:
$ ssh example.mydomain
... |
mdns4_minimal [NOTFOUND=return] is needed for multicast DNS for the Epson printer.
resolve [!UNAVAIL=return] enables name resolution through systemd-resolved (see https://www.freedesktop.org/software/systemd/man/nss-resolve.html).
If the command systemctl status systemd-resolved gives back Unit systemd-resolved.servic... | Random DNS errors after change to nsswitch.conf |
1,556,108,912,000 |
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/lib/libcurl-gnutls.so.4: no version information available (required by spotify)
/opt/spotify/spotify: /usr/lib/libcurl-g... |
This problem can be hopefully solved with one of these three steps:
1) Add spotify servers to hosts
You have to add this
0.0.0.0 weblb-wg.gslb.spotify.com
0.0.0.0 prod.b.ssl.us-eu.fastlylb.net
to /etc/hosts
2) Disable notifications
Sometime spotify get stuck while trying to make notification and stop loading stuff. Y... | Arch linux: spotify stuck offiline |
1,556,108,912,000 |
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 make changes according to last and auth.log.
Thanks, Tmanok.
|
In this very specific instance, I had installed features from FreeNAS for additional server management, unfortunately it included a configuration database that I was not anticipating. Every reboot clears CLI configuration, basically a backup of the configuration exists on the machine which overrites any changes to exi... | Hosts.deny on FreeBSD suddenly empty? |
1,410,012,509,000 |
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 changes to the master file in /etc/cloud/templates/hosts.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#... |
The format of lines in /etc/hosts is address first and name(s) second
0.0.0.0 node1
0.0.0.0 node2
192.168.1.1 myroutermaybe
8.8.8.8 googledns # in case DNS doesn't work for DNS???
127.0.0.1 localhost
or where several names map to the same address
0.0.0.0 node1 node2 node3 stitch626
ADDED, thanks to reminder by f... | Why is my /etc/hosts file not being read? |
1,410,012,509,000 |
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 first part (IP address) to so that any attempted connection to this myhostname will always fail?
Edit: By fail, I mean a... |
So you want an IP address that a) is guaranteed not to match anything remote and b) will reject everything.
Make one:
iptables -I INPUT 1 -i lo -d 127.66.66.66 -p tcp -j REJECT --reject-with tcp-reset
iptables -I INPUT 2 -i lo -d 127.66.66.66 -j REJECT
(or whatever is the equivalent for your iptables firewall managem... | IP address in /etc/hosts that will always fail? |
1,410,012,509,000 |
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 default search engine (the case with badwolf browser).
Aliases work when prepended with http://, e.g.
http://bse but having ... |
Yes, your browser well send a Host header, and in the case of HTTPS access, additonally use SNI, to tell the server which site it wants to access. This is of course nothing unusual - a single server can serve any number of websites on any number of hosts, so it needs to know which one you're trying to access. The IP ... | Why do I get different browser behaviour when attempting to reach bitcoin.stackexchange.com and the alias of its IP in /etc/hosts? |
1,410,012,509,000 |
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.12 host-a
192.168.10.12 a.com
What happened if i do not use aliases ?
|
For the /etc/hosts file these two alternatives are equivalent when resolving an address for a name. In both cases the names host-a and a.com will be resolved as the name host-a with address 192.168.10.12.
For a reverse lookup of name from IP address the two alternatives are slightly different. Both will return host-a ... | /etc/hosts alias or multiple record |
1,410,012,509,000 |
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 access an external executable file.
For example, adding an entry like 12.34.56.78 legitsite.com, then the next time I vis... |
There's nothing you can do if some other party has the root privileges to modify name resolution. That means they can already mess with all your software. You've lost. Nothing you can do on your machine could be suppressed by that almighty attacker.
But: the appropriate response to the possibility that someone was abl... | Is checking /etc/hosts and /etc/resolv.conf sufficient to know that no server is trying to falsely represent itself as another? |
1,410,012,509,000 |
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 whereis looking for a binary named hosts but whereis outputs filenames like /etc/hosts.allow and /etc/hosts.deny. I was unde... |
There's no specific program that parses this file.
A number of standard files (e.g. /etc/hosts) are parsed by standard library files (e.g. gethostbyname(3)). However the story may be a lot more complicated.
Hostname resolution is typically controlled by an entry in /etc/nsswitch.conf.
e.g.
% grep hosts /etc/nsswitch.... | program/application or script that reads /etc/hosts |
1,410,012,509,000 |
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 clusterdb.res. I know this because I originally got an error when trying to start clusterdb.res if node1 didn't resolve correct... |
You're not using the drbdadm command correctly. It wants the resource name, where you're giving it a node name.
Try this instead (from node1):
drbdadm up clusterdb
drbdadm primary --force clusterdb
As a side note, DRBD expects the hostnames in its config to be the same as uname -n.
| DRBD - 'node1' not defined in your config (for this host) - Error when setting Primary |
1,410,012,509,000 |
I was told today that /etc/hosts is not a viable option for testing a new destination server. The DNS for /etc/hosts modifications could still cache the old DNS settings and we would get incorrect results on testing.
The only option we were given is to setup a proxy server and set the proxy info in each browser.
I am... |
/etc/hosts does not use DNS at all so talking about DNS cache makes no sense. This file is authoritative over DNS concerning name resolution, as specified in /etc/nsswitch.conf (the Name Service Switch config file).
So if you enter a IP-host mapping in /etc/hosts it will always take precedence over DNS. (Of course, ... | Proxy server vs /etc/hosts file |
1,410,012,509,000 |
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 desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrout... |
The IP address-as-a-name would usually be read in reverse (much like a DNS PTR entry), so the name should correspond to 178.63.62.246 rather than 246.62.63.178.
In this instance that would suggest a server from Hetzner.
You can remove the entry, but if that's what the machine is called - what it's known as - it would ... | Debian /etc/hosts has unusual entry |
1,410,012,509,000 |
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 /etc/hosts instead of DNS, it is not found. I assume the entry in resolv.conf only applies to DNS.
Is there a way to make... |
The simple and generally used method is to include both host1 and host1.example.com to /etc/hosts.
However, you can reach your goal using dnsmasq. dnsmasq will read your hosts file (configurable,this is the default), you just have to set your original ns as upstream in dnsmasq and localhost as ns in resolv.conf and y... | How can I apply domain search paths to /etc/hosts lookups? |
1,410,012,509,000 |
I want to make a bunch of websites unaccessible on my computer.
My hosts.allow file:
sendmail: all
# /etc/hosts.allow: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: LOCAL @some_netgroup
# ALL: .foobar... |
hosts.deny is for servers, not clients running on your computer therefore you can't block websites with it. I suggest reading the hosts_access(5) man page for your system (Debian version, FreeBSD version).
By the way, there's a proposal by Lennart Poettering to get rid of tcpwrappers/tcpd in Fedora and OpenSSH will do... | Linux hosts.deny settings are not applied |
1,410,012,509,000 |
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:
127.0.0.1 localhost
213.2XX.2XX.XXX main.mars.customer.com main
89.1XX.1XX.XX6 melle
89.1XX.131.X9 hannes
89.1X... |
a server/machine can only "ever" have a single hostname. that is it.
that means that hostname will always return the last hostname set for that machine.
each IP can have a different name associated with it, in as such as when somebody connects to it, or from it, and you ask "what is the name associated with this IP?" ... | Create hostnames per IP on Debian |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.