Koozali.org: home of the SME Server

Public DNS again

Stan Winiecki

Public DNS again
« on: October 02, 2000, 01:32:18 PM »
Hi guys,

I have posted this as a follow-up to a long-gone thread...
Excuse me for bringing it up again.

I too am interested in a DNS server able to propagate my "real" domain details (especially MX record...) to the outside world.
The proposal of having a split named seems fine, but I'm too new to Linux to set it up all by myself... <:)

The other thing is that I have a classless IP address set (16 addresses), and I want to have a working reverse lookup... I've read various texts about it and the usual suggestion is to "ask my ISP to do it on their DNS" which in my case is out of question... But this is a second problem.

If anybody has a slightly more detailed recipe on how to set up a second named for external access I would be very grateful.

N.B., I don't really need an "internal" DNS to be exact... It's just Internet access and mail, no other servers on the inside are present, nor do I need to otherwise communicate with any other machines by their names.
So maybe just transform the whole thing into an outside-visible DNS?...

Please help :-)
Stan

Stan Winiecki

RE: Public DNS again
« Reply #1 on: October 03, 2000, 02:06:47 PM »
I have temporarily rewritten the named configuration files, so that it works as an "outside" primary DNS for our domain...
The secondary DNS timeouted our MX record, so we couldn't get mail - this was therefore urgent to fix it SOMEHOW... :)

Now I have a peace of mind and can experiment with the tuneup and reverse lookups - our ISP is the national Telecom company (a typical monopoly...), and fighting with them is very time and nerve consuming... They don't provide primary DNS, only secondary... but it seems they will be able to do classless IP delegation according to RFC2317 after all... I underestimated them... :))

Anyway it works for now, but I still would like to know, how to run an "Internal" DNS for our private-numbered network AND an "External" DNS for the Rest Of The World...
If anybody can briefly explain how to do it I would be grateful.

And have forgiveness for a Linux/Internet beginner - I'm learning all the time...

Gordon Rowell

RE: Public DNS again
« Reply #2 on: October 03, 2000, 04:44:36 PM »
Stan Winiecki wrote:

> I have temporarily rewritten the named configuration files, so
> that it works as an "outside" primary DNS for our
> domain... The secondary DNS timeouted our MX record, so we
> couldn't get mail - this was therefore urgent to fix it
> SOMEHOW... :)

Yep - the problem of having reliable secondaries (and the
coordination required to set them up) is one of the reasons
we don't provide DNS primary as a standard feature.

> Now I have a peace of mind and can experiment with the tuneup
> and reverse lookups - our ISP is the national Telecom company
> (a typical monopoly...), and fighting with them is very time
> and nerve consuming... They don't provide primary DNS, only
> secondary... but it seems they will be able to do classless IP
> delegation according to RFC2317 after all... I underestimated
> them... :))

Wow - I know lots of ISPs who say "Huh?" when asked about
RFC2317.

> Anyway it works for now, but I still would like to know, how to
> run an "Internal" DNS for our private-numbered
> network AND an "External" DNS for the Rest Of The
> World... If anybody can briefly explain how to do it I would be
> grateful.

OK - there are two ways to do this.

The simple way, which I do _not_ recommend is to merge what you have
done into templates-custom so that named provides local and
remote DNS. You will need to change the listen-on clause. I don't
recommend this as there are too many opportunities for DNS pollution
from the internal fake zone to the real world. I'm also not happy about
the security of this setup as you can't easily/cleanly restrict queries
about the internal zones to internal networks (yes, you can, but...)

The better option, IMO is:
  - Put the original named.conf back to handle DNS caching and the local
    network. Leave it listening to localhost and the internal network only
  - Create a second named.conf for the external zones only
  - Make this one listen-on the external interface only

People talking to port 53 on the external interface get external DNS only.

People talking to localhost and the internal interface get internal DNS
and cached external DNS.

There are various BIND security documents you should also read, including
a CERT advisory on limiting remote queries to only servicing your zones to
limit denial-of-service through remote recursive queries.

> And have forgiveness for a Linux/Internet beginner - I'm
> learning all the time...

Sounds like you're doing fine. Maybe you could write up what you have done in
detail?

Gordon

Stan Winiecki

