I have an openstack environment with a provider network scenario implemented using openvswitch. My openstack is installed on allinone node setup. Is there a way that i can disable/drop all DHCP requests that lands on oen of the network interfaces of my server?


DHCP/BOOTP requests are sent to port 67 UDP. Set up a firewall rule to drop all packages with destination port 67 and protocol UDP and you have blocked it.

Port 67 is only used for the server destination, clients receive answers on port 68, so you can still send requests from that server but not to that server.

Better practice would be to disable ALL incoming traffic (policy drop) and just allow those connections you really want.

The drop rule for your particular case is:

iptables -A INPUT -p udp -i em2 --dport 67 -j DROP

Better practice is to create a firewall script that you place in your /root/, e.g. called firewall and give it execute permissions: chmod u+x /root/firewall and in this script you write down all your rules. This is an example from an e-mail server of ours:


# IPv4 flush all tables
iptables -F INPUT
iptables -F FORWARD
iptables -F OUTPUT
iptables -F -t nat

# IPv6 flush all tables
ip6tables -F INPUT
ip6tables -F FORWARD
ip6tables -F OUTPUT

# IPv4 set default policy drop
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

# IPv6 set default policy drop
ip6tables -P INPUT DROP
ip6tables -P OUTPUT DROP
ip6tables -P FORWARD DROP

# IPv4 allow local communication
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

# IPv6 allow local communication
ip6tables -A INPUT -i lo -j ACCEPT
ip6tables -A OUTPUT -o lo -j ACCEPT

# IPv4 allow related/established
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# IPv6 allow related/established
ip6tables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
ip6tables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
ip6tables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT


iptables -A INPUT -p icmp -m state --state NEW -j ACCEPT

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

iptables -A INPUT -p tcp --dport 25 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 110 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 143 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 465 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 587 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 993 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 995 -m state --state NEW -j ACCEPT

# OUTPUT allow all

iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

# save rules
iptables-save > /etc/iptables.conf
ip6tables-save > /etc/ip6tables.conf

Then you just executed the script as root: /root/firewall and all your rules are set.

  • iptables -A INPUT -p ALL -s -i em2 -dport67 -j DROP iptables -A INPUT -p ALL -s -i em2 -dport68 -j DROP I added these two rules and did a iptables-save. Is that sufficient. I have centos7.2 running with firewalld service disabled and iptables running. Also, why i am not seeing this rule when i issue "iptables -t filter -L" Sep 27 '16 at 8:58
  • That works but you would just block traffic from, you said you wanted to block all DHCP requests, for that you can just leave the -s option out. And put a space between -dport and 67. Oh and -p udp, not all
    – Broco
    Sep 27 '16 at 9:00
  • yes is the DHCP server in my case. This is also the nameserver, i hope that the DNS reply will still land as it is on different port? Sep 27 '16 at 9:02
  • You mean the destination? You better read more about firewalls if you handle a crucial system. As I said, better set a policy to drop everything and enable all ports/protocols you need. And yes, DNS is a different port. If you don't want to use DHCP, why enable it in the first place? Your IPtables rules don't show because they are wrong, -s is the SOURCE option, you want to disable DESTINATION (-d). If you want to block traffic to port 67 udp of the interface completely you don't have to add the -s flag. Also it is -dport 67, not -dport67
    – Broco
    Sep 27 '16 at 9:06
  • ok, so what i was trying to do is any IP packet that lands on my server(x.y.z.w) and has a source address of will be because i assume DHCP packets coming from the DHCP server'') should be dropped. Why should i use destination in this case? Sep 27 '16 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.