DHCP on multiple zones

Moderator: Securepoint

Gesperrt
ajl119
Beiträge: 160
Registriert: Do 21.06.2007, 19:05

DHCP on multiple zones

Beitrag von ajl119 »

How do you setup the DHCP server to provide DHCP services to different zones with different information?

Thanks in advance :)

philipp
Beiträge: 119
Registriert: Mi 07.02.2007, 15:44
Kontaktdaten:

Beitrag von philipp »

You have to edit the dhcpd template and add some values to the database.

The default dhcpd.conf-template (show extc_template /etc/dhcpd.conf):

Code: Alles auswählen

#$Id: dhcpd.conf 4902 2007-09-19 11:32:23Z basti $
ddns-update-style ad-hoc;

default-lease-time ${DEFAULTLEASETIME};
max-lease-time ${MAXLEASETIME};

#IF ${DEFAULTGATEWAY}
option routers ${DEFAULTGATEWAY};
#ENDIF

#IF ${NAMESERVER1}
#IF ${NAMESERVER2}
option domain-name-servers ${NAMESERVER1}, ${NAMESERVER2};
#ELSE
option domain-name-servers ${NAMESERVER1};
#ENDIF
#ENDIF

subnet ${NETADDR} netmask ${NETMASK} {
  range ${RANGE_LOW} ${RANGE_HIGH};
}
You have to add sections for the additonal subnets:

Code: Alles auswählen

change extc_template /etc/dhcpd.conf
#$Id: dhcpd.conf 4902 2007-09-19 11:32:23Z basti $
ddns-update-style ad-hoc;

default-lease-time ${DEFAULTLEASETIME};
max-lease-time ${MAXLEASETIME};


#IF ${DEFAULTGATEWAY}
option routers ${DEFAULTGATEWAY};
#ENDIF

#IF ${NAMESERVER1}
#IF ${NAMESERVER2}
option domain-name-servers ${NAMESERVER1}, ${NAMESERVER2};
#ELSE
option domain-name-servers ${NAMESERVER1};
#ENDIF
#ENDIF

subnet ${NETADDR} netmask ${NETMASK} {
  range ${RANGE_LOW} ${RANGE_HIGH};
}

#IF ${NETADDR2}
subnet ${NETADDR2} netmask ${NETMASK2} {
  option routers ${DEFAULTGATEWAY2};
  range ${RANGE_LOW2} ${RANGE_HIGH2};
}
#ENDIF
#IF ${NETADDR3}
subnet ${NETADDR3} netmask ${NETMASK3} {
  option routers ${DEFAULTGATEWAY3};
  range ${RANGE_LOW3} ${RANGE_HIGH3};
}
#ENDIF
**
Now you must create the new variables:

Code: Alles auswählen

add extc_entry dhcp NETADDR2
add extc_entry dhcp NETMASK2
add extc_entry dhcp DEFAULTGATEWAY2
add extc_entry dhcp RANGE_LOW2
add extc_entry dhcp RANGE_HIGH2
add extc_entry dhcp NETADDR3
add extc_entry dhcp NETMASK3
add extc_entry dhcp DEFAULTGATEWAY3
add extc_entry dhcp RANGE_LOW3
add extc_entry dhcp RANGE_HIGH3
To change the values use the command: change extc_value dhcp "VARIABLE" "VALUE"
e.g.

Code: Alles auswählen

change extc_value dhcp NETADDR2 10.20.30.0
change extc_value dhcp NETMASK2 255.255.255.0
change extc_value dhcp DEFAULTGATEWAY2 10.20.30.40
change extc_value dhcp RANGE_LOW2 10.20.30.50
change extc_value dhcp RANGE_HIGH2 10.20.30.100
To activate the new configuration type: update applications

Note: I had no time to test this configuration, but it should work. Maybe the defaultgateway for the first subnet must be moved from global configuration to the subnet section, like we did it with the additional subnets.

edit: don't forget to make a backup before you save the new configuration :)
Zuletzt geändert von philipp am Mi 26.03.2008, 09:59, insgesamt 1-mal geändert.

ajl119
Beiträge: 160
Registriert: Do 21.06.2007, 19:05

Beitrag von ajl119 »

This is great.
thank you very much :o)

merlin
Beiträge: 263
Registriert: So 01.07.2007, 12:34
Wohnort: Erlangen

Beitrag von merlin »

Hallo,

seit einem der letzten Updates muss hier die dhcpd.conf wie folgt aussehen:
#$Id: dhcpd.conf 5849 2008-11-18 15:39:48Z basti $

ddns-update-style ad-hoc;

default-lease-time ${DEFAULTLEASETIME};
max-lease-time ${MAXLEASETIME};


#IF ${DEFAULTGATEWAY}
option routers ${DEFAULTGATEWAY};
#ENDIF

#IF ${NAMESERVER1}
#IF ${NAMESERVER2}
option domain-name-servers ${NAMESERVER1}, ${NAMESERVER2};
#ELSE
option domain-name-servers ${NAMESERVER1};
#ENDIF
#ENDIF

#IF ${WINSSERVER}
option netbios-name-servers ${WINSSERVER};
#ENDIF

subnet ${NETADDR} netmask ${NETMASK} {
range ${RANGE_LOW} ${RANGE_HIGH};
}

#IF ${NETADDR2}
subnet ${NETADDR2} netmask ${NETMASK2} {
option routers ${DEFAULTGATEWAY2};
range ${RANGE_LOW2} ${RANGE_HIGH2};
}
#ENDIF
sonst "vergißt" die Securepoint nach einem "config save" wieder die modifizierte dhcpd.conf

Gruß,
Rolf Gerold

Benutzeravatar
Erik
Securepoint
Beiträge: 1480
Registriert: Fr 07.11.2008, 11:50

Beitrag von Erik »

Sie sollten zusätzlich in der ersten Zeile des Templates dessen Build-Nummer (unten fettgedruckt) erhöhen, sonst kann es passieren, dass die manuell eingefügten Änderungen nach einem Update wieder weg sind:
#$Id: dhcpd.conf 5849 2008-11-18 15:39:48Z basti $
Am besten die tragen "9999" ein, sodass das Template aller Wahrscheinlichkeit nach nie überschrieben wird.

Gesperrt