Page Banner

IPTables – Opening up Multiple Ports – One Liner

#—for all subnets / tcp protocol—#

#iptables -A INPUT -m state --state NEW -m tcp -p tcp -s 192.168.122.0/24 --match multiport --dports 22,25,123,53

#—for subnet – 192.168.122.0/24 / tcp protocol —#

#iptables -A INPUT -m state --state NEW -m tcp -p tcp -s 192.168.122.0/24 --match multiport --dports 22,25,123,53

Note: for udp – just change the -m tcp -p tcp to -m udp -p udp –#

Make sure to restart the iptables service after the change.

-Mani