On 25/04/2020 13.15, Admin Beckspaced wrote:
Dear opensuse users,
I'm running the latest opensuse leap 15.1
just today I ran into a situation where I needed to point a domain to a specific IP adress.
If I'm on my windows client I just update the hosts file
112.202.123.179 somedomain.com
copy that file to /windows/system32/drivers/etc
open a terminal and run 'ipconfig /flushdns'
and voila ... whatever way I try to access the domain, e.g. do a ping or visit the domain in a web browser it points to the IP adress defined in the hosts file.
How can I do this on an opensuse box?
there's also a /etc/hosts file but it doesn't seem to get picked up?
Yes, it is used. Telcontar:~ # tail /etc/hosts 127.0.0.1 best.aliexpress.com 127.0.0.1 follamigos.com 127.0.0.1 commercego.site 127.0.0.1 gametracker.club 127.0.0.1 fastfreeredics105.live 127.0.0.1 bestdateshere-for23.com 127.0.0.1 bestdateshere-for23.com 112.202.123.179 somedomain.com Telcontar:~ # Telcontar:~ # host somedomain.com somedomain.com has address 185.53.177.54 somedomain.com mail is handled by 5 mail.h-email.net. Telcontar:~ # ping somedomain.com PING somedomain.com (112.202.123.179) 56(84) bytes of data. ^C --- somedomain.com ping statistics --- 6 packets transmitted, 0 received, 100% packet loss, time 5115ms Telcontar:~ # As you see, it works - but not with the command hosts, which is documented to ignore it. By the way, "somedomain.com" does exist, as you can see above.
there's also a DNS running on the box (same like on the windows computer) but I just want this specific domain to have a specific static IP address
I've already looked into /etc/hosts.conf ... /etc/resolver.conf ... /etc/nsswitch.conf ... or whatsoever ...
Have you modified them? Because you can disable the hosts file. -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)