Question

I need help with a DHCP server on CentOS7

I’m having problems initializing the DHCP server, i got the follwing files:

/etc/sysconfig/network-scripts/ifcg-enp17s0

HWADDR=00:1F:29:EA:FF:48
TYPE=Ethernet

BOOTPROTO=static

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

NAME=enp17s0

UUID=7b883e1a-13ac-444b-96d8-52f01f5f4749

ONBOOT=yes

PEERDNS=yes

PEERROUTES=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPADDR=192.168.100.1

NETMASK=255.255.255.0

NETWORK=192.168.100.0

/etc/dhcp/dhcpd.conf

#
# DHCP Server Configuration file.

#   see /usr/share/doc/dhcp*/dhcpd.conf.example

#   see dhcpd.conf(5) man page
#

ddns-update-style interim;

allow booting;

allow bootp;

authoritative;

ignore client-updates;

set vendorclass = option vendor-class-identifier;

subnet 192.168.100.0 netmask 255.255.255.0 
{

	interface 			enp17s0;
       	option routers                  192.168.100.1;

        option domain-name-servers      192.168.100.1;

	option domain-name              "example.com";

        option subnet-mask              255.255.255.0;

        range                           192.168.100.100 192.168.100.254;

        default-lease-time              21600;

        max-lease-time                  43200;

        next-server                     192.168.100.1;
}

/etc/sysconfig/iptables

*nat

:PREROUTING ACCEPT [13036:1967731]

:INPUT ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

:POSTROUTING ACCEPT [0:0]

-A POSTROUTING -o ens1 -j MASQUERADE

COMMIT

# ens1 modem

# enp17s0 local

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

-A INPUT -j REJECT --reject-with icmp-host-prohibited

-A FORWARD -i ens1 -o enp17s0 -m state --state RELATED,ESTABLISHED -j ACCEPT

-A FORWARD -i enp17s0 -o ens1 -j ACCEPT	

-A FORWARD -j REJECT --reject-with icmp-host-prohibited

COMMIT

Anyone knows why it’s not working?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This comment has been deleted

Why are you running a DHCP server on a DigitalOcean VPS?