Root can resolve localhost, while normal user cannot - linux

I think I encounter a weird problem:
With a normal user: when I ping localhost, I got ping: unknown host localhost, when I ping 0.0.0.0 or 127.0.0.1, I got response.
With root: everything is fine.
Here is the content in /etc/hosts:
127.0.0.1 localhost.localdomain localhost
... [opt out]
I am using CentOS (rocks cluster system)

I guess that /etc/hosts is not readable by ordinary users. What are the permissions of that file?

Related

Linux process/component sending frequent DNS queries to resolve the local hostname (but shouldn't)

I'm not a networking guru so could use some help. I am running a RHEL7 (Red Hat Enterprise Linux) VM (Virtual Machine) where some component on the OS is sending frequent DNS queries to resolve it's own local hostname to our main DNS server (which shouldn't be happening because the DNS server won't know anything about its address). Can anyone provide guidance as to how I can find out what component/service/process this is? It's filling our logs with 19k records over just hours and I need to find a way to fix this.
The hostname for the RHEL VM is spe1.2v29999999.dev.local , there is a static IP on this VM and it is 10.70.49.61. The /etc/hosts looks like:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost4 localhost4.localdomain4
I suspected it might be a java jar we have running on the VM, but I stopped it via systemctl stop MyJavaJar but after running a tcp dump via tcpdump -i any udp port 53, I could still see the queries happening.
Here are some examples from different days/times in the logs (both A and TXT records):
2020-05-05T13:53:50.189178+00:00 dns.green.blue.mycompany.com 127.0.0.1 <daemon.info> dnsmasq[20886]: 739 10.70.49.61/65078 query[A] spe1.2v29999999.dev.local from 10.70.49.61
2020-05-07T00:01:39.934899+00:00 dns.green.blue.mycompany.com 127.0.0.1 <daemon.info> dnsmasq[8615]: 27827 10.70.49.61/57348 reply spe1.2v29999999.dev.local is NXDOMAIN
2020-05-11T00:01:20.674688+00:00 dns.green.blue.mycompany.com 127.0.0.1 <daemon.info> dnsmasq[8615]: 130345 10.70.49.61/53321 query[TXT] bootstrap.spe1.2v29999999.dev.local from 10.70.49.61
Would making any changes to /etc/hostname, /etc/sysconfig, /var/named .zone files, /var/named.conf or /etc/named help? Can I do more with tcpdump? Thanks
Put:
127.0.0.1 spe1.2v29999999.dev.local
in /etc/hosts. This is done by default on many distros.

How to configure apache in local development in rails

I am trying setup a loacl domain on my pc for that I have apache server install I want to open my rails s inside this abcd.com instead of 127.0.0.1:3000. In my host I have changed host file like this:
127.0.0.1 localhost
127.0.0.1 abcd.com
But when I am trying to open abcd.com with this command I am getting this message:
Address already in use - bind(2) for "127.0.0.1" port 80 (Errno::EADDRINUSE)
When I stop apache it works on localhost any help
You need to write all hostnames behind the ip like this :
127.0.0.1 localhost abcd.com

Apache IP address working but localhost does not

I downloaded Apache2 and it is currently running. I typed in my IP address and it brings me to the "It Works!" page, however when I type in localhost or 127.0.0.1 I receive an error. Can someone tell me whats up?
check 127.0.0.1 able to ping or not with same machine.
check /etc/hosts file having 127.0.0.1 entry or not?
check in apache configuration file Listen 0.0.0.0:80 or not?

Getting complain message from radius server

I am very new to Radius server, please give some advice if you know.
currently the basic configuration of Radius have been finished, while i am testing the server i got the following error:
/usr/local/radius/bin/radtest user password localhost 0 testing123
radclient:: Failed to find IP address for radius
radclient: Nothing to send
if you want to know further information for configuration please let me know.
It appears it can't resolve localhost, try /usr/local/radius/bin/radtest user password 127.0.0.1 0 testing123
Edit your /etc/hosts file and add add the hostname of your server to the aliases list of 127.0.0.1, like this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 my-radius
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 my-radius

How to disable loopback interface in Linux (Fedora)?

So that requests to localhost are treated as if coming from remote host in LAN?
Have you tried updating your /etc/hosts file, replacing:
127.0.0.1 localhost
With your actual IP address? e.g.,
192.168.0.42 localhost
(This doesn't actually disable the loopback address, you can still connect to 127.0.0.1, but connecting to localhost should come in through your network interface, which I believe is what you're asking)

Resources