tcp/udpの有効化
tcpの場合
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
udpの場合
-A INPUT -p udp -m state --state NEW --dport 8080 -j ACCEPT
範囲を指定しての場合
-A INPUT -p udp -m state --state NEW --dport 8001:8010 -j ACCEPT
サンプル
# See the Oracle-Provided Images section in the Oracle Cloud Infrastructure
# documentation for security impact of modifying or removing these rule
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [463:49013]
:InstanceServices - [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 udp --sport 123 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p udp -m state --state NEW --dport 8080:8088 -j ACCEPT
編集、反映する方法
sudo iptables-restore < /etc/iptables/rules.v4