V
V
Vitaly2019-07-16 15:50:46
linux
Vitaly, 2019-07-16 15:50:46

Is it possible to redirect from domain to domain via hosts file in Linux?

All the best!
Perhaps I did not quite correctly state the question, but I mean something like in the /etc/hosts file

127.0.0.1     localhost
e_e             e_e.net

The bottom line is, on the router, in the DNS settings, it is indicated that e_e is, say , 22.22.22.22
On some Linux machines, in this case, everything works, but on other Linux assemblies on the same network, it does not work, you need to use e_e.net . The bottom line is that you don’t want to show the real address by entering it in hosts , changing it to e_e.net everywhere is also not suitable, since this url, unfortunately, is hardcoded in one application ...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2019-07-16
@Scorpiored88

what you describe is called DNS suffix - specify the net suffix ping e_e and the system pings e_e.net
in linux resolv.conf is responsible for working with DNS

A
Artem @Jump, 2019-07-16
Tag

Is it possible to redirect from domain to domain via hosts file in Linux?
No.
Domain is a name.
The hosts file simply indicates at what IP address the server with that name is located. That is, in fact, it is an analogue of the DNS server.
Using the hosts file, you can redirect everyone who accesses a specific domain name to any desired IP address.
But redirect to another domain name - no way.

K
Karpion, 2019-07-16
@Karpion

The hosts file was created when such a redirect could not work - there were no DNS servers (that's why it was created). And then it turned out that it was very inconvenient - and it was left only for compatibility.
I did not understand how "on the router in the DNS settings it is indicated that e_e is, say, 22.22.22.22". I see a lot of options for how this can be done.
Those computers that do not resolve this name - perhaps even use a different DNS server, not a router. The nslookup and dig programs will help you diagnose.
The "net suffix" advice is good. But not in all cases.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question