RE: Public DNS again
« Reply #3 on: October 03, 2000, 07:35:53 PM »
Gordon Rowell wrote:

...[SNIP]...
> Yep - the problem of having reliable secondaries (and the
> coordination required to set them up) is one of the reasons we
> don't provide DNS primary as a standard feature.

It was a little painful to realize, that the former server in the company had a DNS on it, with the ISP's one as a secondary. I had to brutally discard the old server when I joined the company [explained elsewhere in the Phorum :)] The timeout value for the DNS entry was about 6 weeks, so suddenly it just disappeared from the secondary DNS and we "ceased to exist" :)) That's why I had to do it the quick and dirty way, by editing the current named config files and changing the listening address.
I didn't like the idea of polluting the Net with private IP numbers too, so I just deleted the whole "internal" part.
Now I have to:
1) set up the reverse lookups
2) do the whole thing the proper way (templates) :))

...[SNIP]...

> Wow - I know lots of ISPs who say "Huh?" when asked
> about RFC2317.
That's why I doubted mine... :))

...[SNIP]...

Thanks for all the tips, basically that's what I imagined - my problem as a beginner is how to instruct the second instance of named to use a different set of configuration files... That's what  I need to learn <:))

Gordon Rowell

RE: Public DNS again
« Reply #4 on: October 04, 2000, 09:08:42 PM »
Stan Winiecki wrote:

> Thanks for all the tips, basically that's what I imagined - my problem
> as a beginner is how to instruct the second instance of named to use
> a different set of configuration files... That's what I need to learn <:))

"man named" is the place to start ( "named -c {filename}" BTW).

You will also need to start this instance of named separately - the
e-smith one is started from inittab.

Gordon

R Allen

RE: Public DNS again
« Reply #5 on: October 18, 2000, 09:18:11 PM »
Gordon Rowell wrote:

>   The better option, IMO is:
>   - Put the original named.conf back to handle DNS caching and the local
>   network. Leave it listening to localhost and the internal network only
>   - Create a second named.conf for the external zones only
>   - Make this one listen-on the external interface only
>
>   People talking to port 53 on the external interface get external DNS only.
>
>
>   People talking to localhost and the internal interface get internal DNS
>   and cached external DNS.

I Still want to learn how to load 2 different named.conf.  Any hints would be appreciated.

Gordon has been asking for a write up on creating a Public DNS server.  This is what I did
to make my e-smith machine a public web server for my domain. (Please feel free to email
any corrections you may find in this back to me -- rseller@netzero.net).

====================================
==Instructions on how to set up DNS to Host a Public Website.
====================================
Before you start:
   To transfer your website to your machine you need to have 2 DNS servers.  Your
   e-smith machine can be one of them, but you will need a second.  This can be
   done by a second e-smith machine on a different static IP number.  You can also
   do this by paying a fee and using a public DNS or having a friend machine be your
   secondary DNS server.

Assumptions:
   These instructions assume you have a 2 static IP number (111.222.0.3, 111.222.0.4)
   The E-smith machine is a gateway with two Net cards.  The Internal IP is 192.168.0.1.
   The new domain you are hosting is: mycompany.com

