LinuxQuestions.org
Help answer threads with 0 replies.
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 01-20-2008, 01:42 PM   #1
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,121

Rep: Reputation: 58
DHCPD and Assigning Subnets to Different Interfaces


How would I assign a range of ip's from differents subnets on different interface cards. Example:

eth0 - 192.168.5.0/27 and eth1 - 192.168.4.0/27 using dhcpd

help
 
Old 01-20-2008, 04:02 PM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
/etc/dhcpd.conf doesn't explicitly reference interfaces (eth0, etc), just subnets. (I am assuming you already have your interfaces configured properly.)

Here is a dhcpd.conf I use with two subnets, each on its own card. (I've obfuscated the exact addresses with Xs.)

Code:
ddns-update-style ad-hoc

subnet 192.168.2.0 netmask 255.255.255.0 {
    range 192.168.2.XX 192.168.2.XX;
    default-lease-time 7200;
    max-lease-time 21600;
    option routers 192.168.2.XXX;
    option ip-forwarding off;
    option broadcast-address 192.168.2.255;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 65.XX.XX.XX, 65.XX.XX.XX;
  }

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.XX 192.168.1.XX;
    min-secs 3;
    default-lease-time 7200;
    max-lease-time 21600;
    option routers 192.168.1.X;
    option ip-forwarding off;
    option broadcast-address 192.168.1.255;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 65.XX.XX.XX, 65.XX.XX.XX;
  }
I hope this helps.
 
Old 01-20-2008, 10:13 PM   #3
finegan
Guru
 
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700

Rep: Reputation: 57
2 conf files, two seperate dhcpd invokes, so:

dhcpd -cf /etc/dhcpd-network1 eth0
dhcpd -cf /etc/dhcpd-network2 eth1

Cheers,

Finegan
 
Old 01-21-2008, 09:00 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
//mod note - code tag chat moved to new thread

you don't need two files, that's really not a great design to follow. the pool that is allocated from is the one upon which the dhcp request is heard, it's all implicit. similarily, if you use a dhcp relay in a router elsewhere in the netwrok that will forward requests to the server including the ip address of it's listening interface so that too knows which network toallocate from.

Last edited by acid_kewpie; 01-21-2008 at 09:04 AM.
 
Old 01-24-2008, 08:19 AM   #5
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,121

Original Poster
Rep: Reputation: 58
PHP Code:
ddns-update-style ad-hoc

subnet 192.168.2.0 netmask 255.255.255.0 
{
    
range 192.168.2.XX 192.168.2.XX;
    default-
lease-time 7200;
    
max-lease-time 21600;
    
option routers 192.168.2.XXX;
    
option ip-forwarding off;
    
option broadcast-address 192.168.2.255;
    
option subnet-mask 255.255.255.0;
    
option domain-name-servers 65.XX.XX.XX65.XX.XX.XX;
  }

subnet 192.168.1.0 netmask 255.255.255.0 {
    
range 192.168.1.XX 192.168.1.XX;
    
min-secs 3;
    default-
lease-time 7200;
    
max-lease-time 21600;
    
option routers 192.168.1.X;
    
option ip-forwarding off;
    
option broadcast-address 192.168.1.255;
    
option subnet-mask 255.255.255.0;
    
option domain-name-servers 65.XX.XX.XX65.XX.XX.XX;
  } 

that I understand but

Quote:
Here is a dhcpd.conf I use with two subnets, each on its own card.
So just adding these different subnets in dhcpd.conf should work, so I dont need to:

PHP Code:
dhcpd -cf /etc/dhcpd-network1 eth0
dhcpd 
-cf /etc/dhcpd-network2 eth1 

correct? I am a bit confused. thanks
 
Old 01-24-2008, 11:47 AM   #6
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
One dhcpd server,
one dhcpd config file
dhcp relay agent - http://linux.die.net/man/8/dhcrelay

relaying can be done by a workstation, server, router, etc.. the relay agent will be located on any subnets that do not have a local dhcp server on them.

I used ONE dhcp server to hand out addressing to 20 subnets and used the ip helper-address command in the cisco routers to forward all dhcp requests to my dhcp server. It worked flawlessly.
 
Old 01-24-2008, 12:09 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
can't find a nice ascii block diagram for it, but check http://www.cisco.com/en/US/tech/tk64...80094b50.shtml

you can see a nice debug of a bootp relay packet there, and in there is the IP address of the cisco router which would have the ip helper-address on it, and so when the dhcp server recieves it it has a reference point to use to know what subnet is relevant.
 
Old 01-25-2008, 12:50 AM   #8
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by metallica1973 View Post
So just adding these different subnets in dhcpd.conf should work, so I dont need to:

Code:
dhcpd -cf /etc/dhcpd-network1 eth0
dhcpd -cf /etc/dhcpd-network2 eth1
correct? I am a bit confused. thanks (Empahsis added)
Correct. If I understand your situation, you just need one conf file similar to what I posted (adjust as needed) and one instance of dhcpd. dchpd knows the configuration of each of your NICs and will assign addresses from the proper subnet. As best as I can figure out, the rest of this conversation about relaying, etc. while it might be correct, is beyond what I take to be your fairly basic needs.

EDIT: Just to be clear, my single instance of dhcpd is invoked from within my distoro's /etc/init.d/dhcpd script, but no parameters are supplied to dhcpd. So it is looking at all (in my case, two) NICs.

Last edited by blackhole54; 01-25-2008 at 02:48 AM.
 
Old 01-25-2008, 06:22 AM   #9
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,121

Original Poster
Rep: Reputation: 58
I am going to make another post because I screwed things up last. Many thanks
 
  


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
dhcpd on multiple ethernet interfaces Jestrik Linux - Networking 10 10-03-2011 10:40 AM
dhcpd - Not configured to listen on any interfaces. ritter Linux - Networking 1 07-05-2004 04:48 PM
Assigning services to interfaces seanro Slackware 2 03-16-2004 11:18 PM
DHCPD two subnets on the same network taggedd Linux - Networking 4 10-27-2003 12:29 PM
DHCPd for multiple interfaces Noerr Linux - Networking 2 02-07-2003 07:40 PM


All times are GMT -5. The time now is 02:25 AM.

Main Menu
Advertisement
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