# Hosting my own domain, DNS servers, nameservers, AUGH!!

## Crymson

Ok, total noob, and I'm about to show my noob colors, so bear with me please.

I have a domain, crymson.org.  I want to host it myself.  I have a more or less static IP address, from my cable ISP.  (Yes I know, they are dynamic, but this one hasn't changed in 8 months).  So, I'm going to do it anyway.  In the rare instance that my IP does change, I'll accept the 48 hour propogation delays.

This is what I want my server to accomplish-

I want to host my webpage, at www.crymson.org.

I want to run an email server, and dish out crymson.org email addresses to friends, family, etc.  I'd rather this not be a relay server, as I think my ISP would have a problem with that- I'd rather it just be more packets being sent along the data line.

I want to run an ftp server, ftp.crymson.org, so that people can share files etc etc.

I have BIND installed, and I've tried making sense of it, to no avail.  I know I need a nameserver, and configure the zone and all that fun stuff.  So how do I set up a name server?  Currently, the nameservers on my domain (parked at godaddy) are ns7 and ns8.secureserver.net.

What do I need to do so that I am the primary NS for my domain?

IP Addressing is also kicking my butt- I've tried to make sense of DNS in general, but it seems to be above my head.  My IP Address is 24.121.34.160- but I have that connected to my router, which then has DHCP running for the other computers in my house.  I took the soon-to-be-server OUT of the DHCP range (which starts at 192.168.1.100), and made its IPA 192.168.1.2.  So when I'm configuring BIND and named and all that, which IP am I using?  How can I be sure that the appropriate data gets sent to the right machine?

If it would be easier, I can get a 2nd IP assigned, which I could devote entirely to the server, and keep the other for the router, and DHCP.

I must admit, I'm totally lost, and don't know where to begin.

For the web stuff, I emerged apache, and have that waiting.  (It'd be cool to have a fully functional web page, since I'm trying to learn perl, php, and other neat web things).

For FTP, is there a Linux equivalent to the War FTP Daemon on winbloz?  I don't need something with a GUI (I disabled all GUI stuff on my Gentoo install), but easy to configure would be a bonus.

For email, I emerged squirrelmail.

One last detail, before I forget- the Linux machine is connected to a monitor, but anything I can do remotely if need be would be cool.  If it is a total security risk, then I guess I can go without, but keep in mind, there is **NO** GUI on my Linux install (nor will there ever be).  So, any programs that make use of Gnome or KDE or something are pretty much worthless to me.

Sorry for the long post, but now having covered (I hope) my bases, can someone help me out, give me a good place to start, point me in the right direction, SOMETHING?   :Smile: 

If I left something out, please let me know, and I'll get it posted ASAP.  (Oh, and my hostname is "Enterprise", in case that helps for anything).

Thanks so much!!

----------

## dkaplowitz

You should deal with one issue at a time. Web, mail, DNS, ftp, etc. all in the same thread is not going to get you very far.

As to the DNS issue. You need to configure the named.config file, then a zone file for your domain, something like db.crymson.org. In addition to this you should set the in-addr setting for your IP (the file where you put your IP in backwards with something like in-addr-... at the end). I personally do it for my 192.168.0.0 address as well as for my external IP. I don't know if that's right, but it works for me with hosting my own DNS.

Then, when your DNS is properly configured, you have to tell godaddy that your IP address is now authoritative for crymson.org. 0ne gotcha you will face is that .org domains require 2 name servers....so you're going to have to find a 2nd IP address ---and a 2nd DNS server--- to give them. If you can't get a 2nd IP, there are sites like dyndns.org that will host 2ndary DNS for you for like $15/yr. Or you can get a buddy with a Linux box to be a 2ndary (and you can be his 2ndary, etc). Another gotcha will be that your IP address will always reverse to nameofyournode.yourisp.com because they are authoritative for your IP's reverse mapping, but that shouldn't affect you hosting your own sites, that I can see.

After godaddy registers your IP as the primary DNS, then your name should start resolving within 12-24 hours.

Good luck.

Dave

----------

## Crymson

 *dkaplowitz wrote:*   

> You should deal with one issue at a time. Web, mail, DNS, ftp, etc. all in the same thread is not going to get you very far.

 

My goal here was to give background on the end result of what I want to accomplish- rather than nickel and dime it, and end up with a setup that isn't tailored for what I want to do.  But I see your point.

 *dkaplowitz wrote:*   

> As to the DNS issue. You need to configure the named.config file, then a zone file for your domain, something like db.crymson.org. In addition to this you should set the in-addr setting for your IP (the file where you put your IP in backwards with something like in-addr-... at the end). I personally do it for my 192.168.0.0 address as well as for my external IP. I don't know if that's right, but it works for me with hosting my own DNS.

 

Er... ok.  So I edit named.conf.  I've heard of a zone, but I don't really know what one is, so how do I set one up?  This is part the of aforementioned confused I've been encountering.  in-addr(-arpa?) I've heard of too, but is this vague concept that I again don't know how to deal with.

 *dkaplowitz wrote:*   

> Then, when your DNS is properly configured, you have to tell godaddy that your IP address is now authoritative for crymson.org. 0ne gotcha you will face is that .org domains require 2 name servers....so you're going to have to find a 2nd IP address ---and a 2nd DNS server--- to give them. If you can't get a 2nd IP, there are sites like dyndns.org that will host 2ndary DNS for you for like $15/yr. Or you can get a buddy with a Linux box to be a 2ndary (and you can be his 2ndary, etc). Another gotcha will be that your IP address will always reverse to nameofyournode.yourisp.com because they are authoritative for your IP's reverse mapping, but that shouldn't affect you hosting your own sites, that I can see.

 

I'm not sure where I can tell godaddy that my IP is authoritative.  I know I can specify which nameservers to use.  Is that what you mean?  Along the same lines, can't I just specify my IP as the primary, and until I get a secondary, just leave NS8.secureserver.net up there?

Thanks for your post!  It seems to be a great start so far.

----------

## dkaplowitz

 *Crymson wrote:*   

> 
> 
> Er... ok.  So I edit named.conf.  I've heard of a zone, but I don't really know what one is, so how do I set one up?  This is part the of aforementioned confused I've been encountering.  in-addr(-arpa?) I've heard of too, but is this vague concept that I again don't know how to deal with. 

 

Well you can go into the theory and nomenclature of DNS, but to get things working, think of it like this: you need to configure a named.conf file (examples online abound, just google for something like "named.conf example" you are looking for a master server configuration, not a caching only or 2ndary, etc.) It's a simple file that sets all the global settings like where your files are, which domain(s) you are hosting, etc. 

Then you need to set up a zone file for your domain, which is another file in another directory (likely the "master" directory ---or at least that's where it is in OpenBSD). This is another simple file with some directives about your domain and the hosts within it, like www.crymson.org, ftp.crymson, etc. etc. ...all your hosts go here.

Then you need to set up the in-addr.arpa file(s). Assuming your IP address was 44.33.222.111, an entry in that file would look like:

```

111.222.33.44.in-addr.arpa. IN PTR ns.crymson.org.
```

Those 3 files should do it. (Find examples of each on google, or in your favorite DNS book or online tutorial, there are millions). There are utilities that will help you test your config after you've made them. There's one called named-checkconfig or something like that that should help in the beginning. Then "dig" will help a lot.

 *Crymson wrote:*   

> 
> 
> I'm not sure where I can tell godaddy that my IP is authoritative.  I know I can specify which nameservers to use.  Is that what you mean?  Along the same lines, can't I just specify my IP as the primary, and until I get a secondary, just leave NS8.secureserver.net up there?

 

You will tell them that your IP is now the name server for that domain, so your IP is now authoritative for crymson.org. I don't think you can just leave the placeholder nameserver that godaddy uses for your 2ndary. At least my registrar (domainmonger.com) didn't allow me to do it that way. Lucky for me I have several IP addresses, so I was able to come up with a 2ndary. You might run into the same issue, and will thus need a real 2ndary name server with a 2nd IP address to give to godaddy before they release/forward your info.

----------

## dkaplowitz

Also note: usually how you change the info at godaddy is by giving them a name server like ns.yourdomain.com and they resolve the IP address. Since you are giving them just an IP address, you might have to configure it differently on their site. With my registrar I had to "create a new name server" or something to that effect, it wasn't very clear at first. Basically I had to tell them that my IPs were now name servers and they had to register those name servers for me.

----------

## Crymson

I tried changing godaddy to an IP before, when I was playing around with tinydns (which also confused me).  It wouldn't accept it, so it looks like it MUST have a name.  Kinda stupid in my opinion, since a name resolves down to an IP anyway.  You'd think they'd allow you to skip that step.

Anyway, I'll start playing with named.conf, and see what I can screw up.  Look for more soon when I have totally messed up my system, and need help!

----------

## dkaplowitz

 *Crymson wrote:*   

> I tried changing godaddy to an IP before, when I was playing around with tinydns (which also confused me).  It wouldn't accept it, so it looks like it MUST have a name.  Kinda stupid in my opinion, since a name resolves down to an IP anyway.  You'd think they'd allow you to skip that step.
> 
> 

 

I think they do that b/c they assume everyone's already got a registered name server, which is kinda' stupid. If you read their FAQ though, you should see something for people in your situation. My registrar made mention of it, but I had to dig in their docs to find it. Worst case, if it's not in their docs, contact them and tell them what you are trying to do. They should be able to help. Also, mention the .org + 2 nameservers issue. I don't think there's a way around it. Same for .info domains. .com 's are ok though, you only need one for them.

If they won't do it, then you might have to transfer the domain to a better registrar.

Either way, good luck with the config files. Once you get your first working set configured, save them, because you can just tweak those to meet your future needs. I host like 6 domains and adding new ones is really easy, but setting up the first one was pretty frustrating.

----------

## justanothergentoofanatic

You may already be aware of this, but godaddy provides free DNS, so you do not have to set up a DNS server if you don't want to. You can create A, MX, and CNAME records through the "Total DNS Control" link on their site.

You can also provide them with the IPs of your nameservers, but you must enter at least two unique IPs. This is verisign's decree, not godaddy's. To avoid that requirement, you can either enter a fake IP address or use a free service like zoneedit.com as your secondary DNS server.

-Mike

btw- not sure how your router setup works, but my Netgear router requires static IPs to be assigned within the DHCP range. Otherwise port fowarding won't work.

----------

## Crymson

I do actually want to set up DNS myself.  For one, I can learn it, and that way, when I have total control over it, I can configure it and make it work the way it works.

I was aware of that about godaddy, but thanks anyway!

----------

## splooge

I would recommend against running a primary name server even on a dynamic IP that changes only once every 8 months.  zoneedit.com is a free DNS provider that will 'propogate' (read: small TTL) updates every half hour or so.

I'm in a hurry, otherwise I'd explain further.

But if you're looking for DNS experience, you can accomplish that locally for your internal machines much the same way you would if you set it up for use on the 'net.  Not much of a difference at all.

----------

## pakman

Hrm, well I quite like bind but then I've worked with it before, you could have a look at djbdns or tinydns as mentioned. They're supposedly a bit easier to get up and running.

Anyways, basic BIND confs ahoy for domain.com (edit paths to suit):

named.conf:

```
options {

         directory "/var/bind";

         allow-query { any; };

         allow-transfer { none; };

};

zone "." IN {

        type hint;

        file "named.ca";

};

zone "domain.com" IN {

        type master;

        file "pri/domain.com.db";

};
```

and in pri/domain.com.db (/etc/named/pri/ for instance), replacing with correct ip:

```
$TTL 1H

@                       1D IN SOA       domain.com. root.domain.com. (

                                        2002081603      ; serial

                                        3H              ; refresh

                                        15M             ; retry

                                        1W              ; expiry

                                        1D )            ; minimum

;

 

@       IN      NS      ns.domain.com.

ns       IN       A        63.34.123.3

www      IN       A        63.34.123.3

@        IN       A        63.34.123.3

```

Godaddy will want a second nameserver too so I'd recommend you follow the other posters advice and use their dns service. The above confs won't work with a secondary server. You'd need to add an "allow-transfer { <ip-of-ns-2>; };" inside the zone statement in named.conf. There are a few places that will host a second ns server for you for free, www.twisted4life.com for one.Last edited by pakman on Sat May 01, 2004 4:30 pm; edited 1 time in total

----------

## Jaxom

I was new to Linux once as well, I know how staggering it can be, but one thing I found through years of slackware, redhat, and gentoo is this

www.linuxdoc.org can be a really good friend.

As a matter of fact, this is just about the same docs I used to learn to setup a true BIND server many moons ago

http://tldp.org/HOWTO/DNS-HOWTO.html#toc3

It actually helps explain it to you instead of just telling you what you need to accomplish what your current goals are.  knowledge is the key here.  Once you know how to do it and why it's done that way, you can make any alterations you need later on without pulling your hair out trying to figure out why something won't work a certain way.

Mail....there's a great docs right here on gentoo's site for mail server.  Granted it's outdated somewhat and you'll have to tinker over some things but most, if not all, questions you might have are already answered here.....Things like the SSL stuff isn't actually necessary for your kind of application unless you want to make people accept the cert all the time or buy a certificate from an Authority.

http://www.gentoo.org/doc/en/virt-mail-howto.xml

Web is relatively easy if you're just going to have the one site....cheat a little and put it all under the default path apache uses for it's test site (/var/www/localhost/ is the path it's currently using) and call it good.  Later you can toss in extra stuff.

As lastly, vsftpd is your friend.  It's realitively easy to setup, it's fast, it's secure, and once it's going, you can pretty much forget about it and it'll take care of its self.  The man pages (and config file comments) will tell you just about everything you'll need to know to set it up.

----------

## justanothergentoofanatic

those are nice links - thanks!

-Mike

----------

## Jaxom

There's another mail setup as well I just found on the gentoo site

http://www.gentoo.org/doc/en/qmail-howto.xml

depending on what you want....either will accomplish the job.  And the bueaty of linux/gentoo shows through once again.....you can mix and match them to get the server you want instead of what some huge corperation wants to "exchange" for you   :Laughing: 

----------

## MooktaKiNG

The best, most complete, and up to date howto is here:

https://forums.gentoo.org/viewtopic.php?t=56633&highlight=email+system

Its a fantastic howto. It should be turned into the email section of the desktop documentaion guide  :Smile: 

----------

## Crymson

 :Shocked:  Wow.  Lots of great information!!  Thanks guys, this has been a huge help in getting things going for me!

Hopefully with all the documentation I can read, I won't have any further problems.  Thanks again.

----------

## Solution_9

I just registered a domain at godaddy.com too. Im setting up my own DNS also. The problem that i have is for the first nameserver. I cant put in my own IP though because its not a TLD. I need a domain. But i dont have a different one to use. So is there a way around this?

----------

## Solution_9

Ok so i got the nameservers working, www.misled-life.com is going to my site. But the problem is that i want to add sub domains, and i have no idea how. I thought you could just use vhosts with apache, but its not working.

----------

## devon

 *Solution_9 wrote:*   

> Ok so i got the nameservers working, www.misled-life.com is going to my site. But the problem is that i want to add sub domains, and i have no idea how. I thought you could just use vhosts with apache, but its not working.

 

You need to add the subdomains to DNS. So ns1.twisted4life.com and static24-72-7-135.reverse.accesscomm.ca both need the subdomain.example.com record(s) setup.

----------