=====================================================
==Turning your E-smith machine into a public DNS server:
=====================================================
   1) create a directory /etc/e-smith/templates-custome/etc/named.conf  (recommended command: mkdir).
                mkdir /etc/e-smith/templates-custom
                mkdir /etc/e-smith/templates-custom/etc
                mkdir /etc/e-smith/templates-custom/etc/named.conf
   2) copy default templates to the custom directories from /etc/e-smith/templates/etc/named.conf/*
                cp /etc/e-smith/templates/etc/named.conf/* /etc/e-smith/templates-custom/etc/named.conf/.
   3) Edit template-begin file for the named.conf templates. (recommended editor: pico)
                pico /etc/e-smith/templates-custom/etc/named.conf/template-begin
   4) Update the "listen on" line (around line 36) to include the external Ip number:
               From:        listen-on \{ 127.0.0.1; { $LocalIP }; \};
               To:           listen-on \{ 127.0.0.1; { $LocalIP }; { $ExternalIP }; \};
   5) Add a zone record for mycompany.com
               Insert the following records after the "local host PTR records"
                        #-----------------------------------------
                        #  mycompany.com domain
                        #-----------------------------------------
                        zone "mycompany.com" \{
                                type master;
                                file "mycompany.host";
                                \};
  6) create/edit the file: /var/named/mycompany.host    (pico /var/named/mycompany.host)
           Add the following lines:
                        @ IN SOA mycompany.com admin.mycompany.com. (
                                                              2000092201 ; Serial
                                                              8H      ; Refresh
                                                              2H      ; Retry
                                                              7D    ; Expire
                                                              1D )    ; Minimum
                                              IN      NS      ns1
                                              IN      NS      ns2
                                              IN      MX 10   mail
                        mycompany.com.  IN      A       111.222.0.3
                        ns1                    IN      A       111.222.0.3
                        ns2                    IN      A       111.222.0.5
                        mail                   IN      A       111.222.0.3
                        www                  IN      A       111.222.0.3
                        ftp                     IN      A       111.222.0.3
                        int-mail               IN      A       192.168.0.1
  7) Regenerate the named.conf file from the custom templates:
         /sbin/e-smith/expand-template /etc/named.conf
  8) Reload the DNS server with the new values
         ndc reload
****************** Your DNS server should be up and running without needing a Reboot ***************
  9) Test your dns server
         nslookup www.mycompany.com 111.222.0.3

====================================
==Register your DNS on the Internet:
====================================
  1) Go to the site where you registered your domain.  I went to www.networksolutions.com
              select create a new host.  (Host = DNS server)
              enter your static IP number: 111.222.0.3
              enter the name for the ip number:   ns1.mycompany.com  (don't worry if your isp has a different name mapped to this address)
  2) Registered the second e-smith machine (if you have 2)
              IP: 111.222.0.5
              name: ns2.mycompany.com    (remember this can be any name you want within your domain).
  3) Go through the form to "change ISP" to move your domain to your e-smith server.
              Primary Name Server IP     : 111.222.0.3
              Primary Name Server Name:  ns1.mycompany.com
              Secondary Name Server IP : 111.222.0.5
              Secondary Name Server Name: ns2.mycompany.com

====================================
==Notes about email
====================================
E-smith uses qmail to do all its email.  You can select from the web bases manager to
make the email boxes public or private to the outside world.  The sending mail feature
is set to private (to avoid spammers abusing your machine).  It controls this by allowing
send request in on the inside IP number and rejects them from the outside IP number.
This is what generated the famous error "553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)".

I help avoid this by setting up the address int-mail.mycompany.com (this is short for internal-mail) which
points it to the internal IP number on the e-smith machine.  Since 192.168 ip numbers are publicly routed, this
address can only be used inside the same building as the e-smith machine.  Therefore I have all my workers
set their mail clients to use int-mail.mycompany.com as its incoming and outgoing mail server.  This
make sure they access the mail from the inside/private side.

Gordon Rowell

RE: Public DNS again
« Reply #6 on: October 19, 2000, 08:59:50 PM »
R Allen wrote:

> I Still want to learn how to load 2 different named.conf. Any hints
> would be appreciated.

Create /etc/named.conf.primary which listens on the external interface

Create the zone files (as you have done)

Add another fragment to the /etc/inittab template to start up another
instance. The second instance would specify a different named.conf
file (e.g. /usr/sbin/named -c /etc/named.conf.primary)

telinit q

> Gordon has been asking for a write up on creating a Public DNS server.
> This is what I did to make my e-smith machine a public web server
> for my domain. (Please feel free to email any corrections you may
> find in this back to me -- rseller@netzero.net).
> [...]

This is great - thank you for writing this up.

Gordon

Stephen Davis

RE: Public DNS again
« Reply #7 on: April 09, 2001, 01:48:42 AM »
What happens if you have your e-smith configured as a server only. Then Step 4 does not exist. There is no listen.

What then?


=====================================================
==Turning your E-smith machine into a public DNS server:
=====================================================
1) create a directory /etc/e-smith/templates-custome/etc/named.conf (recommended command: mkdir).
mkdir /etc/e-smith/templates-custom
mkdir /etc/e-smith/templates-custom/etc
mkdir /etc/e-smith/templates-custom/etc/named.conf
2) copy default templates to the custom directories from /etc/e-smith/templates/etc/named.conf/*
cp /etc/e-smith/templates/etc/named.conf/* /etc/e-smith/templates-custom/etc/named.conf/.
3) Edit template-begin file for the named.conf templates. (recommended editor: pico)
pico /etc/e-smith/templates-custom/etc/named.conf/template-begin
4) Update the "listen on" line (around line 36) to include the external Ip number:
From: listen-on \{ 127.0.0.1; { $LocalIP }; \};
To: listen-on \{ 127.0.0.1; { $LocalIP }; { $ExternalIP }; \};
5) Add a zone record for mycompany.com
Insert the following records after the "local host PTR records"
#-----------------------------------------
# mycompany.com domain
#-----------------------------------------
zone "mycompany.com" \{
type master;
file "mycompany.host";
\};
6) create/edit the file: /var/named/mycompany.host (pico /var/named/mycompany.host)
Add the following lines:
@ IN SOA mycompany.com admin.mycompany.com. (
2000092201 ; Serial
8H ; Refresh
2H ; Retry
7D ; Expire
1D ) ; Minimum
IN NS ns1
IN NS ns2
IN MX 10 mail
mycompany.com. IN A 111.222.0.3
ns1 IN A 111.222.0.3
ns2 IN A 111.222.0.5
mail IN A 111.222.0.3
www IN A 111.222.0.3
ftp IN A 111.222.0.3
int-mail IN A 192.168.0.1
7) Regenerate the named.conf file from the custom templates:
/sbin/e-smith/expand-template /etc/named.conf
8) Reload the DNS server with the new values
ndc reload
****************** Your DNS server should be up and running without needing a Reboot ***************
9) Test your dns server
nslookup www.mycompany.com 111.222.0.3

====================================
==Register your DNS on the Internet:
====================================
1) Go to the site where you registered your domain. I went to www.networksolutions.com
select create a new host. (Host = DNS server)
enter your static IP number: 111.222.0.3
enter the name for the ip number: ns1.mycompany.com (don't worry if your isp has a different name mapped to this address)
2) Registered the second e-smith machine (if you have 2)
IP: 111.222.0.5
name: ns2.mycompany.com (remember this can be any name you want within your domain).
3) Go through the form to "change ISP" to move your domain to your e-smith server.
Primary Name Server IP : 111.222.0.3
Primary Name Server Name: ns1.mycompany.com
Secondary Name Server IP : 111.222.0.5
Secondary Name Server Name: ns2.mycompany.com

====================================
==Notes about email
====================================
E-smith uses qmail to do all its email. You can select from the web bases manager to
make the email boxes public or private to the outside world. The sending mail feature
is set to private (to avoid spammers abusing your machine). It controls this by allowing
send request in on the inside IP number and rejects them from the outside IP number.
This is what generated the famous error "553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)".

I help avoid this by setting up the address int-mail.mycompany.com (this is short for internal-mail) which
points it to the internal IP number on the e-smith machine. Since 192.168 ip numbers are publicly routed, this
address can only be used inside the same building as the e-smith machine. Therefore I have all my workers
set their mail clients to use int-mail.mycompany.com as its incoming and outgoing mail server. This
make sure they access the mail from the inside/private side.

Gordon Rowell

RE: Public DNS again
« Reply #8 on: April 09, 2001, 04:55:00 AM »
Stephen Davis wrote:
>
> What happens if you have your e-smith configured as a server
> only. Then Step 4 does not exist. There is no listen.
>
> What then?

As documented in the manual on www.e-smith.org/docs/manual, do not run in server-only mode on a public network. This disables the packet filters, and you also trust the entire subnet for access to the manager, etc. Don't do this.

> =====================================================
> ==Turning your E-smith machine into a public DNS server:
> =====================================================

Thank you for the write-up. I will however repeat my previous warnings.

e-smith strongly advises that people do not set up public DNS on their servers unless they know all of the ramifications. If you are thinking about doing this, I suggest you look at djbdns rather than bind.

The e-smith DNS configuration is designed to reject external network connections, and has thus not been subject to the various worms and other attacks on DNS.

> [...]
> 4) Update the "listen on" line (around line 36) to include
> the external Ip number:
> From: listen-on \{ 127.0.0.1; { $LocalIP }; \};
> To: listen-on \{ 127.0.0.1; { $LocalIP }; { $ExternalIP }; \};

I would suggest you instead run two DNS servers in two chroot() jails. One is the existing e-smith configuration and the other serves your public zones (preferably with djbdns rather than bind). Adding $ExternalIP to the existing configuration opens the e-smith configuration to the potential for external DNS compromise.

> [...]
> 6) create/edit the file: /var/named/mycompany.host (pico
> /var/named/mycompany.host)

These should be in the chroot() jail.

> [...]
> 7) Regenerate the named.conf file from the custom templates:
> /sbin/e-smith/expand-template /etc/named.conf

There are actions scripts conf-named and restart-named which perform these steps and ensure that the files go to the correct places and have the correct permissions.

> [...]
> I help avoid this by setting up the address
> int-mail.mycompany.com (this is short for internal-mail) which
> points it to the internal IP number on the e-smith machine.
> Since 192.168 ip numbers are publicly routed, this
> address can only be used inside the same building as the
> e-smith machine. Therefore I have all my workers
> set their mail clients to use int-mail.mycompany.com as its
> incoming and outgoing mail server. This
> make sure they access the mail from the inside/private side.

That's precisely what server-gateway mode is designed to do.

You should never publish RFC1918 addresss (such as 192.168.x.y) in the public DNS. Doing so can lead to black hole mail outages if you get things wrong.

Gordon

Gordon Rowell

RE: Public DNS again
« Reply #9 on: April 09, 2001, 05:05:16 AM »
Sorry, I should also mention that the write-up above is for 4.0

named runs in a chroot() jail for 4.1, and these instructions will need to be modified.

Gordon

Charlie Brady

Public DNS warning (was RE: Public DNS again)
« Reply #10 on: April 09, 2001, 05:18:35 AM »
Gordon Rowell wrote:
>
> Sorry, I should also mention that the write-up above is for 4.0
>
> named runs in a chroot() jail for 4.1, and these instructions
> will need to be modified.

And it is worth mentioning that anyone running 4.0 with an externally available DNS server might be lucky not to have had their server compromised by now. Upgrading to 4.1.1 is very strongly advised. At the very least, upgrading to bind 8.2.3 is recommended.

Charlie

Olivier Arpagaus

RE: Public DNS again
« Reply #11 on: April 19, 2001, 12:34:29 AM »
Hello,

I have tried to set up DNS. Like the instructions from R Allen but at the 4th step I have a problem. My file template-begin look like this

UW PICO(tm) 3.8    File: .../etc/named.conf/template-begin

#------------------------------------------------------------
# DO NOT MODIFY THIS FILE! It is updated automatically by the
# e-smith server and gateway software. Instead, modify the source
# template in the /etc/e-smith/templates directory. For more
# information, see http://www.e-smith.org.
#
# copyright (C) 1999, 2000 e-smith, inc.
#------------------------------------------------------------

The file is empty and so I could not find the line 36 also I can not update the "listen on" line.

What is the problem?

Please help :-)

Olivier

R Allen

RE: Public DNS again
« Reply #12 on: April 19, 2001, 04:13:28 AM »
These Instructions Listed above are for Esmith version 4.0.

Version 4.1 does DNS differently and these instructions will NOT work for Esmith Version 4.1 or greater.

I am in the process of writing new instructions for version 4.1, once I know they will work.

R Allen

Stephen Davis

RE: Public DNS again
« Reply #13 on: July 13, 2001, 10:11:58 PM »
Mr. Allen,

Any progress on the public DNS for 4.1?

Thanks in advance, Steve


R Allen wrote:
>
> These Instructions Listed above are for Esmith version 4.0.
>
> Version 4.1 does DNS differently and these instructions will
> NOT work for Esmith Version 4.1 or greater.
>
> I am in the process of writing new instructions for version
> 4.1, once I know they will work.
>
> R Allen

Dave Wilson

RE: Public DNS again
« Reply #14 on: February 08, 2002, 12:42:59 AM »
Even better, does anyone know how to do this in 5.1.2?