DNS explanation required

114 posts / 0 new
Last post
#1 Mon, 06/15/2009 - 22:00
recci

DNS explanation required

Hi

I'm having trouble fully understanding how the DNS system works in general and with Virtualmin... in the past most of my sites have been hosted on shared hosting using cpanel or something similar. Iv not had to worry about setting up DNS all I had to do was add the domain on in cpanel and point my domain in godaddy to specified nameservers and it all worked fine and dandy!

Iv got a cheap VPS that's got Ubuntu 8.10 installed and updated and has two ip addresses. I basically got this VPS to play with a learn on before moving any live websites over to it.

So far iv managed to get virtualmin installed and working with the install script.

now comes the confusing bit for me.....

When setting this up it asked for a fully qualified domain name, does this mean it requires one of my actual registered domain names that I intended to use for a website? If so why?

I had planned to setup the VPS and host two completely separate sites each having its own IP address ( I know this isn't necessary) and domain name associated with it. But now Im not sure what to do, should I use the domain name of the main site as the host name? I'm kinda lost here...

can somebody explain to me in layman's terms how to set this up correctly, so that I will have working nameservers to point my individual domains names to that I will use for each virtual server.

cheers

Mon, 06/15/2009 - 22:30
andreychek

Well, DNS is an involved beast. You might consider investing in a book such as O'Reilly's "DNS and BIND", which I really liked -- it helped me learn the ins and outs here.

A fully qualified domain name (FQDN) is a name like:

foo.example.com

That is, a hostname followed by a domain name.

Your server will need a FQDN -- it needs to be using a domain name that you own. If you have a domain name you'd consider the "main" one for your site, I might choose that.

If you're looking to setup your server as a nameserver, you'll need to register it as a nameserver with your domain name registrar. -Eric

Tue, 06/16/2009 - 07:29
recci

Iv been reading and sort of understand what is going on. But Do I really need to use my VPS as a name server or could I use free domain services such as Afraid.org?

Tue, 06/16/2009 - 08:50
recci

Also is it not possible to use the nameservers of my VPS provider? Why is it desirable to have your own private nameservers on a VPS in the first place?

Tue, 06/16/2009 - 09:45
recci

I contacted my provider and I do have to setup my own!

Would it be better to try and do this via webmin rather than virtualmin?

there seems to be more info out there on how to do this via webmin

Tue, 06/16/2009 - 09:48
andreychek

Well, some domain name registrars -- GoDaddy is an example -- offer free DNS service.

So if you're using a registrar similar to GoDaddy, instead of needing to act as a nameserver, you could simply enable the DNS service there, and point the various records to the IP addresses on your VPS. -Eric

Tue, 06/16/2009 - 09:53
recci

I am using godaddy! Wasn't aware I could do that, where do I look for the info on this in godaddy?

Tue, 06/16/2009 - 10:07
ronald
ronald's picture

There is a module under Webmin - Networking - Network Configuration - Hostname and DNS Client that is where you organise this for a start.

You need a domainname at a registrar where you can register the 2 IP's for your nameservers. This is not the same as changing nameservers for a domain.

Your registrar will announce the 2 IP's and the domainname to the world. Not all registrars do this. (namecheap.com does and you can do it from your account there)

So now the world knows where to find your domain and any other domain on your box using your nameservers. Then in the module you write for instance server.domainname.com or ns.domainname.com or dns.domainname.com. You get the picture.

At DNS servers in that part you would have the local IP 127.0.0.1 and the 2 IP's (nameservers) of your ISP (so not your own) because the ISP needs to find your machine when a request comes in.

Then under Host Addresses you'll bind the IP's to the names. - 84.244.xxx.xx1 ns.domainname.com , ns - 84.244.xxx.xx2 ns2.domainname.com , ns2

Under Network Interfaces you can create a virtual iface to venet0:0 called venet0:1 and add the 2nd IP

In the servers template under BIND DNS domain (BIND DNS records for new domains) fill in ${DOM}. 38400 IN NS ns2.domainname.com.

thats how i did it

Tue, 06/16/2009 - 10:21
recci

andreychek: Does this come under total DNS control in godaddy?

And how does this affect the rest of virtualmin such as each domain and sub-domains for the virtual servers?

Tue, 06/16/2009 - 10:29 (Reply to #9)
andreychek

So, there's two ways to setup DNS for your server:

  1. Let someone else do it

  2. Do it yourself

Both have benefits and drawbacks :-)

Ronald's excellent writeup described #2, how to do it yourself.

If you want to let someone else do it -- such as GoDaddy -- then yes, you'd set that up using GoDaddy's Total DNS Control.

How does that affect your Virtual Servers?

It means that anytime you add a new domain or sub-domain to your system, you have to go back to GoDaddy, and add the domain and IP address into Total DNS Control.

If you don't intend on adding new domains very often, that's not a big a deal.

If that happens a lot, you may end up finding that to be inconvenient. -Eric

Tue, 06/16/2009 - 10:35
recci

Ok and will they make a difference to me when setting up email accounts on domains/ virtual servers as I see in the total DNS control I have the option to edit all the mail settings and everything.

What are the main things I should change when using Total DNS control to point to my servers?

obviously first is the actual ip address

I have :

www @ 1 Hour

mobilemail  mobilemail-v01.prod.mesa1.secureserver.net  1 Hour

pda     mobilemail-v01.prod.mesa1.secureserver.net  1 Hour

email   email.secureserver.net  1 Hour

imap    imap.secureserver.net   1 Hour

mail    pop.secureserver.net    1 Hour

pop     pop.secureserver.net    1 Hour

smtp    smtp.secureserver.net   1 Hour

ftp     @   1 Hour

webmail     webmail.secureserver.net    1 Hour

e   email.secureserver.net
Tue, 06/16/2009 - 10:58
recci

In the host section of total DNS control I have two sections to fill in

In the first section I put in the hostname of my server and pointed it to one of my ip addresses and set ttl to 30mins

what do I put in the second host section that currently only has @ in it?

Also I take it with total dns control I can point the www.mydomain.com to my server but still use godaddy's free email service with the domain by not changing the email setting in total dns control?

Tue, 06/16/2009 - 12:50
andreychek

First, I'd get rid of all the domains/sub-domains GoDaddy setup by default, and start over :-)

If your domain is "example.com", you basically want to setup a number of records to point at your server -- that includes example.com, www.example.com, admin.example.com, webmail.example.com, and mail.example.com -- along with anything else you want to resolve to your address -- and you need to make sure they're all going to your server by setting them up as address and/or cname alias records.

Regarding GoDaddy's free email service -- you have to choose whether you want email going to your server, or to GoDaddy -- you can't have both unfortunately :-)

