Home > networking > Changing/Setting DNS settings on boot

Changing/Setting DNS settings on boot

August 23Hits:1
Advertisement

I have a situation where i do not give access to a machine, but there may be circumstances where the IP settings need to be changed. I have overcome this by providing a USB stick with a file with both static and DHCP info (renamed as appropriate) and a script that on reboot, checks the USB stick for a file and overwrites /etc/network/interfaces

To here, all good.

But, the file /etc/resolv.conf holds the DNS info (as far as I know) and I'm not sure how this file is structured.

What would be the best way for me to structure a file /etc/resolv.conf that could be overwritten with the above /etc/network/interfaces but with the DNS settings?

As an example, I use static IP and my /etc/resolv.conf looks like this:

    nameserver 192.168.1.254  

I have seen a demo file where this seems to be included in the /etc/network/interfaces file as follows (this is just from a search. not my file):

    iface eth0 inet static         address 192.168.3.3         netmask 255.255.255.0         gateway 192.168.3.1         dns-search example.com         dns-nameservers 192.168.3.45 192.168.8.10 

Could I put all the info in one file? If so, what then goes in the /etc/resolv.conf file?

To be honest, I'd rather have it all in the one file so it makes the end users life easier to just modify one file.

If it can be done in one file, what would be an example for DHCP (with regards to DHCP settings)

Thank you in advance for any help and suggestions!

Answers

You should not edit /etc/resolv.conf in Ubuntu.

Ubuntu is using the resolvconf program that generates /etc/resolv.conf when DNS information is changed by DHCP clients, NetworkManager or ifup.

Best bet is to add

dns-nameservers 192.168.3.45 192.168.8.10

to the appropriate stanza in your /etc/network/interfaces. After making this change you normally have to ifdown and ifup the interface for the information to be pushed to resolvconf and thus to /etc/resolv.conf, but it is possible to push the info without a downup, as described in the following answer which also provides some background information that may help you.

How do I get resolvconf to regenerate resolv.conf after I change /etc/network/interfaces?

Related Articles

  • Changing/Setting DNS settings on bootAugust 23

    I have a situation where i do not give access to a machine, but there may be circumstances where the IP settings need to be changed. I have overcome this by providing a USB stick with a file with both static and DHCP info (renamed as appropriate) and

  • Switch DNS settings per Windows user?July 15

    I have set up an account at OpenDNS for web filtering. I think it is a great service and don't want to change to any alternative. What I would like to do is change the DNS settings per user so I can choose who on that particular computer has filtered

  • Lock down XP dns settingsJuly 26

    All, Developers usually need admin rights to the OS, so they can do their task. How do I as an admin, lock in the DNS settings on windows , so they cannot be changed, only by me? I am not an expert at this permission stuff, so a step by step tutorial

  • GoDaddy Lost My DNS Settings: What to do?September 29

    My MX records point to Google Apps and my mail was working perfectly for 2 years or more. Then the other day it stopped working. I managed to figure out that it was a DNS problem and reset my MX records, but it's a bit spooky that this happened. The

  • Bypassing Router's DNS Settings

    Bypassing Router's DNS SettingsOctober 16

    Is there a way to bypass my ISP provided CPE/router's DNS settings? I'd like to use OpenDNS but I am unable to access the administrator acount of the CPE. I tried logging in using the default passwords (admin/admin, admin/1234, etc) to no avail. I fo

  • DNS Settings Being IgnoredJanuary 4

    I'm trying to set up my LAN with OpenDNS, and it seems that my DNS settings are being completely ignored. Even if I set my laptop (running Ubuntu) to have only the OpenDNS primary IP (and verify in resolv.conf that NetworkManager did its job) then $

  • Possible to point wildcard subdomain to top level domain via DNS settings?March 17

    Is it possible to point wildcard subdomains to a top level domain via DNS settings alone? I would like to have *.mydomain.com redirected to mydomain.com. mydomain.com is hosted on a 3rd service. I do not have access to any of my site's apache configu

  • Which DNS settings are used when setting up your serverApril 14

    I have a server and want to run my own name server service. Now I have set it up already and it works not, but I do not know where the exact settings are stored. On my server I use Plesk. When I edit DNS settings there I think it is stored in named.c

  • Mass change DNS settings or at least identify by DNSJune 2

    We have quite a few Windows based servers and I'm attempting to figure out either A. How I can change all of their DNS settings automatically (they all have local static IPs) or, failing that, B. at least query what their DNS settings are and sort by

  • Apache rewrite rules and DNS settings for HTTPS sitesJune 22

    For a web application located at: https://www.domain.com/ With an SSL certificate issued to "www.domain.com", What is are the proper rewrite rules, DNS settings, or combination of both which makes each of the below urls redirect seemlessly to ht

  • How do I edit Network Solution's DNS settings to allow no-www?July 14

    I have a domain registered through Network Solutions, foo.com. I have it setup to point to a Blogger account I have setup. I followed the instructions at: How do I use a custom domain name on my blog? It loads http://www.foo.com fine. But when I goto

  • Is there any way to redirect one domain to another via DNS settings keeping the path information?July 21

    For example, my domain is example.com and when someone navigates to example.com/sample/page.htm, I want it to redirect to test.com/sample/page.htm. I know that this can probably easily be done using a .htaccess file or a 404 page. However, I am looki

  • Can I override the default DNS settings on an HTC Evo without root access?September 21

    Is there any way to override the Sprint DNS server(s) used by default on the 3G connection of an HTC Evo running Froyo without root access? The reason I want to do this is because some sites are able to resolve when I'm using OpenDNS or Google DNS wh

  • I want a smart phone that I can lock in DNS settings. Is Android "the one"September 22

    It is all about being the internet boss. I want to be able to lock in or password protect the DNS settings to OpenDNS, so I can have a safe smartphone, that my kid can use with no fear of accessing pr0n or whatever. Anybody know if this is possible?

  • How can I set my DNS settings using the command-prompt or PS?October 27

    Through the CLI (either cmd.exe or PowerShell) on Windows 7, how do I edit the TCP/IP DNS parameters for a specific network adapter? --------------Solutions------------- netsh.exe netsh interface ip set dns name="Local Area Connection" source=st

  • dns settings for SERVER 2003 domain controllers for a new client of mineSeptember 19

    I have recently taken over a new client in a windows server 2003 domain environment. The only issue i see with the setup is that the second domain controller's dns entries might be wrong, hence why i am posting here. Here is the network setup. two do

  • Correct DNS settings for my server setupOctober 19

    I am struggling to understand the correct DNS settings for my server setup. I have a web server with a single IP and 6 domains hosted on it. I got IIS6's SMTP virtual server working yesterday and sent out a single email from my server to my gmail acc

  • Problem with the DNS settings for our new company mailserverJanuary 24

    We are a small business with several branches around our country, trying to improve intra-office communications. In order to host a mail server at our head office we have upgraded our Business Broadband plan to a Static IP with Port 25 open, purchase

  • DNS settings updated in whois, but site still looking at old serversJanuary 28

    I have migrated a site from a external Linux server to a new IIS server. DNS settings have been updated and are showing correctly in whois, squish.net, traceroute. However, when I type in the domain, I am still looking at the old site on desktop. Mob

  • Ignore the DNS settings from my hosting provider?January 31

    I'm not really sure this is possible (or how to explain it properly)... My hosting provider is Bluehost My Domain Registar of choice is Hover For email I use google apps. What I would like to do, is be able to set up my DNS settings, for email and go

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.315 s.