量産メモ帳

忘れっぽいのでメモを残しています。浅く適当に書きます。

VMware 上の CentOS-6.3 で動く Apache HTTPD に外部からアクセスできるようにする。

スポンサーリンク

以下の様に HTTP と HTTPS 用のポートを開放するべく、iptablesファイアウォールのルールを追加・保存すれば良い。

iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]



上の例では INPUT チェーンの5行目にルールを挿入しているが、これは"REJECT all"ルールが5行目にあったため。
"REJECT all"よりも前にルールを挿入しなければならないので、予め iptables -L コマンドで行番号を確認しておく必要がある。

Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination



参考資料: