How to setup your name servers (servermatrix)

<p>source: <a href="http://forums.servermatrix.com/viewtopic.html?t=168">http://forums.servermatrix.com/viewtopic.html?t=168</a></p><!--break--><p><font size="2">Setting up your own nameservers can be a nightmare. It never seems that no two hosts do the same things to get them set up. Anyway, this is what we did. <br /><br />1. Register the domain you're going to use for your nameservers, then register ns1.newdomain.com and ns2.newdomain.com as nameservers (registries normally have a special facility for doing that). The registry may also have a facility to propagate these nameservers around the foreign registries - if so, you should use this facility. <br /><br />These registrations may take a few days to propagate (often as many as 3 days). <br /><br />2. Get an additional IP address. We used the main IP for the server as one name server IP and got an additional IP address to be used for the second name server. <br /><br />You may also need to get your data centre to enter a reverse DNS pointer for your nameservers. You'll need to let them know each nameserver and its IP address. Sometimes you can suffer non-delivery of mail if you don't so this. Reverse DNS pointers can take a while to propagate. <br /><br />3. My version of WHM/CPanel came with a broken NDC. To fix this: <br /><br />SSH into your box as root. <br /><br />Type: <em>cd /scripts</em> <br />Type:<em> ./updatenow <br /></em>Type: <em>./fixndc</em> <br /><br />Go back into WHM, go to the Restart Services section in the left menu and click DNS/Nameserver (BIND). <br /><br />You will need to do this if you start getting 'ndc' errors when you are doing anything DNS related in WHM. <br /><br />4. Go into WHM (Web Host Manager) and select Edit Setup from the Server Setup menu on the left. Enter ns1.newdomain.com in the Primary Nameserver field. Hit 'Assign IP Address', then hit 'Add an A Entry for this nameserver'. <br /><br />Repeat this process for the Secondary Nameserver field. <br /><br />5. Go into WHM (Web Host Manager) and select Manage Nameserver IPs from the Server Setup menu on the left. Remove any nameservers you don't recognise. This is just a tidy up exercise in case anyone's set anything up on the box before you. <br /><br />6. Go into WHM (Web Host Manager) and select Initial NameServer Setup from the Server Setup menu on the left. Run this. <br /><br />7. Restart BIND (step 7 restarts BIND, but we've known it to need a proper stop and start for it to work) from SSH with: <br /><br /><em>service named stop <br />service named start</em> <br /><br />I don't know what it is about this process, but it doesn't always work, so there are some things you can check manually via SSH. <br /><br /><em>/etc/wwwacct.conf</em> <br />Check that the nameservers are correctly specified on NS, NS2 etc. <br /><br /><em>/etc/resolv.conf</em> <br />Check that there are nameserver entries for each IP. There may also be one for 127.0.0.1 - this is okay.I'm led to believe (by the 'man' entry for resolv.conf) that this isn't a particularly important file, but I changed mine to read: <br /><br /><em>domain mybox.com <br />search mybox.com <br />nameserver 127.0.0.1 <br />nameserver 111.111.111.111 <br />nameserver 222.222.222.222</em> <br /><br />Where 'mybox.com' is the main domain of my server, and '111.111.111.111' and '222.222.222.222' are the IP addresses of my primary and secondary nameservers. <br /><br />resolv.conf is used to lookup names that are not in FQDN format. <br /><br />/etc/nameserverips <br />Check that there are entries for each IP acting as a nameserver.[/url]</font><br /></p><p>*************************************</p><p><span class="postbody"><font size="2"><span style="FONT-WEIGHT: bold">OK, trying something new...</span> <br /><br />Not an article, not a tutorial, just a transcript of an AIM session I had earlier today: <br /><br /></font><span style="COLOR: green"><font size="2">Q: Hello Are you there? <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: hello yes, yes I am <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: you might just be able to save my ***! I've got a celeron box on servermatrix and have setup my nameservers using your guide on the forum.... but... <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: I can see my ns entries in /etc/nameserverips but not in /etc/wwwacct.conf and /etc/resolv.conf <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: So I can't set up any accounts, it fobs me off and sends me back to the ns setup <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ow <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: Did you see any error msg in whm when setting up your NS? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: it said something about ndc and it might be using an older version or something? but it said it added the ip's <br />when i clicked the button next to assign IP <br />the &quot;A&quot; entry <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: yes <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: hmm <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: you'll have to make sure that both /etc/named.conf and /etc/rndc.conf use 'rndckey' and not 'rndc-key' <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: key &quot;rndc-key&quot; ? <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: yeah that one is bad <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: what is it <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: you need key rndckey <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: it's just a key to sync. name servers <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: WHM and RH9 tend to use the wrong key <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: so how do I change it? and what will I need to do after i've changed it <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: which file contains the wrong key? is it rndc.conf? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: no, named.conf <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ok <br />pico name.conf then remove the dash sign and save <br />and rndc.conf <br />if rndc.conf contains 'rndc' and not 'rndc-key' then it's ok <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: it contains rndc-key <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: damn <br />OK, in a nutshell: <br />edit these 2 files - any instance of rndc-key must be replaced with rndckey <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: You're in a shell session right? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yep <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ok let me know when you're done <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: half of named.conf had rndc-key and half rndckey , weird <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok it's done <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: weird and wrong eheh <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: i don't know whats right and wrong so i can't judge <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: now run: <br />/scripts/fixnamed <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yep <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: now: <br />/scripts/fixndc <br />if it complained, then run /scripts/fixndc one more time <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: Found key in named.conf .. <br />Found controls in named.conf .. <br />named.conf has already been fixed! <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: great <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: did you run everything I just wrote? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yep <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: great <br />try this: <br />grep &quot;rndc-key&quot; named.conf rndc.conf <br />did it return anything? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: well i wasn't in /etc, but then it just went back to the command line <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ack <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: does that search for the rndc-key in the files? <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: silly me you need to run it in /etc <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: absolutely <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yeah i done that now and it just goes back to the command line <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: great <br />now, pico /etc/wwwacct.conf <br />you'll see lines starting with NS and NS2 and NS3 I guess <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: do you see them? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: sorry, putty crashed, just logging back in <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: hehe no problem <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok, i see the ns lines, but they're just ns.localhost.localdomain etc <br />;NS ns.localhost.localdomain <br />;NS2 ns2.localhost.localdomain <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: oh well that sure is wrong <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: these are the only lines starting with NS you have in this file? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yep, this is the problem, so i can't add accounts until this is sorted <br />; NS () <br />; This is the name for the SOA and NS dns entires <br />; <br />;NS ns.localhost.localdomain <br />;NS2 ns2.localhost.localdomain <br />; <br />; HOST (hostname) <br />; This is the name of the machine <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ok is hostname ok at least? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: but in /etc/nameservers it shows the ones i setup <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: so all is not lost <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: I haven't defined a hostname so it will just be the default whatever that is <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ow <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ok <br />that may be why whm got confused <br />you should, using whm, change your hostname <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: sorry i mean they're in /etc/nameserverips <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: I got it <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: how do i change my hostname <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ah under &quot;hostname&quot; in server setup hehe <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: it's a menu item - yeah <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: can i set it to any one word or does it have to the a-word.localdomain <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: like myhostname.localdomain or can it just be myhostname <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: it can be just myhostname <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ahh, the box already has a hostname, a default one setup by servermatrix by the looks of it... it's my name <br />but it isn't setup in server setup... <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: shall i add that one? <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: well <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: if there's a hostname then it's ok <br />let's go back to your shell session <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: are you still editing wwwacct.conf? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: no, i came out of it <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: shall i go back? <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: well pico /etc/wwwacct.conf <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: now go to the first NS line <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yep <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: you do know which name servers you want to use, of those you have in nameserversips right? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yeah <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: they're two i setup before, they haven't propogated, but i know the names and ips <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: OK, so replace ns.localhost.localdomain with this nameserver's name <br />for instance: ns.yourname.com <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: and ns2 yeah? <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: absolutely <br />So now both NS and NS2 are your nameservers <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yep <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: but hostname is still hostname in wwwacct.conf <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: If these line start with a semicolumn, remove it <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yeah they do <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: done <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: yes replace hostname with your host name <br />now save the file <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: Done? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: do i remove the ; on the hostname line too <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: oh yes sorry - yes do that <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: and make sure you have only one hostname line in the file <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ah **** there is one under it <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ah <br />was it the right value? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: no, the localhost.localdomain again, shall i just delete the line <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: yes do that <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok done, there is an ip address field too <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: with a weird ip <br />should this be my server IP? it has 172.16.209.72 in it <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: right. replace it with your server's main IP <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok, anything else <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: make sure you don't have extra NS fields in the file <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: nope, just the two i put in <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: ok now save it <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: done <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: now to be on the safe side, restart bind: <br />service named restart <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: Stopping named: rndc: connection to remote host closed <br />This may indicate that the remote server is using an older version of <br />the command protocol, this host is not authorized to connect, <br />or the key is invalid. <br />??? <br />it says it's ok <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: again: service named restart <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: it said stopping named <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: Does it complain again? <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: now it's back at the command line <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: no <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: Fixed, then. The message you saw is because bind had been started with the old rndc key <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok, now what do i do <br /><br /><br /></font></span><span style="COLOR: blue"><font size="2">A: now to be completely covered: <br />service cpanel restart <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: it's stopping all the services <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: done <br />(i think) <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: well now it's time for you to try adding a new account I guess <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok, let me have a crack <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: It brings up an error when i log in to whm, saying it was unable to look up an A entry for my hostname?? <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: heh yes because it's true <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ok, i'll try and add an account now <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: ooooh new account info page <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: now i'll just have to see if the domain maps to the account once the nameservers come online <br />i guess... <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: yup <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: Well, it should though <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: yeah, well, i created the names and mapped them to the correct ip's so i guess it should, we'll just have to see in a couple of days <br /><br /></font></span><span style="COLOR: green"><font size="2">Q: thanks a lot man, it's really appreciated <br /><br /></font></span><span style="COLOR: blue"><font size="2">A: yes good luck <br /><br /></font></span><font size="2"><span style="COLOR: green">Q: why can't they just setup the boxes like this to begin with <br /><br /></span><span style="COLOR: blue">A: Oh blame WHM for that </span></font><br /></span></p>