diff options
author | Antoine Ginies <aginies@mandriva.com> | 2004-01-20 15:42:35 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2004-01-20 15:42:35 +0000 |
commit | 3587ddaab7e7ea5d781f154afa831234a6fca6a4 (patch) | |
tree | abcca059693592ad24e9f32967ec013e836ebe0e /dhcp_wizard | |
parent | cb66ec60c32e120748c5699911e725a28cfb9943 (diff) | |
download | drakwizard-3587ddaab7e7ea5d781f154afa831234a6fca6a4.tar drakwizard-3587ddaab7e7ea5d781f154afa831234a6fca6a4.tar.gz drakwizard-3587ddaab7e7ea5d781f154afa831234a6fca6a4.tar.bz2 drakwizard-3587ddaab7e7ea5d781f154afa831234a6fca6a4.tar.xz drakwizard-3587ddaab7e7ea5d781f154afa831234a6fca6a4.zip |
add pxe support in dhcp server
Diffstat (limited to 'dhcp_wizard')
-rwxr-xr-x | dhcp_wizard/Dhcp.pm | 16 | ||||
-rw-r--r-- | dhcp_wizard/scripts/dhcpd.conf.default | 153 |
2 files changed, 147 insertions, 22 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm index ca5775c5..17158cab 100755 --- a/dhcp_wizard/Dhcp.pm +++ b/dhcp_wizard/Dhcp.pm @@ -31,6 +31,7 @@ use MDK::Wizard::Wizcommon; my $wiz = new MDK::Wizard::Wizcommon; my $wiz_ip_server = $wiz->{net}->itf_get("IPADDR"); +my $wiz_tftpserverip = $wiz_ip_server; my $d = $4 if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $s = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; @@ -76,7 +77,7 @@ $o->{pages} = { ], next => 'summary' }, - dhcp_warning => { + dhcp_warning => { name => N("Warning") . "\n\n" . N("You are in dhcp, server may not work with your configuration."), ignore => 1, next => 'ip_range' @@ -99,9 +100,9 @@ $o->{pages} = { summary => { name => N("Configuring the DHCP Server") . "\n\n" . N("The wizard collected the following parameters needed to configure your DHCP service:"), data => [ - { label => N("Lowest IP Address:"), fixed_val => \$o->{var}{ip1} }, - { label => N("Highest IP Address:"), fixed_val => \$o->{var}{ip2} }, - { label => N("Interface:"), fixed_val => \$o->{var}{interface} }, + { label => N("Lowest IP Address:"), fixed_val => \$o->{var}{ip1} }, + { label => N("Highest IP Address:"), fixed_val => \$o->{var}{ip2} }, + { label => N("Interface:"), fixed_val => \$o->{var}{interface} }, ], post => \&do_it, next => 'end' @@ -136,12 +137,12 @@ sub check { my $r2_trunc = "$1.$2.$3" if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; foreach ($1, $2, $3, $4) { $check_ip->($_) or return 'ip_range_error' } my $d1 = $4 if $o->{var}{ip1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $d2 = $4 if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + my $d2 = $4 if $o->{var}{ip2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; my $ds = $4 if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; if (!$r1_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 1"); return 'ip_range_error' } if (!$r2_trunc) { standalone::explanations("DHCP wizard : incorrect adress range 2"); return 'ip_range_error' } - if ($r1_trunc ne $s_trunc || $r2_trunc ne $s_trunc) { + if ($r1_trunc ne $s_trunc || $r2_trunc ne $s_trunc) { standalone::explanations("DHCP wizard : range not in network"); return 'ip_range_warning'; } @@ -197,7 +198,7 @@ sub do_it { } $file = "/etc/dhcpd.conf"; -f $file and MDK::Common::cp_af($file, $file.".orig"); - output($file, map { + output($file, map { s|__hname__|$wiz_host_name|g; s|__dns__|$wiz_dns|g; s|__net__|$wiz_ip_net|g; @@ -207,6 +208,7 @@ sub do_it { s|__rng2__|$wiz_ip_range2|g; s|__dname__|$wiz_domain_name|g; s|__gateway__|$wiz_gateway|g; + s|__tftpserverip__|$wiz_tftpserverip|g; $_; } cat_("__WIZ_HOME__/dhcp_wizard/scripts/dhcpd.conf.default")); standalone::explanations("$file: hname = $wiz_host_name, net = $wiz_ip_net, ip = $wiz_ip_server, diff --git a/dhcp_wizard/scripts/dhcpd.conf.default b/dhcp_wizard/scripts/dhcpd.conf.default index 0d3c7ec5..5f27acd0 100644 --- a/dhcp_wizard/scripts/dhcpd.conf.default +++ b/dhcp_wizard/scripts/dhcpd.conf.default @@ -1,23 +1,146 @@ -# default file for dhcpd -# replace __ip__ by the IP adress of the server (same server for -# all services in this config file) - -default-lease-time 36000; -max-lease-time 144000; +# for explanation in french go to : http://www.delafond.org/traducmanfr/man/man5/dhcpd.conf.5.html ddns-update-style none; +allow booting; +allow bootp; +# Your dhcp server is not master on your network ! +#not authoritative; +# Your dhcpd server is master on your network ! +#authoritative; not authoritative; -subnet __net__ netmask __mask__{ - range __rng1__ __rng2__; - option domain-name "__dname__"; - option domain-name-servers __dns__; - option routers __gateway__; - option subnet-mask __mask__; - ddns-updates on; - ddns-domainname "__dname__"; - ddns-rev-domainname "in-addr.arpa"; +#Interface where dhcpd is active +#DHCPD_INTERFACE = "eth0"; + +# Definition of PXE-specific options +# Code 1: Multicast IP address of bootfile +# Code 2: UDP port that client should monitor for MTFTP responses +# Code 3: UDP port that MTFTP servers are using to listen for MTFTP requests +# Code 4: Number of secondes a client must listen for activity before trying +# to start a new MTFTP transfer +# Code 5: Number of secondes a client must listen before trying to restart +# a MTFTP transfer + +# define Option for the PXE class +option space PXE; +option PXE.mtftp-ip code 1 = ip-address; +option PXE.mtftp-cport code 2 = unsigned integer 16; +option PXE.mtftp-sport code 3 = unsigned integer 16; +option PXE.mtftp-tmout code 4 = unsigned integer 8; +option PXE.mtftp-delay code 5 = unsigned integer 8; +option PXE.discovery-control code 6 = unsigned integer 8; +option PXE.discovery-mcast-addr code 7 = ip-address; + +#Define options for pxelinux +option space pxelinux; +option pxelinux.magic code 208 = string; +option pxelinux.configfile code 209 = text; +option pxelinux.pathprefix code 210 = text; +option pxelinux.reboottime code 211 = unsigned integer 32; +site-option-space "pxelinux"; +# These lines should be customized to your setup +#option pxelinux.configfile "configs/common"; +#option pxelinux.pathprefix "/pxelinux/files/"; +#filename "/pxelinux/pxelinux.bin"; + +option pxelinux.magic f1:00:74:7e; +option pxelinux.reboottime 30; +#if exists dhcp-parameter-request-list { + # Always send the PXELINUX options +# append dhcp-parameter-request-list 208, 209, 210, 211; +# append dhcp-parameter-request-list 208,211; +# } + +#Class that determine the options for Etherboot 5.x requests +class "Etherboot" { + +#if The vendor-class-identifier equal Etherboot-5.0 +match if substring (option vendor-class-identifier, 0, 9) = "Etherboot"; + +# filename define the file retrieve by the client, there nbgrub +# our tftp is chrooted so is just the path to the file +filename "/etherboot/nbgrub"; + +#Used by etherboot to detect a valid pxe dhcp server +option vendor-encapsulated-options 3c:09:45:74:68:65:72:62:6f:6f:74:ff; + +# Set the "vendor-class-identifier" field to "PXEClient" in dhcp answer +# if this field is not set the pxe client will ignore the answer ! +option vendor-class-identifier "Etherboot"; + +vendor-option-space PXE; +option PXE.mtftp-ip 0.0.0.0; +# IP of you TFTP server +next-server __tftpserverip__; } +# create the Class PXE +class "PXE" { +# if the "vendor-class-identifier" is set to "PXEClient" in the client dhcp request +match if substring(option vendor-class-identifier, 0, 9) = "PXEClient"; + +# filename define the file retrieve by the client, there pxelinux.0 +# our tftp is chrooted so is just the path to the file +# If you prefer use grub, use pxegrub compiled for your ethernet card. +#filename "/PXEClient/pxegrub"; +filename "/X86PC/linux/linux.0"; + +# Set the "vendor-class-identifier" field to "PXEClient" in dhcp answer +# if this field is not set the pxe client will ignore the answer ! +option vendor-class-identifier "PXEClient"; + + +vendor-option-space PXE; +option PXE.mtftp-ip 0.0.0.0; + +# IP of you TFTP server +next-server __tftpserverip__; +} + +# the class know exist just for deny the response to other DHCP request +class "known" { + match hardware; + one-lease-per-client on; + ddns-updates on; + ddns-domainname = "__dname__"; + option domain-name "__dname__"; + option domain-name-servers __ip__; + ddns-hostname = pick-first-value(ddns-hostname, option host-name); + option fqdn.no-client-update on; + set vendor_class_identifier = option vendor-class-identifier; +} + +# TAG: COMPUTER_LIST_BEGIN +#host compute9{ +# hardware ethernet 00:02:b3:3f:7e:b7; +# fixed-address compute9; +# TAG: COMPUTER_LIST_END + +shared-network "mynetwork" { +# subnet 192.168.200.0 netmask 255.255.255.0 { +subnet __net__ netmask __mask__ { + option subnet-mask __mask__; + option routers __gateway__; + default-lease-time 28800; + max-lease-time 86400; + option domain-name "__dname__"; + option domain-name-servers __ip__; + next-server __tftpserverip__; + + pool { + range __rng1__ __rng2__; +# deny members of "PXE"; +# deny members of "Etherboot"; + } + +# pool { +# range 192.168.200.200 192.168.200.254; +# give an address of the the pool for PXE client and deny the other +#allow members of "PXE"; +#deny members of "known"; +#allow members of "Etherboot"; +# } + } +} |