View previous topic :: View next topic |
Author |
Message |
spitzwegerich l33t


Joined: 04 Mar 2003 Posts: 697 Location: Lower Bavaria, Central Europe
|
Posted: Fri Dec 26, 2003 12:32 pm Post subject: dhcpd on two NICs |
|
|
Hello!
I want to set up a dhcp-server for a non-profite youth-organisation.
At the moment there are 3 network adapters in the server. One is for the connection to the internet, the others should form two independent local area networks. (One for office boxes, one for teaching purposes.)
Both networks should receive their IPs via DHCP from the server, and they should form different IP subnets (10.0.0.X and 10.0.1.X).
So the problem is to tell dhcpd to differentiate between the 2 network adapters and to assign IPs depending on that. For administration ease I do not want to maintain a MAC-database of the clients NICs.
I had a look to the manpages of dhcpd and dhcpd.conf, but I could not find any solution besides maybe running 2 dhcpds parallel (which does not look like a clean solution to me).
I would welcome any idea on the topic (configuring dhcpd or maybe change the complete setup).
Many thanks,
~michael _________________ "Work is the curse of the drinking classes."
-Oskar Wilde |
|
Back to top |
|
 |
nasher Tux's lil' helper

Joined: 21 Feb 2003 Posts: 125
|
Posted: Fri Dec 26, 2003 1:03 pm Post subject: |
|
|
im not sure if this is what u mean but,
u've 2 nics
1st NET = 10.0.1.0
2nd NET = 10.0.2.0
in /etc/conf.d/dhcp u assign both adapters (eth0 / eth1) (or something).
then u eddit your dhcp.conf
(range dfgw ns etc)
i guess your network is something like this
the xxx are just for filling up ;o
xxxxxxxxxxxxxxxxxx/-- > <switch1> 10.0.1.0 > clients
internet eth -><- pc -
xxxxxxxxxxxxxxxxxx\-- > <switch2> 10.0.2.0 > clients
dhcp should auto assign ips to clients in the same net
i.e.,
when you hang a client in NET 10.0.1.0 he gets an ip between 10.0.1.2 10.0.1.254 (this is what u need to eddit in dhcp.conf)
---
its better to give your eth's nics ips like 10.0.1.1 and 10.0.2.1
and for clients, ranges between .50 / .200 or something
under .50 you can asssign other servers / printers and above .200(till 254) too . .
Last edited by nasher on Fri Dec 26, 2003 1:05 pm; edited 1 time in total |
|
Back to top |
|
 |
bokkepoot Tux's lil' helper


Joined: 14 Mar 2003 Posts: 123 Location: The Hague, The Netherlands
|
Posted: Fri Dec 26, 2003 1:04 pm Post subject: |
|
|
The following setup works for me with the same layout as you have: 1 nic for the world, 2 seperate local networks, and 1 dhcp running:
/etc/dhcp/dhcpd.conf
Quote: |
jen@CC494831-A dhcp $ more dhcpd.conf
ddns-update-style ad-hoc;
subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.3 192.168.1.100;
option domain-name-servers 192.168.1.2;
option domain-name "fastnet";
option routers 192.168.1.2;
allow bootp;
}
subnet 10.0.0.0 netmask 255.255.255.0
{
range 10.0.0.3 10.0.0.100;
option domain-name-servers 10.0.0.2;
option domain-name "crapnet";
option routers 10.0.0.2;
allow bootp;
}
group {
# Krupps
host krupps {
hardware ethernet 08:00:20:90:35:C5;
fixed-address 10.0.0.12;
option host-name "krupps";
filename "0A00000C";
}
}
|
and /etc/conf.d/dhcp
Quote: |
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /home/cvsroot/gentoo-x86/net-misc/dhcp/files/conf.dhcpd,v 1.4 2002/09/03 07:40:14 lostlogic E
xp $
#configure which interface or interfaces to for dhcp to listen on
#list all interfaces space separated.
IFACE="eth1 eth2"
# Insert any other options needed
DHCPD_OPTS=""
|
HTH |
|
Back to top |
|
 |
