Настройка DHCP: различия между версиями
(Новая: ==Настройка DHCP сервера== Для правильной раздачи IP адресов в сети необходимо изменить файл dhcpd.conf. Откры...) |
|||
Строка 21: | Строка 21: | ||
после необходимо перезапустить dhcp3-server | после необходимо перезапустить dhcp3-server | ||
+ | |||
+ | ==Дополнительная информация == | ||
+ | http://www.linuxforums.org/forum/servers/69851-dhcpd-conf-multiple-subnet-single-physical-network-configuration.html | ||
+ | |||
+ | dhcp.conf... | ||
+ | |||
+ | authoritative; | ||
+ | ddns-update-style none; | ||
+ | |||
+ | class "linux" { | ||
+ | match if ( | ||
+ | (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:01) and | ||
+ | not (option dhcp-client-identifier = "windows") or | ||
+ | (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:02) and | ||
+ | not (option dhcp-client-identifier = "windows") or | ||
+ | (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:03) and | ||
+ | not (option dhcp-client-identifier = "windows") ); | ||
+ | option domain-name "example.com"; | ||
+ | option domain-name-servers 192.168.0.1; | ||
+ | option ip-forwarding off; | ||
+ | option netbios-name-servers 192.168.0.1; | ||
+ | option netbios-node-type 8; | ||
+ | option routers 192.168.0.1; | ||
+ | default-lease-time 604800; | ||
+ | max-lease-time 604800; | ||
+ | } | ||
+ | |||
+ | class "windows" { | ||
+ | match if ( | ||
+ | (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:01) and | ||
+ | (option dhcp-client-identifier = "windows") or | ||
+ | (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:02) and | ||
+ | (option dhcp-client-identifier = "windows") or | ||
+ | (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:03) and | ||
+ | (option dhcp-client-identifier = "windows") ); | ||
+ | option domain-name "example.com"; | ||
+ | option domain-name-servers 10.0.0.1; | ||
+ | option ip-forwarding off; | ||
+ | option netbios-name-servers 10.0.0.1; | ||
+ | option netbios-node-type 8; | ||
+ | option routers 10.0.0.1; | ||
+ | default-lease-time 604800; | ||
+ | max-lease-time 604800; | ||
+ | } | ||
+ | |||
+ | group { | ||
+ | host host-1 { | ||
+ | fixed-address 192.168.0.2; | ||
+ | hardware ethernet XX:XX:XX:XX:XX:01; | ||
+ | } | ||
+ | host host-2 { | ||
+ | fixed-address 192.168.0.3; | ||
+ | hardware ethernet XX:XX:XX:XX:XX:02; | ||
+ | } | ||
+ | host host-3 { | ||
+ | fixed-address 192.168.0.4; | ||
+ | hardware ethernet XX:XX:XX:XX:XX:03; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | group { | ||
+ | host win-host-1 { | ||
+ | option dhcp-client-identifier "windows"; | ||
+ | fixed-address 10.0.0.2; | ||
+ | hardware ethernet XX:XX:XX:XX:XX:01; | ||
+ | } | ||
+ | host win-host-2 { | ||
+ | option dhcp-client-identifier "windows"; | ||
+ | fixed-address 10.0.0.3; | ||
+ | hardware ethernet XX:XX:XX:XX:XX:02; | ||
+ | } | ||
+ | host win-host-3 { | ||
+ | option dhcp-client-identifier "windows"; | ||
+ | fixed-address 10.0.0.4; | ||
+ | hardware ethernet XX:XX:XX:XX:XX:03; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | shared-network example.com { | ||
+ | subnet 10.0.0.0 netmask 255.0.0.0 { | ||
+ | pool { | ||
+ | option default-ip-ttl 1; | ||
+ | option default-tcp-ttl 1; | ||
+ | option domain-name "bogus.net"; | ||
+ | option domain-name-servers 127.0.0.1; | ||
+ | option ip-forwarding off; | ||
+ | option routers 127.0.0.1; | ||
+ | default-lease-time 300; | ||
+ | max-lease-time 300; | ||
+ | range 10.123.123.1 10.123.123.254; | ||
+ | } | ||
+ | } | ||
+ | subnet 192.168.0.0 netmask 255.255.255.0 { | ||
+ | pool { | ||
+ | option default-ip-ttl 1; | ||
+ | option default-tcp-ttl 1; | ||
+ | option domain-name "bugus.net"; | ||
+ | option domain-name-servers 127.0.0.1; | ||
+ | option ip-forwarding off; | ||
+ | option routers 127.0.0.1; | ||
+ | default-lease-time 300; | ||
+ | max-lease-time 300; | ||
+ | range 192.168.0.100 192.168.0.109; | ||
+ | } | ||
+ | } | ||
+ | } |
Версия 15:09, 23 августа 2007
Настройка DHCP сервера
Для правильной раздачи IP адресов в сети необходимо изменить файл dhcpd.conf. Открываем данный файл.
vim /etc/dhcp3/dhcpd.conf
и устанавливаем следующие параметры
default-lease-time 86400; #время аренды ip адреса по умолчанию max-lease-time 604800; #максимальное время аренды autoritative; #указываем, что сервер авторитативен для данной сети subnet 192.168.10.0 #для нашего случая (она подсеть) достаточно указать эту подсеть netmask 255.255.255.0 #продолжение секции { range 192.168.10.10 192.168.10.240; #диапазон выдаваемых ip адресов option subnet-mask 255.255.255.0; #маска подсети option broadcast-address 192.168.10.255; #широковещательный адрес option routers 192.168.10.1; #гейт }
после необходимо перезапустить dhcp3-server
Дополнительная информация
dhcp.conf...
authoritative; ddns-update-style none; class "linux" { match if ( (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:01) and not (option dhcp-client-identifier = "windows") or (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:02) and not (option dhcp-client-identifier = "windows") or (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:03) and not (option dhcp-client-identifier = "windows") ); option domain-name "example.com"; option domain-name-servers 192.168.0.1; option ip-forwarding off; option netbios-name-servers 192.168.0.1; option netbios-node-type 8; option routers 192.168.0.1; default-lease-time 604800; max-lease-time 604800; } class "windows" { match if ( (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:01) and (option dhcp-client-identifier = "windows") or (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:02) and (option dhcp-client-identifier = "windows") or (substring (hardware, 1, 6) = XX:XX:XX:XX:XX:03) and (option dhcp-client-identifier = "windows") ); option domain-name "example.com"; option domain-name-servers 10.0.0.1; option ip-forwarding off; option netbios-name-servers 10.0.0.1; option netbios-node-type 8; option routers 10.0.0.1; default-lease-time 604800; max-lease-time 604800; } group { host host-1 { fixed-address 192.168.0.2; hardware ethernet XX:XX:XX:XX:XX:01; } host host-2 { fixed-address 192.168.0.3; hardware ethernet XX:XX:XX:XX:XX:02; } host host-3 { fixed-address 192.168.0.4; hardware ethernet XX:XX:XX:XX:XX:03; } } group { host win-host-1 { option dhcp-client-identifier "windows"; fixed-address 10.0.0.2; hardware ethernet XX:XX:XX:XX:XX:01; } host win-host-2 { option dhcp-client-identifier "windows"; fixed-address 10.0.0.3; hardware ethernet XX:XX:XX:XX:XX:02; } host win-host-3 { option dhcp-client-identifier "windows"; fixed-address 10.0.0.4; hardware ethernet XX:XX:XX:XX:XX:03; } }
shared-network example.com { subnet 10.0.0.0 netmask 255.0.0.0 { pool { option default-ip-ttl 1; option default-tcp-ttl 1; option domain-name "bogus.net"; option domain-name-servers 127.0.0.1; option ip-forwarding off; option routers 127.0.0.1; default-lease-time 300; max-lease-time 300; range 10.123.123.1 10.123.123.254; } } subnet 192.168.0.0 netmask 255.255.255.0 { pool { option default-ip-ttl 1; option default-tcp-ttl 1; option domain-name "bugus.net"; option domain-name-servers 127.0.0.1; option ip-forwarding off; option routers 127.0.0.1; default-lease-time 300; max-lease-time 300; range 192.168.0.100 192.168.0.109; } } }