LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-19-2006, 09:00 PM   #1
omlex
LQ Newbie
 
Registered: Jul 2003
Posts: 22

Rep: Reputation: 15
DHCP for 2 subnets


Hi All,

I would to know how can I setup a DHCP server that will hosts two IP subnets (10.13.x.x. and 192.168.x.x) Is it possible? I only have 1 nic card which has 10.13.1.1 IP address but also I want the 192.168.x.x block can access this DHCP server.

Thanks in advance!
 
Old 12-19-2006, 09:01 PM   #2
omlex
LQ Newbie
 
Registered: Jul 2003
Posts: 22

Original Poster
Rep: Reputation: 15
BTW, kindly post the exact dhcpd.conf file if possible.

Thanks again.
 
Old 12-20-2006, 01:03 PM   #3
coolb
Member
 
Registered: Apr 2006
Location: Cape Town, South Africa
Distribution: Gentoo 2006.1(2.6.17-gentoo-r7)
Posts: 222

Rep: Reputation: 30
dhcp relay agent
 
Old 12-20-2006, 01:27 PM   #4
ninjaz
Member
 
Registered: Aug 2003
Location: Michigan
Distribution: RHEL v.4, Debian
Posts: 82

Rep: Reputation: 15
What kind of networking equipment do you use? In Cisco there is a command called "ip helper" where you can point the vlan to the dhcp/dns server. Or you could dual home it.
 
Old 12-20-2006, 01:38 PM   #5
abakali
Member
 
Registered: Dec 2005
Location: karachi
Distribution: RedHat
Posts: 75

Rep: Reputation: 15
Quote:
Originally Posted by omlex
Hi All,

I would to know how can I setup a DHCP server that will hosts two IP subnets (10.13.x.x. and 192.168.x.x) Is it possible? I only have 1 nic card which has 10.13.1.1 IP address but also I want the 192.168.x.x block can access this DHCP server.

Thanks in advance!
##########

Here is example

ddns-update-style interim;
dynamic-bootp-lease-length 86400;
max-lease-time 604800;
default-lease-time 604800;

subnet 10.0.0.0 netmask 255.255.254.0 {
option routers 10.0.0.1;
option subnet-mask 255.255.254.0;
option broadcast-address 10.0.1.255;
option nis-domain "xyz.net";
option domain-name "xyz.net";
option domain-name-servers 10.0.0.1;
option time-offset -18000;
authoritative;
option ntp-servers 10.0.0.1;
option netbios-name-servers 10.0.0.1;
option netbios-node-type 2;
range 10.0.0.80 10.0.0.100; }

subnet 192.168.5.0 netmask 255.255.255.0 {
option routers 192.168.5.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.5.255;
option nis-domain "xyz.net";
option domain-name "xyz.net";
option domain-name-servers 192.168.5.1;
option time-offset -18000;
authoritative;
option ntp-servers 192.168.5.1;
option netbios-name-servers 192.168.5.1;
option netbios-node-type 2;
range 192.168.5.50 192.168.5.220;
}
 
Old 12-20-2006, 01:41 PM   #6
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
The two responses citing dhcp-relay and Ciscos ip helper are spot on for this task. either putting a machine with dhcp-relay on the segment that needs addressing, or configuring your routing equipment to forward those requests will work. Other manufacturers have a similar command to the one Cisco provides so their routers should be able to forward those requests as well.

I had two DHCP servers handing out addressing for 15 different subnets on our network at my last job.. was nice to be able to handle all DHCP config from a single location.
 
Old 12-20-2006, 01:53 PM   #7
xjlittle
Member
 
Registered: Aug 2003
Location: Indiana
Distribution: fc6 sles9 & 10 kubuntu ubuntu-server
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
Quote:
Originally Posted by farslayer
The two responses citing dhcp-relay and Ciscos ip helper are spot on for this task. either putting a machine with dhcp-relay on the segment that needs addressing, or configuring your routing equipment to forward those requests will work.
Neither one of those responses, I don't believe, is what the OP asked for. He asked for a DHCP configuration which is obviously for a Linux box.

Abakali answered him correctly. I would only add that since he has one nic he will need to multihome it. In case you don't know how omlex the command is this:

Code:
ifconfig eth0:0 192.168.5.x netmask 255.255.255.0 up
Note that 1)this is not a permanent way for the secondary ip and 2)the ip address that I used is based on abakali's dhcp configuration. Consult your distro's documentation to find out how to make it permanent.

hth
 
Old 12-20-2006, 02:24 PM   #8
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
Without the dhcp relay or the ip helper there's no way for a broadcasted dhcp request to cross subnets.. he would in fact need a combination of the config and the relay to make it work properly. So the OP got both parts needed to solve his query. the config was not there when I read the original responses.. so I did not reference it in my reply. Ahh overlapping postings

Since I was handing out addresses for 15 subnets from a machine with a single NIC that was not multi-homed the answer is not incorrect.. The network topology would dictate the method needed to make it work properly.

I'm not sure how a multi-homed NIC is going to hand out IP addresses to two separate subnets....

DHCPD------(subnet1_10.X.X.X)-------<ROUTER1>-------(subnet2_192.X.X.X)

for this topology, either ROUTER1 needs to forward the DHCP requests to the DHCP server or there needs to be a machine with a DHCP Relay agent on it in Subent2. Workstations in subnet1 are in the same network segment as the DHCP Server so their broadcasted requests will go directly to the server.

True this is all speculation without knowing the topology of the OPs' network, but this configuration is pretty standard.

Last edited by farslayer; 12-20-2006 at 02:25 PM.
 
Old 12-20-2006, 08:03 PM   #9
omlex
LQ Newbie
 
Registered: Jul 2003
Posts: 22

Original Poster
Rep: Reputation: 15
Hi All,

Actually, my idea will be like this:

10.13.x.x------>|ROUTER ---DHCP server
192.168.x.x ----^

(shared-network 10.13.x.x and 192.168.x.x)

I'm thingking of using the mac address, however any other ideas are appreciated.

Last edited by omlex; 12-20-2006 at 08:11 PM.
 
Old 12-20-2006, 08:24 PM   #10
Windchaser
LQ Newbie
 
Registered: Dec 2006
Location: Chicago, IL
Distribution: Fedora Core 5 and 6
Posts: 23

Rep: Reputation: 15
Wouldn't you need to use vlans to accomplish this. Your network switch would assign specific vlans to individual ports and then forward the DHCP request to the DHCP server with the specific vlan specified. The test network I manage has 21 vlans defines. In my case I am using a Windows 2003 server as my DHCP server (company is a Microsoft house) and that servers uses scopes which correspond to each vlan. The configuration for the DHCP server above looks correct with the exception of any information pertaining to the vlan assignments. Unfortunately I don't have enough experience using Linux base DHCP servers to be able to give you the specifics for adding the vlan specific information to the configuration.
 
Old 12-20-2006, 08:57 PM   #11
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
* You would need a switch that understands Vlans,
* You would have to preconfigure the Clients NIC for which vlan they would be on. Otherwise how could they specify which IP range they wanted ? (more complexity and yes this could be done.. but lets walk before we try to run.. )
* The router would need to be capable of a multihomed interface so it could talk to the clients in oth vlans
* The router would need to forward dhcp requests to the DHCP server using a function such as 'ip helper'

So once you accomplish all of that, of course it would work.. and no the DHCP server doesn't need to know squat about vlan assignments it will issue an IP address based on the IP address of the segment the request originated from. So a scope for each vlan as the previous poster said..

an easier configuration that wouldn't require vlans would be, ..

10.13.x.x----(router1)-----192.168.x.x------(router2)----172.16.x.x---<DHCP server>

Or if you had a router that contained multiple (more than 2) interfaces, you could setup three segments off the same router.

Code:
10.13.x.x----(router1)-----192.168.x.x
                 |
             172.16.x.x
                 |
            <DHCP Server>
All that being said the simplest network topology that would work was the one in my original post..
Two segments, the dhcp server lives on one of them requests from the second segment are forwarded to the first..

<DHCP Server>------(subnet1_10.X.X.X)-------<ROUTER1>-------(subnet2_192.X.X.X)



So hows it going to be ?

Last edited by farslayer; 12-20-2006 at 09:00 PM.
 
Old 03-04-2007, 06:41 PM   #12
roreru
LQ Newbie
 
Registered: May 2005
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by omlex
Hi All,

I would to know how can I setup a DHCP server that will hosts two IP subnets (10.13.x.x. and 192.168.x.x) Is it possible? I only have 1 nic card which has 10.13.1.1 IP address but also I want the 192.168.x.x block can access this DHCP server.

Thanks in advance!
I am not sure if you got the answer but enclosing the two subnet declarations in shared-network, open and close brackets will do the job
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP subnets klnasveschuk Linux - Networking 2 11-17-2007 11:04 PM
2 x Subnets 2 x DHCP Authority? vaworx Linux - Networking 0 07-17-2006 05:24 AM
DHCP Server for several subnets Simon_Sez Linux - Software 5 12-30-2005 05:06 PM
One DHCP server serving 2 subnets scng Linux - Networking 3 07-12-2005 09:57 AM
DHCP assignments across two subnets otisthegbs Linux - Networking 5 04-24-2004 11:16 PM


All times are GMT -5. The time now is 06:46 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration