Fedora Core 500の技
Valid XHTML 1.0!
正当なCSSです!

TOP > Linux > Fedoraの技 > 101-200 > 185

ファイヤーウォールの設定を確認するには

ファイヤーウォールの現在の設定を確認するにはiptablesコマンドを利用します。

下記は利用していない状態の例です。

# iptables -L
Chain INPUT (policy ACCEPT)
target   prot opt source     destination

Chain FORWARD (policy ACCEPT)
target   prot opt source     destination

Chain OUTPUT (policy ACCEPT)
target   prot opt source     destination

下記はSSH(22)、HTTP(80)とHTTPS(443)のみを利用可能と設定した例です。

ACCEPT   all -- anywhere    anywhere   state RELATED,ESTABLISHED
ACCEPT   tcp -- anywhere    anywhere   state NEW tcp dpt:ssh
ACCEPT   tcp -- anywhere    anywhere   state NEW tcp dpt:http
ACCEPT   tcp -- anywhere    anywhere   state NEW tcpdpt:https
REJECT   all -- anywhere    anywhere   reject-with icmp-host-prohibited

外部からnmapコマンドなどで確認すると上記の3ポートのみが確認でき、それ以外のサービスは確認できません。

"--line-numbers"オプションを利用すると行番号が表示されます。

# iptables -L --line-numbers
〜略〜
9  ACCEPT   tcp -- anywhere    anywhere   state NEW tcp dpt:ssh
10  ACCEPT   tcp -- anywhere    anywhere   state NEW tcp dpt:http
11  REJECT   all -- anywhere    anywhere   reject-with icmp-host-prohibited

iptablesの設定ファイルは/etc/sysconfig/iptablesですが、直接編集するのは望ましくありません。

2005-12-03 作成