I wouldn't worry about the TTL's, you can leave those at the defaults. -Eric

Tue, 06/16/2009 - 12:59
recci

Well I would rather just keep the email at godaddy at least if my server goes down my email will continue to function. How do I do that?

Tue, 06/16/2009 - 13:03
andreychek

Howdy,

Well, I'm not an expert on how to setup DNS/email on GoDaddy, but in general, it means:

  • You need to have an MX record setup in your DNS (ie, Total DNS Control) that points to GoDaddy. I believe this is the default, so you may not have to do much there

  • You'll want to disable the "mail" and "dns" features in Virtualmin so that your server understands it doesn't need to do those things (in System Settings -> Features and Plugins).

Tue, 06/16/2009 - 13:10
recci

ahh but will doing this still allow some of the virtual servers to still have email running from them. Its just mail account from my main domain I want to keep at godaddy.

Tue, 06/16/2009 - 14:39
andreychek

Yeah, it's per-domain.

You could have one domain send email to GoDaddy, and others send their email to your server. -Eric

Tue, 06/16/2009 - 14:45
recci

arrrghh Im just totally lost now mate, the more I read the more confused I become..... I need some kind of step by guide on either how to setup my own private nameservers on my vps with webmin/virtualmin or a Step by step guide on how to use the godaddy dns service either way I just want this shit to work...most of the webmin how to's iv found have been out of date and the icons settings pages it tell you to click dont even exist in my version.

Tue, 06/16/2009 - 15:14
recci

How do I change the host name in webmin? I never used a FQDN when setting up just mydomain.info

Tue, 06/16/2009 - 15:54
andreychek

I agree that a DNS step-by-step guide would be helpful.

But we don't have one yet :-)

DNS is a complex beast, and it'll take some time to create that.

Ronald offered a pretty detailed explanation above on how you might go about setting up your own server as a nameserver.

If it's just not clicking for you, you might consider tossing a few dollars someone's way to have them guide you through each step of the process, since there's a lot of moving parts involved here.

