やりたい事とか ・RAID ・LPIC-201 ・自転車を買う(買っちゃった~) ・サイト作成

2009年7月28日火曜日

FW ファイアウォール 2

第二かいです。
FW。

今回は得点力について〜略


さて、
今回の環境: CentOS5.3 iptables v1.3.5 CUI環境 rootユーザ ネットワーク越しの操作はしないように。
参考URL:http://penguin.nakayosi.jp/linux/iptables.html







さて現在の設定ですが
[root@localhost etc]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp spt:http
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT udp -- anywhere anywhere udp spt:domain

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@localhost etc]#






こんな感じなっております。


さて、なにをしましょうか。
指定したアドレス以外は通信できなくします。




別端末から、pingを送信してみます。
#別端末がないかたごめんなさい。
#たとえば、windowsならアクセサリからコマンドプロンプトを実行して
#ping この端末ってやるとできるよ。

ping cc.cc.cc.cc


しーん。



ではcc.cc.cc.ccからのpingを受け付けてみます。
[root@localhost etc]# iptables -A INPUT -s cc.cc.cc.cc -j ACCEPT
[root@localhost etc]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp spt:http
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT udp -- anywhere anywhere udp spt:domain
ACCEPT all -- cc.cc.cc.cc anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@localhost etc]#




では、別端末からpingを打ってみましょう。








おいお前
なに?





ちゃんと疎通ができてます。






ではせっかくここまでやったんですから、
saveしておきましょう。




[root@localhost etc]# iptables-save
# Generated by iptables-save v1.3.5 on Mon Jul 27 18:08:03 2009
*filter
:INPUT DROP [600:168598]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6471:1012073]
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 80 -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p udp -m udp --sport 53 -j ACCEPT
-A INPUT -s 10.156.0.10 -p tcp -j ACCEPT
-A INPUT -s 10.156.0.10 -j ACCEPT
COMMIT
# Completed on Mon Jul 27 18:08:03 2009
[root@localhost etc]#











あら簡単だこと。

0 件のコメント:

コメントを投稿

フォロワー