LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 06-21-2010, 10:42 AM   #1
applebees
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Rep: Reputation: 0
How to config DHCP for multiple subnet


Hello,

I have a network with multiple subnets from 10.12.056.0 to 10.12.060.0 using net-mask 255.255.248.0 and one gateway 10.12.056.1. I want to setup a dhcp server and wonder how should I config it? All the hosts in the network using the same net-mask and gateway.

Thanks,
 
Old 06-22-2010, 03:11 AM   #2
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
You say they have different subnets right?
Then I wonder how this will work using the same gateway for each network.

Do you want to assign specific IPs to specific machines? Is each network on a different interface?
 
Old 06-23-2010, 05:14 AM   #3
daveginorge
Member
 
Registered: Oct 2006
Location: Porsgrunn, Norway
Distribution: CentOS 5 / 6 / 7
Posts: 107

Rep: Reputation: 16
Here's my DHCP conf

Code:
default-lease-time 600;
max-lease-time 7200;

option domain-name "domain.no";


subnet 10.70.70.0 netmask 255.255.255.0 {
	option broadcast-address 10.70.70.255;
	option subnet-mask 255.255.255.0;
	option routers 10.70.70.1;
	option time-servers 10.70.70.1;
	option domain-name-servers 10.70.70.2, 10.70.70.1;
	range 10.70.70.130 10.70.70.149;
}

subnet 192.168.1.0 netmask 255.255.255.0 {
	option broadcast-address 192.168.1.255;
	option subnet-mask 255.255.255.0;
	option routers 192.168.1.1;
	option time-servers 192.168.1.1;
	option domain-name-servers 192.168.1.1;
	range 192.168.1.130 192.168.1.149;
}

subnet 192.168.2.0 netmask 255.255.255.0 {
	option broadcast-address 192.168.2.255;
	option subnet-mask 255.255.255.0;
	option routers 192.168.2.1;
	option time-servers 192.168.2.1;
	option domain-name-servers 192.168.2.1;
	range 192.168.2.130 192.168.2.149;
}

subnet 192.168.3.0 netmask 255.255.255.0 {
	option broadcast-address 192.168.3.255;
	option subnet-mask 255.255.255.0;
	option routers 192.168.3.1;
	option time-servers 192.168.3.1;
	option domain-name-servers 192.168.3.1;
	range 192.168.3.130 192.168.3.149;
}

subnet 192.168.122.0 netmask 255.255.255.0 {
	option broadcast-address 192.168.122.255;
	option subnet-mask 255.255.255.0;
	option routers 192.168.122.1;
	option time-servers 192.168.122.1;
	option domain-name-servers 192.168.122.1;
	range 192.168.122.130 192.168.122.149;
}
Hope this helps
 
Old 06-28-2010, 10:17 AM   #4
applebees
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by deadeyes View Post
You say they have different subnets right?
Then I wonder how this will work using the same gateway for each network.

Do you want to assign specific IPs to specific machines? Is each network on a different interface?
Thanks for reply. Since it's a supernet uses netmask 255.255.248.0, it works.
The Dhcp server runs correctly with subnet 10.12.056.x, but not for other subnet although i put default gateway in all dhcpd.conf blogs. Any suggestion?

Thanks,
 
Old 06-29-2010, 08:11 PM   #5
volga629
Member
 
Registered: Dec 2009
Posts: 67

Rep: Reputation: 21
Arrow

Hi,
I would say you need use share network configuration for DHCP like this example

Quote:
shared-network name {
option domain-name "test.xxxxx";
option domain-name-servers ns1.xxxxxxxx, ns2.xxxxxxx;
option routers 192.168.1.254;
more parameters for EXAMPLE shared-network
subnet 192.168.1.0 netmask 255.255.255.0 {
parameters for subnet
range 192.168.1.1 192.168.1.31;
}
subnet 192.168.1.32 netmask 255.255.255.0 {
parameters for subnet
range 192.168.1.33 192.168.1.63;
}
}
and here the fixed IP another word DHCP reservation
Quote:

host name {
option host-name "name.xxxxxxx";
hardware ethernet 00:A0:78:8E:9E:AA;
fixed-address 192.168.1.4;
}
and last one is ip range declaration just single subnet

Quote:
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "example.com";

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
}
and here part of my dhcpd.conf about share networks
Quote:

ddns-update-style none;
deny bootp;
option wpad code 252 = text;


shared-network name {
interface name;
server-identifier xxxxxxxxxx; <-----default gateway
subnet xxxxxxxx netmask xxxxxxxx {

pool {
deny dynamic bootp clients;
default-lease-time 288000;
max-lease-time 576000;

option subnet-mask xxxxxxxxx;
option routers xxxxxxxxx;
option wpad "http://xxxxxxxxx/proxy.pac";
option domain-name-servers xxxxxxxxxxx, xxxxxxxxxxxx;
range xxxxxxxxx xxxxxxxxxxxxx;
}
}
}
Enjoy
 
  


Reply



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 problems using multiple external NICs on same subnet Leffster Linux - Networking 2 11-18-2008 11:46 AM
DHCP - Multiple range in 1 subnet??? - Debian Sarge 3.1, DHCP3.0 kenwoodgt Linux - Networking 1 01-24-2008 03:23 PM
ADSL DHCP A-OK, but Mandrake 10.1 to be DHCP for other subnet is a problem turnbui Linux - Networking 2 08-20-2005 09:34 AM
DHCP Subnet Problems Hunza Linux - Networking 14 06-14-2004 03:38 AM
unable to get out of my subnet w/o dhcp wendallsan Linux - Networking 8 10-13-2003 02:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:55 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
Open Source Consulting | Domain Registration