Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
A switch, BIND, and DHCPd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
soroh6
Apprentice
Apprentice


Joined: 07 Nov 2002
Posts: 232

PostPosted: Thu Jan 16, 2003 9:22 am    Post subject: A switch, BIND, and DHCPd Reply with quote

Ok, for about a week now I've been reading anything I can find about BIND, DHCPd, etc. I've been referred to TLDP.ORG about a million times, to no avail.

It is a very useful site, but most of the DNS tutorials are based around named, not bind ;-)
(Yes, I'm aware they are the same, but still miles apart).

The setup is:
eth0 -> ISP
eth1 -> Out to the 5-port Switch.

I have acquired a fair amount of knowledge about DHCPd and BIND, but I haven't never, ever setup any of this before, and I would greatly appreciate a helping hand in this, so I can further familiarize myself with this.

I want BIND to cache DNS addresses.. and I want eth1, the local network to be 192.168.x.y, I don't care what x and y are, but I'm using 192.168.2.1 for now.

This is how eth1 boots up:
Code:
inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0


I'm not looking for an answer of.. "edit named.conf and add the entries, edit your dhcp.conf.. echo 1 to ip_forward.."

I need examples.. any advice is good advice in this case. :-)
Show me how you would do, or how your named.conf looks, so I can
compare and edit accordingly. I learn best with examples.

I was going through a BIND howto of sorts, and it just became so in depth, after creating my named.someserver.net db and such, it just totally lost me.

Regards,
--soroh6.

Thanks in advance.
_________________
:: soroh -*~
Back to top
View user's profile Send private message
psp
Tux's lil' helper
Tux's lil' helper


Joined: 06 Aug 2002
Posts: 120
Location: Cape Town, South Africa

PostPosted: Thu Jan 16, 2003 1:00 pm    Post subject: Reply with quote

From what I gather you want:
1. bind to act as a caching nameserver for your internal network.
2. dhcp server to assign addresses dynamically to your internal network.

The bind setup:
------------------
Firstly I would use the djdns package instead of bind, but this is your call.
Code:

/* This is a sample dns caching config file for bind */

options {
    /* This is where the cache file will go */
    directory "/var/named/";

    /* This is the ip address the server will bind to
         I've set this to your internal interface so only
         your clients inside the network can use this
         server */
    listen-on { 192.168.2.1 };

    /* Who can transfer from your server. I've disabled
        this - we are only caching */
    allow-transfer { none };

   /* We don't want to tell anyone if our zones are updated */
   notify no;

   /* We need to ask our nameservers if we don't know the
       answer. Set these to your external DNS servers you
       usually query. */
   forwarders { 10.0.0.1; 10.0.0.200 };

   /* We only want to forward requests and only if we don't
       know the answer ourselves. */
   forward only;

}; /* End options */

/* This just makes the server output less logs - no essential */
logging {
    category lame-servers { null; };
    category cname { null; };
    category statistics { null; };
}; /* End logging */

/* This is the DNS cache */
zone "." {
    /* Type of zone {master,slave,hint} */
    type hint;
   
    /* This is relative to "directory"  in options above. */
    file "name.ca";
};

/* We will answer for 127.0.0.1 if asked - just in case */
zone "0.0.127.in-addr.arpa" {
    type master;
    file "0.0.127.in-addr.arpa";
};

The 0.0.127.in-addr.arpa file (create in /var/named):
-------------------------------------------------------------

$TTL 10800
; The mail address uses a '.' instead of the '@'
; The dots at the end of the hostnames are IMPORTANT!
0.0.127.in-addr.arpa. IN SOA your.server.name admin.mail.address. (
    1         ; Serial Number
    86400  ; Refresh after 1 day
    3600    ; Retry after 1 hour
    604800 ; Expire after 1 week
    86400  ); Minimum negative TTL of 1 day

0.0.127.in-addr.arpa    IN    NS    your.server.name.

1.0.0.127                    IN    PTR   localhost.


That should be your dns server sorted. Start it up and see... Check the logs for problems.

DHCP setup:
--------------

I've set this up so that you have a decent default setup.

Code:

##-- GLOBAL OPTIONS
##-----------------------------------------------------------------------------#
## These options will be assigned to all of your subnets.
## You can override these settings under each subnet.

# Lease time of 1 day - You could lower this (in seconds)
default-lease-time 86400;

# Maximum amount of time the client can keep the ip.
max-lease-time 172800;

# The network's subnet mask assigned to client.
option subnet-mask 255.255.255.0;

# The network's broadcast address assigned to clients.
option broadcast-address 192.168.2.255;

# The client's default gateway - I made a  presumption.
option routers 192.168.2.1;

# The client's DNS servers - included your caching nameserver.
option domain-name-servers 192.168.2.1;
# For more servers...
# option domain-name-servers 192.168.2.1, 10.0.0.1, 10.0.0.200;

# The default domain name.
option domain-name "foo.bar";

# No dynamic DNS - If you want this I can't help (sorry)
ddns-update-style none;

# Where the lease file lives.
lease-file-name "/var/lib/dhcp/dhcpd.leases";

##-- SUBNET OPTIONS
##----------------------------------------------------------------------------#

subnet 192.168.2.0 netmask 255.255.255.0 {
    # You do not want to assign the .1 address
    # This is the ip address range you want to assign to clients.
    range 192.168.2.2 192.168.2.254;
}

##-- SINGLE MACHINE CONFIGS
##----------------------------------------------------------------------------#

# This allows you to assign the same ip to a client each time they ask.
# This is not necessary, but is useful. Allows you to change DNS settings
# etc. w/o having to change individual clients.

# boo.foo.bar

host boo {
    # This is the host's MAC address.
    hardware ethernet 00:00:00:00:00:00;
    fixed-address 192.168.2.10;
}

##-- END OF FILE
##----------------------------------------------------------------------------#


Now fire up dhcpd and you should be done.

Hope this helps :)
Back to top
View user's profile Send private message
soroh6
Apprentice
Apprentice


Joined: 07 Nov 2002
Posts: 232

PostPosted: Fri Jan 17, 2003 1:59 am    Post subject: Reply with quote

Thanks.. very well written, easy to follow. :-)
A couple questions -- should I be able to ping soroh6.net? Because I can't.
I added the /etc/hosts entry, and bound it to 192.168.2.1, but still couldn't ping it. (packets aren't received).

I guess I shouldn't be able to ping it, heh.

Code:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth1
24.68.132.0     *               255.255.252.0   U     0      0        0 eth0
default         24.68.132.1     0.0.0.0         UG    0      0        0 eth0
default         192.168.2.1     0.0.0.0         UG    1      0        0 eth1


Does that look right? 24.68 is Shaw Cable. I put the proper DNS entries into the named.conf for forwarders{}. I suppose it's all working properly, funny thing is I don't have a way to test it.

One other thing, how can I be <user>.soroh6.net by default when I log into my machine on my local internet?

As long as I add the hardware ethernet entries, anyone else who plugs into my switch should be user.soroh6.net, right? I added as such (changed from foo.bar in dhcpd.conf).

Thanks again... I wasn't expecting anything so in depth.

[edit]
DJDns?
[/edit]
_________________
:: soroh -*~
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum