0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】iptablesの即時有効化/記入方法

Last updated at Posted at 2024-10-27

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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?