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.
I have a Debian system where i must dynamic change the DNS resolution of a domain.
I have done a little script that changes file /etc/hosts ( so the domain ip changes too ) but i have seen that this change take a while to become available.
How can i force the reload of /etc/hosts?
Is there any other solution to this problem?
Quick explain: on a first moment, the system must "talk" with the dns server ( in my case 192.168.0.1 ) to find out the domains ip. On other moment, the system must resolve the domain to a specified IP, without asking the dns server.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Rep:
I'm not sure how to flush DNS in linux, but I think if you restart your network service it will flush out the dns. So in your script, just add something like:
/etc/init.d/networking restart
Of course this will cause you to lose network connection for a second or two.
Do you have a DNS server? IN general, a DNS server can update its record, especially if you have DHCP installed on your network.
Do you have a DNS server? IN general, a DNS server can update its record, especially if you have DHCP installed on your network.
Yes, i have a DNS server on my network. But your tip worked ( at least on shell ).
The problem now is on firefox, since it access the old DNS even after clearing cache and reloading the page. Do you any ideas of how can i force firefox to read /etc/hosts again?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.