iptables是不是設錯了 - Linux
By Una
at 2010-07-14T09:46
at 2010-07-14T09:46
Table of Contents
對不起請教各位先進一下,
我試著在 ubuntu 9.10 上設定防火牆,
煩請各位了解 iptables 設定的人幫我看一下,
看看是不是每一個人都能連到 www 伺服器( http://140.109.19.188 ),
因為我自己在住的地方都會出現 timeout,可是朋友告訴我是正常的,
我實在想不出為什麼,是不是因為我住的地方有用 ip 分享器的原故呢?
以下則是我寫在 /etc/init.d/ 中的 script,為了管理方便,同張網卡設定二個ip
===========================
#!/bin/sh
# iptables script generated 2010-07-09
# http://www.mista.nu/iptables
IPT="/sbin/iptables"
# Flush old rules, old custom tables
$IPT --flush
$IPT --delete-chain
# Set default policies for all three default chains
$IPT -P INPUT DROP
$IPT -P FORWARD DROP
$IPT -P OUTPUT DROP
# Enable free use of loopback interfaces
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT
# All TCP sessions should begin with SYN
#$IPT -A INPUT -p tcp ! --syn -m state --state NEW -s 0.0.0.0/0 -j DROP
# Accept inbound TCP packets
$IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A INPUT -p tcp --dport 22 -m state --state NEW -s 192.168.1.19/16 -j
ACCEPT
$IPT -A INPUT -p tcp --dport 22 -m state --state NEW -s 140.109.23.122/16 -j
ACCEPT
$IPT -A INPUT -p tcp --dport 80 -m state --state NEW -s 0.0.0.0/0 -j ACCEPT
$IPT -A INPUT -p tcp --dport 8080 -m state --state NEW -s 140.109.23.122/16
-j ACCEPT
$IPT -A INPUT -p tcp --dport 8080 -m state --state NEW -s 192.168.1.19/16 -j
ACCEPT
# Accept inbound UDP packets (DHCP)
$IPT -A INPUT -p udp -m udp --dport 67 -s 0.0.0.0/0 -j ACCEPT
# Accept inbound ICMP messages
$IPT -A INPUT -p ICMP --icmp-type 8 -s 0.0.0.0/0 -j ACCEPT
# Accept outbound packets
$IPT -I OUTPUT 1 -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPT -A OUTPUT -p udp --dport 53 -m state --state NEW -j ACCEPT
$IPT -A OUTPUT -p tcp --dport 22 -m state --state NEW -s 192.168.1.19/16 -j
ACCEPT
$IPT -A OUTPUT -p tcp --dport 22 -m state --state NEW -s 140.109.23.122/16 -j
ACCEPT
--
Tags:
Linux
All Comments
By James
at 2010-07-18T14:08
at 2010-07-18T14:08
By Olivia
at 2010-07-22T21:25
at 2010-07-22T21:25
By Edith
at 2010-07-25T02:43
at 2010-07-25T02:43
By Sandy
at 2010-07-28T04:01
at 2010-07-28T04:01
Related Posts
伺服器連線餘時
By Christine
at 2010-07-14T09:19
at 2010-07-14T09:19
Samba可以做到禁止寫入那些副檔名的檔案嗎?
By Hazel
at 2010-07-14T09:17
at 2010-07-14T09:17
Mandriva 2010.1 媒體源
By Iris
at 2010-07-14T08:23
at 2010-07-14T08:23
Solaris 5.8 什麼指令才能 Mount 外接딠…
By John
at 2010-07-13T20:58
at 2010-07-13T20:58
svn : Unable to open an ra_local session to URL
By Daph Bay
at 2010-07-13T20:36
at 2010-07-13T20:36