Linux – configure a dhcp server to serve two different scope on the same subnet with multiple interfaces

dhcp-serverisc-dhcplinuxlinux-networking

Ok, so here I am with a pretty complicated problem on a Debian Wheezy server

I have three interfaces : eth0, eth1 and wlan0 on a single server, eth0 will act as a gateway for eth1 and wlan0, I have a isc-dhcp-server on the server.
I have an IP class-C range on 192.168.0.0 (serves 192.168.0.1 to 192.168.0.254)
eth0 is on 192.168.0.1
wlan0 is on 192.168.0.63
wlan0 act as an access point

each of them needs to serve 60 ip addresses
eth0 from 192.168.0.2 to 192.168.0.62
wlan0 from 192.168.0.66 to 192.168.0.126

what I'm trying to do is a way to identify quickly ethernet or wireless devices

so I'm running the dhcp server with these four config files :

/etc/dhcp/dhcpd.conf

ddns-update-style none;

option domain-name "me.fr";
option domain-name-servers 192.168.0.1;

default-lease-time -1;
max-lease-time -1;

authoritative;

log-facility local7;

#ethernet
subnet 192.168.0.0 netmask 255.255.255.192
{
         option routers 192.168.0.1;
         option subnet-mask 255.255.255.0;
         option broadcast-address 192.168.0.255;
         option domain-name-servers 192.168.0.1;
         option domain-name "me.fr";
         default-lease-time 600;
         max-lease-time 7200;
         range 192.168.0.2 192.168.0.62;
}

#wifi
subnet 192.168.0.63 netmask 255.255.255.192
{
         option routers 192.168.0.1;
         option subnet-mask 255.255.255.0;
         option broadcast-address 192.168.0.255;
         option domain-name-servers 192.168.0.1;
         option domain-name "me.fr";
         default-lease-time 600;
         max-lease-time 7200;
         range 192.168.0.66 192.168.0.126;
}

/etc/default/isc-dhcp-server

INTERFACES="eth1 wlan0"

/etc/hostapd/hostapd.conf

interface=wlan0
ssid=HAL
hw_mode=g
wpa=2
wpa_passphrase=oderojafoda2u9k
wpa_key_mgmt=WPA-PSK

/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth0 eth1
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet static
        address 192.168.0.1
        netmask 255.255.255.0

iface wlan0 inet static
        address 192.168.0.65
        netmask 255.255.255.0

but the DHCP server starts with these errors :

Mar 16 20:27:24 HAL dhcpd: Multiple interfaces match the same subnet: eth1 wlan0
Mar 16 20:27:24 HAL dhcpd: Multiple interfaces match the same shared network: eth1 wlan0

but even if the results is "Ok" and the server is actually started, it will only serves me ip on the second scope, any idea what I can do wrong ?

ps: there is a quick/easy diagram of what I'm trying to do :

Here

Thanks

Best Answer

You defined wrong network mask at, that's why dhcp server is failing to start

iface eth1 inet static
    address 192.168.0.1
    netmask 255.255.255.0

iface wlan0 inet static
    address 192.168.0.65
    netmask 255.255.255.0

Network mask should be 192 at second network.

You may just add parameter interface to subnet declarations, so every subnet is defined for a separate interface:

subnet 192.168.0.0 netmask 255.255.255.192
{
     interface eth0;
     <other staff>
}

subnet 192.168.0.63 netmask 255.255.255.192
{
     interface wlan0;
     <other staff>
}