Устройств в доме завелось слишком много, да еще приходящие в гости просят интернета..
isc-dhcpd
Ищу в портах интересующий меня dhcp сервер и устанавливаю:
# cd /usr/ports && make search name=isc-dhcp
Port: isc-dhcp42-server-4.2.2
Path: /usr/ports/net/isc-dhcp42-server
Info: The ISC Dynamic Host Configuration Protocol server
Maint:
B-deps: gettext-0.18.1.1 gmake-3.82 libiconv-1.13.1_1
R-deps:
WWW: https://www.isc.org/products/DHCP/
# cd /usr/ports/net/isc-dhcp42-server && make && install && clean
Привожу файл конфигурации isc-dhcp к следующему виду:
# dhcpd.conf
# option definitions common to all supported networks...
option domain-name "extor.lc";
#option domain-name-servers 192.168.100.1;
default-lease-time 1209600;
max-lease-time 1209600;
# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# ad-hoc DNS update scheme - set to "none" to disable dynamic DNS updates.
#ddns-update-style ad-hoc;
ddns-update-style none;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.3 192.168.100.10;
option domain-name-servers 89.239.139.131, 89.239.139.130;
option routers 192.168.100.1;
}
Указываю запускаться dhcpd при запуске системы:
# echo dhcpd_enable="YES" >> /etc/rc.conf && echo dhcpd_ifaces="fxp0" >> /etc/rc.conf
где fxp0 — интерфейс по которому надо раздавать в аренду адреса.
Запускаю DHCP демон, как обычно
# /usr/local/etc/rc.d/isc-dhcpd start
На заметку: арендованные адреса можно посмотреть в /var/db/dhcpd/dhcpd.leases.
Теперь все кто подключится к моему wifi или же доберется до моего свича, будет иметь доступ в internet. dhcp будет исправно раздавать ip адреса, указанные в настройках.