创建配置文件
mkdir -p /docker_v/dhcpd/data
cat > /docker_v/dhcpd/data/dhcpd.conf << EOF
ddns-update-style interim; # 设置dhcp互动更新模式
ignore client-updates; # 忽略客户端更新
subnet 10.10.10.0 netmask 255.255.255.0 { # 设置子网申明
# Default gateway
# option routers 10.10.10.1; # 设置客户端默认网关
option subnet-mask 255.255.255.0; # 设置客户端子网掩码
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 10.10.10.1;
# option netbios-name-servers 10.10.10.1; # 设置DNS服务器地址
# Selects point-to-point node (default is hybrid). Don't change this unless
# you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 10.10.10.100 10.10.10.200; # 设置地址池
max-lease-time 43200; # 设置客户端最长租期,单位为秒
default-lease-time 21600; # 设置默认租期,单位为秒
# 以下设定分配静态IP地址,不多做解释
host ceph-master1 {
hardware ethernet 00:15:5d:00:76:26;
fixed-address 10.10.10.254;
}
}
EOF
启动 dhcpd
启动 DHCPD
并绑定到 eth1
网卡上
docker run -d --restart=always --init --net=host --name dhcpd -v /docker_v/dhcpd/data:/data/ networkboot/dhcpd eth1