For example, you may be able to talk Ronald into that :-)

However, we will have a DNS step-by-step guide online at some point.

As far as changing your hostname -- you can do that in Webmin -> Networking -> Network Configuration -> Hostname and DNS client. -Eric

Tue, 06/16/2009 - 16:01
recci

Well Iv managed to get my domain name resolving to my ip address with the godaddy total dns controls but the email still aint working. Is it just a matter of changing the email records to mail.mydomain.com not the domain name of my host?

Tue, 06/16/2009 - 17:04
ronald
ronald's picture

here is valid documentation on DNS in webmin. http://doxfer.com/Webmin/BINDDNSServer

I think you should keep the mailsettings at godaddy default and just forward the mail to your private email or gmail whatever you have. GoDaddy should have a service like this, look in your account there.

Tue, 06/16/2009 - 22:33
recci

I may be willing to pay somebody a few bucks to help me sort this out but it would depend how much?

Also I think one of my problems is I dont have a fully qualified hostname but is that relivent when using godaddy dns?

Tue, 06/16/2009 - 22:46 (Reply to #23)
andreychek

Well, you may need to clarify what issue you're having.

However, in theory, you have some domains -- let's call them example1.com and example2.com.

For each, you need to setup a number of DNS records within GoDaddy that point to your server.

With one exception -- example1.com should have mail go to GoDaddy, rather than your server.

So you'd just make sure the mail records point to GoDaddy's server, rather than yours -- which should be the default.

I don't know the specifics of setting that all up at GoDaddy, but the above is the high level view of how it should work :-) -Eric

Tue, 06/16/2009 - 22:49
Joe
Joe's picture

I may be willing to pay somebody a few bucks to help me sort this out but it would depend how much?

You'll want to post that sort of thing in the Jobs forum, so folks looking for Virtualmin related work will know you're looking.

Also I think one of my problems is I dont have a fully qualified hostname but is that relivent when using godaddy dns?

Having a fully qualified hostname is always relevant. But, I think you're missing a few fundamental bits of understanding about how DNS works that's preventing all of this from being clear for you.

I'd like to explain the bits that you aren't understanding...but I'm not sure which specific parts are escaping you, and if I tried to explain everything, well...it'd be just as complicated as all of the docs you're trying to make sense out of. ;-)

So, I will answer a few of the questions that I see stand out throughout this thread:

One of the questions is: Should you run your own name server? Only if you want to. But, if you don't know how to setup any kind of records, it might be easier to let Virtualmin manage them. If there is a service that you like that provides DNS service for you, and you want to use it, then by all means. But, you'll still need to understand what records you need and how to create them using whatever interface that service provides.

You asked above if you should be using Webmin for DNS configuration because there are more HOWTOs. No. Virtualmin automatically does nearly everything covered by those HOWTOs. You'd be saying, "OK, I want to do everything myself." I really don't think that's a good idea, if you don't actually understand how DNS works.

The only missing piece that Virtualmin cannot do for you is setup the glue records at your registrar. These are the records that tell the world where to find your name server.

Another piece that Virtualmin cannot do for you, which is sounds like you also haven't done for yourself, is set a valid fully qualified domain name for your system. The system hostname is what Virtualmin uses, by default, in NS records for newly created domains. You also probably want to add another.

So, anyway, if you want to use an outside DNS server, that's great. But no matter what, you've gotta at least understand what DNS is and how that applies to what you need to accomplish.

--

Check out the forum guidelines!

Wed, 06/17/2009 - 09:00
recci

Ok thanks for that Joe!

I do understand what DNS is and what it does I just don't understand all the steps involved in setting it up because I have never actually tried to do it before. I have degree in web development and I'm just starting out in the this career, it doesn't help that all the education was based around windows systems not Linux and the server/networking side of things was theory not practical. So as you can imagine I have a clear understand of what DNS is and its role but actually trying to set it up for yourself it a completely different ball game.

To be honest I don't really care if I run my own nameservers or if I let a third party do it, which ever is easiest. I would be more than happy to let virtualmin run the DNS for me but it wasn't clear to me that it actually done that!

So lets start at the first hurdle sorting out my fully qualified domain/host name issues:

When I got the VPS, all I got was a root account and password and two IP addresses. Ubuntu was already installed and the host name was set as my user name.

So to set up a fully qualified host name for my server I will need a domain? I have several in my godaddy account that I'm not using for anything.

So the first thing I need to do is? Point this domain name to one of my IP addresses for the server?

or

Edit records in ubuntu to set the hostname?

Wed, 06/17/2009 - 10:01
ronald
ronald's picture

log in over ssh and type: hostname ns1.mydomain.com now your hostname is set.

login to godaddy and register your two IP's with mydomain.com done. Give it time to propagate.

see my post above with further steps you should take.

Wed, 06/17/2009 - 10:21
recci

yeah but that's not a permanent way to change the hostname in ubuntu is it? I thought you had to edit the

/etc/hostname and run hostname host.domain.tld.

Ill give it a go but your steps above are as clear as mud to me, I'm still unsure about where ns2.mydomain.com comes in?

Wed, 06/17/2009 - 10:37
recci

Ok I changed the hostname to n1.flirtsnflings.com which is an old domain name i had lying around.

I then added the A records for each ip address in total DNS control. I have included a screenshot so you can check to ensure this is all i need to do

Wed, 06/17/2009 - 10:37
ronald
ronald's picture

do you mean this part?: In the servers template under BIND DNS domain (BIND DNS records for new domains) fill in ${DOM}. 38400 IN NS ns2.domainname.com.

Then go to: Virtualmin - System Settings - click Server Templates - in the right pane click Default Settings or any other template you use - look at the right pane and in the dropdown select BIND DNS domain.

The first field is called BIND DNS records for new domains. In the big empty white box fill in ${DOM}. 38400 IN NS ns2.mydomain.com.

click save. done.

Wed, 06/17/2009 - 10:43
ronald
ronald's picture

Oh I thought per haps you want your own nameservers which would be easiest to do.

I don't know godaddy's panel but it doesn't look right. smtp is using your domain while pop+mail etc is not. If you have enough RAM on your VPS I advice to run your own nameservers.

It doesn't matter which domainname you use. You can use a domainname that will also run on your VPS as a normal website as long as it is your domain.

The only trick is to actually register the IP's with the chosen domainname at godaddy.

Wed, 06/17/2009 - 10:53
recci

Im going to just run my own namesevers as its seems easy enough once u know what your doing.

So in godaddys control panel at the top where is says host Iv put flirtnflings.com in twice and points to my ip addresses is this correct?

Its the only way in godaddy to actual point an domain to an ip address. the only other options are just pointing them to nameservers

Oh yeah that was me who changes the smtp to my server. Ill change it back. I take it I dont need to edit any of the other records if i run my nameservers?

Wed, 06/17/2009 - 10:54
ronald
ronald's picture

to both No I dont think so. Those would be A records.

You need to Register the IP's at GoDaddy which would be done elsewhere in your GoDaddy's account.

sorry I dont know GoDaddy, you'll need to ask them where to do this. Pointing IP's to A or NS records is something very different to Registering the IP's.

Wed, 06/17/2009 - 11:02
recci

right i think i no what you mean. So I want to register the ips with the domain name as nameserver?

Wed, 06/17/2009 - 11:13
ronald
ronald's picture

yes. but not in that panel as ns records/nameservers (in your image at the bottom, that's not it). You might want to try advanced options.

Alternatively you can buy a whatevername.info for under $3 at namecheap.com. That's what I use and registering IP's is easy there.

Wed, 06/17/2009 - 11:23
ronald
ronald's picture

in namecheap it looks like you see in the pic.

Wed, 06/17/2009 - 12:13
recci

I found this guide and seems you do, do it in the total dns interface but the godaddy interface has been changed a bit since then.

http://www.howtoforge.com/ispconfig_dns_godaddy

Wed, 06/17/2009 - 12:28
ronald
ronald's picture

yes indeed. it also says in that guide "registering nameservers" so that seems good. I'm not familiar with godaddy.

Once that is set up you can further configure virtualmin as described and once propagated (can take a while) it should work as expected.

Wed, 06/17/2009 - 13:53
recci

Ok I think I managed to setup the fully qualified domain name and register the nameservers by following the ispconfig guide.

Once its propagated how will I check its working?

the dig command doesnt seem to work in my version of Ubuntu.

Edit:

I got dig installed with

apt-get install dnsutils

Wed, 06/17/2009 - 14:09
ronald
ronald's picture

First set up your vps/virtualmin as described above.

Once that is done and you can create the first domain/server using your own nameservers.

Tools I consider the best are: www.intodns.com and http://www.squish.net/dnscheck/ In the latter you can fill in ns1.flirtsnflings.com and see what happens

Wed, 06/17/2009 - 16:02
recci

Ok that seems to have propagated OK and the fully qualified hostname is now working.

ok getting their... but im still not clear fully on your instructions ronald. Say I want let virtualmin handle the DNS as Joe suggested, then I need to follow your instructions above:

First thing I do is go into webmin / Networking - Network Configuration - Hostname and DNS Client

once in there I have the Hostname box which has: ns1 in it

the Resolution order---Ignore this?

and the DNS server boxes

the first has the local IP 127.0.0.1 and I to enter the 2 IP's (nameservers) of my ISP

What do you mean by the ISP is this the company who is supplying my VPS or Godaddy your talking about?

Wed, 06/17/2009 - 16:04
Joe
Joe's picture

once in there I have the Hostname box which has: ns1 in it

That's not a fully qualified domain name. You need a fully qualified domain name.

If this is a Debian/Ubuntu system, you also need to manually edit /etc/hosts to fix the stupid way they setup the system hostname by default (on a loopback address rather than a world-facing address).

--

Check out the forum guidelines!

Wed, 06/17/2009 - 16:10
recci

I already did that the fully qualified domain name is ns1.flirtsnflings.com in /etc/hosts but in the hostname box its only showing up as ns1.

ao just put ns1.flirtsnflings.com in the hostname box?

Wed, 06/17/2009 - 16:15
recci

wait no the /etc/hosts has this in it

127.0.0.1 andy91 localhost localhost.localdomain

so replace this with ns1.flirtsnflings.com or just add ns1.flirtsnflings.com?

it was /etc/hostname I had already edited

Wed, 06/17/2009 - 16:18 (Reply to #44)
Joe
Joe's picture

Loopback (127.0.0.1) is not where you want your hostname.

You'd want an entry like:

192.168.1.1 ns1.flirtsnflings.com ns1

Where 192.168.1.1 is your primary IP address (not a loopback address! anything starting 127 is a loopback address)

--

Check out the forum guidelines!

Wed, 06/17/2009 - 16:26
recci

ok so delete 127.0.0.1 andy91 localhost localhost.localdomain and replace it with

"my ip address" ns1.flirtsnflings.com ns1

then I enter ns1.flirtsnflings.com in the hostname box?

then what about my question about the 2 ips of my isp?

Wed, 06/17/2009 - 16:37
Joe
Joe's picture

ok so delete 127.0.0.1 andy91 localhost localhost.localdomain and replace it with

Egads, no! You need both. localhost is absolutely vital to the functioning of every service on your system.

--

Check out the forum guidelines!

Wed, 06/17/2009 - 16:46
recci

LOL ok no worrys Ill just put it back. I need you to answer my specifically as I ask them or ill do something stupid!

now I have this in my hosts file

127.0.0.1 andy91 localhost localhost.localdomain

xx.xx.xxx.xxx ns1.flirtsnflings.com ns1

I dont need to put anything infront of the second line?

Wed, 06/17/2009 - 16:50 (Reply to #48)
Joe
Joe's picture

Nope. That'll do it.

Webmin will probably show the full hostname now when you look in the DNS Client and Hostname page (I think). You can make sure it's actually right for all other services on the system by running:

hostname -f

From the command line. If it returns your fully qualified domain name, you can forget all about the hostname stuff, and get on to the rest of the process.

--

Check out the forum guidelines!

Wed, 06/17/2009 - 16:55
ronald
ronald's picture

so I dont know about specifics in Ubuntu regarding the hostname looping back.

but here are some screenshots how I have it on my system. in webmin - networking module. Pictures explain better than words as they leave no room for interpretation.

Dont bother with anything at godaddy now, nameservers are set and thats it there is to it. (although it seemed the A records are set but we'll look later)

Wed, 06/17/2009 - 16:58
recci

well it was showing the correct hostname to begin with when using hostname -f

but at webmin / Networking - Network Configuration - Hostname and DNS Client it still just says ns1 and when i replace it with ns1.flirtsnflings.com and save then go back in it returns to just ns1

From the command line its fine so lets get onto the rest of the process ;)

as I said in my question above what about these isp ip addresses i require?

Pages

Topic locked