nasher Tux's lil' helper

Joined: 21 Feb 2003 Posts: 125
|
Posted: Fri Dec 26, 2003 1:07 pm Post subject: |
|
|
Quote: |
subnet 10.0.0.0 netmask 255.255.255.0
{
range 10.0.0.3 10.0.0.100;
option domain-name-servers 10.0.0.2;
option domain-name "crapnet";
option routers 10.0.0.2;
allow bootp;
}
|
subnet 10.0.0.0 = netmask 255.0.0.0 and not 255.255.255.0  |
|
Back to top |
|
 |
think4urs11 Bodhisattva


Joined: 25 Jun 2003 Posts: 6659 Location: above the cloud
|
Posted: Fri Dec 26, 2003 1:44 pm Post subject: |
|
|
nasher wrote: | Quote: |
subnet 10.0.0.0 netmask 255.255.255.0
{
range 10.0.0.3 10.0.0.100;
option domain-name-servers 10.0.0.2;
option domain-name "crapnet";
option routers 10.0.0.2;
allow bootp;
}
|
subnet 10.0.0.0 = netmask 255.0.0.0 and not 255.255.255.0  |
You're kidding, aren't you?
Classful addressing is aged out quite some time now (RFC1519). So it's perfectly valid to use 10.0.0.0/24.
I use a 10.x.y.z/28 (thats 255.255.255.240) at home to be able to connect to my office without NAT inside the VPN.
T. _________________ Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself |
|
Back to top |
|
 |
nasher Tux's lil' helper

Joined: 21 Feb 2003 Posts: 125
|
Posted: Fri Dec 26, 2003 1:50 pm Post subject: |
|
|
hm
what i've learned is
10.0.0.0 /8
172. /16
192 /24
ok i should have it wrong, but explain me why you can use subnetmasker like that  |
|
Back to top |
|
 |
think4urs11 Bodhisattva


Joined: 25 Jun 2003 Posts: 6659 Location: above the cloud
|
Posted: Fri Dec 26, 2003 2:03 pm Post subject: |
|
|
Mhhh...
what you mean (i think at least) is
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
That are the ip ranges meant for private use (RFC1918)
But nowadays it is no longer needed to use the old classful addressing scheme - meaning /8, /16, /24 dependand on the first/second octet.
At least if you don't have one of those strange boxes which still don't know about CIDR.
Today you can have subnet masks from /8 - /30 (/31) - it just depends on what you need. And (if you need offical ips) on what you can pay.
HTH
T. _________________ Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself |
|
Back to top |
|
 |
spitzwegerich l33t


Joined: 04 Mar 2003 Posts: 697 Location: Lower Bavaria, Central Europe
|
Posted: Fri Dec 26, 2003 4:18 pm Post subject: |
|
|
thanks for your answers!
My problem was that I did not understand that the subnet sections are assigned to the NICs given to dhcpd on startup. _________________ "Work is the curse of the drinking classes."
-Oskar Wilde |
|
Back to top |
|
 |
spitzwegerich l33t


Joined: 04 Mar 2003 Posts: 697 Location: Lower Bavaria, Central Europe
|
Posted: Fri Dec 26, 2003 7:54 pm Post subject: |
|
|
@bokkepoot
I started from your dhcpd.conf and tried to understand it with the manpage of dhcpd.conf. I found this:
Code: | The ad-hoc Dynamic DNS update scheme is now deprecated and does not work. In future releases of the ISC DHCP server, this scheme will not likely be available. The interim scheme works, allows for failover, and should now be used. |
So depending on your dhcp version, you should change Code: | ddns-update-style ad-hoc; |
to
Code: | ddns-update-style interim; |
_________________ "Work is the curse of the drinking classes."
-Oskar Wilde |
|
Back to top |
|
 |
|