127.0.0.1 Entry in Zone file and /etc/hosts, will this cause probs?
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
127.0.0.1 Entry in Zone file and /etc/hosts, will this cause probs?
I have a domain, I'll call it X in the post, that I am using htdig on to spider through the site and compile a search db. The problem is, htdig access the system through eth0, and I am trying to prevent this, I want it to connect locally but use the same FQDN. So I thought I could add an A entry in X's zone file refering it to 127.0.0.1, as well as add an entry to /etc/hosts which connects 127.0.0.1 to X, so here's what I have in both those files:
/var/named/X.hosts:
X. IN A yy.yy.yy.yy
X. IN A 127.0.0.1
/etc/hosts:
127.0.0.1 localhost
127.0.0.1 X
yy.yy.yy.yy ns1.X
yy.yy.yy.yy X
(Where yy.yy.yy.yy is the public IP.)
My hypothesis behind this is that htdig will now resolv X to 127.0.0.1, and not have to connect through the eth0 connection, just the lo device. Is this correct? Would this screw anything up as far as addressing goes, or resolving? Is there an easier way to do this? Thanks in advance!
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
You can try putting your new entry at the top of the /etc/hosts file (just 127... X) and /etc/hosts might take the first match (test it to make sure). I'm pretty certain that hosts resolution will just take first match and won't look for others. BIND will do round-robin no matter what, though so you might as well yank that stuff out of your zone file. Besides, if you're making that zone available to Internet client then you're going to cause them grief (half the time your site will resolve to the IP of the loopback adaptor so instead of your site, they'll get nothing).
You can also read up on BIND "views" to implemention split-horizon DNS. What that would do is give one IP to the outside world, but a different IP to a small set of hosts or networks that you define.
Well, it looks like this kind of thing happens naturally anyways, I setup a logging on the packets accessing that interface from internally, and nothing is logged, so my guess is that it is translated automatically.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.