/etc/hosts resolving before DNS resolving ?
Hi ,
I am running RED HAT 8. I have 2 ethernet interfaces. -1 eth interface is a DHCP client (and gets IP + DNS entries via DHCP). This interface is connected to an antranet with DNS servers on. -1 eth interface has a static ip address. This interface is connected to a small LAN In /etc/hosts, I created some entries that make part of the LAN that is connected to the static interface : more /etc/hosts 10.10.10.2 server2 10.10.10.3 server3 when I do : ping server2 I notice that the RED HAT sends out a DNS request via the DHCP interface. Off course there is no reply from that server. then I got reply message from 127.0.0.1 !!! I see that no ping request goes out on my static eth interface !! So, I have following questions : 1. Why does the RED HAT does not look in my /etc/hosts file ? 2. Is there a possibility to first look in /etc/hosts before sending a DNS request ? |
Welcome to LQ.
The config file /etc/host.conf contains the configuration for name resolution order - for more info see: man host.conf |
I looked in the file /etc/host.conf and it contains following line :
order hosts,bind This means that first hosts file will be looked up and afterwards the bind. So why does my box first looks out on DNS ? On my box, IP forwarding is enabled. Can this be a problem ? |
are teh IPs (10.10.10.X) pingable?
|
Problem is solved.
For a reason I do not understand, server2 was assigned to 127.0.0.1 in my hosts file. Since you normally do not need to touch 127.0.0.1 in the hosts file, I completely overlooked this. I removed the server2 entry 127.0.0.1 from the hosts entry, and problem is solved. Anyway, I learned that there is a way in changing the resolving order via /etc/host.conf. This flexibility is according to me not possible on any WIN* platform. Thansk for your time ! |
All times are GMT -5. The time now is 08:40 PM. |