Open waterloo3122 opened 5 years ago
cat /etc/dhcp/dhcpd.conf
log-facility local7;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.11 192.168.2.239;
option domain-name-servers 192.168.2.254;
option domain-name "ceph-in.tk";
option routers 192.168.2.254;
option broadcast-address 192.168.2.255;
default-lease-time 3600;
max-lease-time 7200;
# node0
host node0 {
hardware ethernet FA:2E:CD:7A:69:94;
fixed-address 192.168.2.14;
option host-name "node0";
}
# Ceph-testbed
host testbed {
hardware ethernet EE:7C:2B:7E:CA:AD;
fixed-address 192.168.2.11;
option host-name "testbed";
}
}
echo unset old_host_name > /etc/dhcp/dhclient-enter-hooks.d/unset_old_hostname
> /etc/hostname
https://askubuntu.com/questions/104918/how-to-get-the-hostname-from-a-dhcp-server
1 install
yum install dhcp
2 configure
cat /etc/dhcp/dhcpd.conf
systemctl start dhcpd.service
systemctl enable dhcpd.service
3 指定监听的网卡 specify nics listened on
cp /usr/lib/systemd/system/dhcpd.service /etc/systemd/system/
vim /etc/systemd/system/dhcpd.service
add your interface names to ExecStartExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid your_interface_name(s)
systemctl --system daemon-reload
systemctl restart dhcpd
4 log to /var/log/dhcpd.log
vim /etc/rsyslog.conf
I have changelocal7.* /var/log/boot.log
tolocal7.* /var/log/dhcpd.log
5 check logs
tailf /var/log/messages
tailf /var/log/dhcpd.log
6 reference
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-dhcp-configuring-server