LINUX-DHCP

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
# vim /etc/sysctl.conf   net.ipv4.ip_forward=1
# iptables -A PREROUTING -t nat -i enp4s0 -p tcp -j REDIRECT --to-port 8080
# iptables -D PREROUTING -t nat -i enp4s0 -p tcp -j REDIRECT --to-port 8080
# iptables -t nat -I PREROUTING -m mac --mac-source 68:f7:28:ce:40:7c -j ACCEPT
# iptables -t nat -D PREROUTING -m mac --mac-source 68:f7:28:ce:40:7c -j ACCEPT
ifconfig enp4s0 192.168.44.1 netmask 255.255.0.0
systemctl restart dhcpd.service
systemctl restart iptables.service

iptables -F
iptables -t nat -A POSTROUTING -o enp3s0 -j MASQUERADE
iptables -A FORWARD -j ACCEPT
echo $'\a'
*********************************************************************

DHCPDARGS=enp4s0;
ddns-update-style interim;     #配置使用过渡性 DHCP-DNS互动更新模式。  
ignore client-updates;         #忽略客户端更新  


subnet 192.168.44.0 netmask 255.255.255.0 {  
 
        option routers                  192.168.44.1;        #路由器地址  
        option subnet-mask              255.255.0.0;      #子网掩码选项 
        range dynamic-bootp 192.168.44.5 192.168.44.254;       #租用IP地址的范围   
	option domain-name              "gzg";
	option domain-name-servers       101.226.4.6,192.168.44.1;
	option time-offset              -18000; # Eastern Standard Time
	default-lease-time 21600;    #缺省租约时间
	max-lease-time 43200;        #最大租约时间
}

 

TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="enp3s0"
UUID="05be0e9f-3758-48de-8848-e6d024a856f1"
DEVICE="enp3s0"
ONBOOT="yes"
IPADDR="192.168.199.106"
PREFIX="24"
GATEWAY="192.168.199.1"
DNS1="192.168.199.1"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"

 

你可能感兴趣的:(LINUX-DHCP)