Say you have a DHCP server in the LAN serving /24 network and one day you’re running out of IP addresses. You want to add additional /24 network that should be distributed in the same LAN. Ugly, but what to do.
According to man dhcpd.conf:
The shared-network statement is used to inform the DHCP server that some IP subnets actually share the same physical network. Any subnets in a shared network should be declared within a shared-network statement. Parameters specified in the shared-network statement will be used when booting clients on those subnets unless parameters provided at the subnet or host level override them. If any subnet in a shared network has addresses available for dynamic allocation, those addresses are collected into a common pool for that shared network and assigned to clients as needed. There is no way to distinguish on which subnet of a shared network a client should boot.
Here is how you add additional network to be included into DHCP scope. Done on Ubuntu 9.10 (karmic) and ISC DHCP v3.1.2.
-
shared-network "officea01" {
-
option domain-name "officea01.domain.org";
-
option domain-name-servers 192.168.1.1;
-
subnet 192.168.1.0 netmask 255.255.255.0 {
-
authoritative;
-
option routers 192.168.1.1;
-
allow unknown-clients;
-
range 192.168.1.10 192.168.1.254;
-
}
-
subnet 192.168.2.0 netmask 255.255.255.0 {
-
authoritative;
-
option routers 192.168.1.1;
-
allow unknown-clients;
-
range 192.168.2.10 192.168.2.254;
-
}
-
}
Instructions below are not necessary, however I decided to add an alias to the LAN interface so I can see 192.168.2.0/24 addresses in the ARP table.
-
ifconfig eth1:0 192.168.2.1 netmask 255.255.255.0 up
And to make it permanent edit /etc/network/interfaces:
-
auto eth1:0
-
iface eth1:0 inet static
-
address 192.168.2.1
-
netmask 255.255.255.0
-
broadcast 192.168.2.255
-
network 192.168.2.0