LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Setting up a DHCP server with multiple network interfaces - Debian (http://www.linuxquestions.org/questions/linux-networking-3/setting-up-a-dhcp-server-with-multiple-network-interfaces-debian-648404/)

Srz0rz 06-10-2008 07:49 PM

Setting up a DHCP server with multiple network interfaces - Debian
 
Hi,

I am trying to set up a gateway/router/firewall box for a small business. The requirements for the job are that the box must serve up internet to the business and also to the apartment downstairs and I am having trouble configuring the DHCP server on the gateway.

The gateway has three Network Interface Cards:
eth0: which connects to the modem and the rest of the internet
eth1: which goes downstairs, to serve the apartment
eth2: which serves the small business
The DHCP server should assign all dynamic ip addresses to the downstairs network (eth1), in the range 192.168.0.0 - 192.168.0.255

The upstairs (business) should assign static ip addresses to the servers on the network and dynamically assign ip addresses to any other computers asking for a DHCP lease on the eht2 interface. The addresses assigned to this network should be in the range of 10.0.0.0 - 10.0.0.255

My problem is that computers connected to the 'eth1' interface do not receive an ip address. After connecting a computer to the eth1 interface the computer requests an ip address, but none comes.

NOTE: I am quite sure this is not a hardware fault, I have tested the system first with a crossover cable and a computer directly connected to the router interface and also with both computers connected to a switch using patch cables.

The contents of my /etc/dhcp3/dhcpd.conf file are as follows:

[Global Options]....

subnet 10.0.0.0 subnet 255.255.255.0 {
interface eth2;
option routers 10.0.0.254;
option subnet-mask 255.255.255.0;

option domain-name-servers 10.0.0.254;
}

subnet 192.168.0.0 subnet 255.255.255.0 {
interface eth1;
option routers 192.168.0.254;
option subnet-mask 255.255.255.0;

option domain-name-servers 192.168.0.1;
}

Any help with this would be much appreciated.

emi_ramo 06-11-2008 03:48 AM

Quote:

subnet 10.0.0.0 subnet 255.255.255.0 {

interface eth2;
option routers 10.0.0.254;
option subnet-mask 255.255.255.0;

option domain-name-servers 10.0.0.254;

}

subnet 192.168.0.0 subnet 255.255.255.0 {

interface eth1;
option routers 192.168.0.254;
option subnet-mask 255.255.255.0;

option domain-name-servers 192.168.0.1;

}
Hi!
you've wrote subnet

Code:

subnet 192.168.0.0 subnet 255.255.255.0
where may be you wanted to wrote

Code:

subnet 192.168.0.0 netmask 255.255.255.0
Try correcting this. And may be you need to add an option like

Code:

range  192.168.0.50  192.168.0.100;
inside each subnet. If problem persists, come here again.

See you!!
emi

Srz0rz 06-11-2008 05:35 PM

Hi, thanks for the quick reply. When I posted last time I didn't have the actual /etc/dhcp3/dhcpd.conf file at hand, which is why i made a mistake typing it out. Here is the actual file

Code:

##########################################
#####----- Global Configuration -----#####
##########################################
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
#one-lease-per-client false;
#allow bootp;

ddns-update-style none;

option domain-name "vlan.local";
option domain-name-servers    210.56.15.1, 231.117.250.27;

default-lease-time 6000;
max-lease-time 7200;

authoritative;
##############################################
#####----- End Global Configuration -----#####
##############################################

###############################################
#####----- Start Modem Configuration -----#####
###############################################
subnet 192.168.1.0 netmask 255.255.255.0 {
        interface eth0;
}
#############################################
#####----- End Modem Configuration -----#####
#############################################

####################################################
#####----- Start Downstairs Configuration -----#####
####################################################
subnet 192.168.0.0 netmask 255.255.255.0 {
        interface eth1;
        default-lease-time 6000;
        max-lease-time 7200;
        option subnet-mask 255.255.255.0;
        option routers 192.168.0.254;
        option broadcast-address 192.168.0.255;
}
##################################################
#####----- End Downstairs Configuration -----#####
##################################################

##################################################
#####----- Start Upstairs Configuration -----#####
##################################################
subnet 10.0.0.0 netmask 255.255.255.0 {
        interface eth2;
        default-lease-time 6000;
        max-lease-time 7200;
        range 10.0.0.100 10.0.0.200;
        option subnet-mask 255.255.255.0;
        option routers 10.0.0.254;
        option broadcast-address 10.0.0.255;
}
################################################
#####----- End Upstairs Configuration -----#####
################################################

#####################################################################
#####----- Start Server and Fixed IP Address Configuration -----#####
#####################################################################
group{
        ###--- Any global server settings should go here ---###

        #- Printer -#
        host printer {
                hardware ethernet 00:00:00:00:00:00;
                fixed-address 10.0.0.25;
                }
        #- J computer -#
        host j {
                hardware ethernet 00:00:00:00:00:00;
                fixed-address 10.0.0.105;                                       
        }
        #- TServer computer -#
        host tserver {
                hardware ethernet 00:00:00:00:00:00;
                fixed-address 10.0.0.110;
        }
        #- Windows 2008 Server -#
        host win2008server {
                hardware ethernet 00:00:00:00:00:00;
                fixed-address 10.0.0.115;
        }
        #- Asterisk Box -#
        host asterisk {
                hardware ethernet 00:00:00:00:00:00;
                fixed-address 10.0.0.120;
        }
        #- WWW Server -#
        host www2 {
                hardware ethernet 00:00:00:00:00:00;
                fixed-address 10.0.0.125;
        }
}
###################################################################
#####----- End Server and Fixed IP Address Configuration -----#####
###################################################################

NOTE: I have changed the ip addresses and zeroed out the MAC addresses of the interfaces. You should assume that each interface for the server section has a unique MAC address.

I have also tried adding the interfaces in the /etc/default/dhcp3-server file:
Code:

# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/dhcp3-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#      Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1 eth2"

But still no luck getting it to work on the eth1 interface. I'm wondering whether the 'interface ethX' lines in each subnet stanza are recognized. Basically I'm just trying to say that any requests for dhcp leases coming from eth1 should get the 192.168.... subnet and any requests for dhcp leases coming from eth2 should get the 10.0.... subnet.

Srz0rz 06-11-2008 07:21 PM

Thank you emi_ramo! Adding the line 'range 192.168.0.200 192.168.0.253' to the 192.168.0.x subnet declaration worked. I can't believe it was that simple.

emi_ramo 06-12-2008 04:48 AM

Me could'n, too, when I learned about dhcp on linux.

See you over here!!
emi

askhawk 06-08-2011 11:33 PM

Ubuntu dhcpd server
 
You are awsome


All times are GMT -5. The time now is 01:41 PM.