iptables設定問題 - Linux

Edwina avatar
By Edwina
at 2012-10-07T17:23

Table of Contents

借標題發問
下面是我的 iptables.sh
因為是新手 參考鳥哥的網站設定的 想請教 這樣子設有沒有什麼問題
主機只有負責 NAT+DHCP 然後有開 PORT 給 NAT 後的主機使用
平常是用 SSH 設定主機(區網內)

#!/bin/bash
iptables -F -t mangle
iptables -X -t mangle
iptables -Z -t mangle
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P INPUT ACCEPT
iptables -t mangle -P FORWARD ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
iptables -t mangle -P POSTROUTING ACCEPT
iptables -t mangle -A FORWARD -o ppp0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:65495 -j TCPMSS --clamp-mss-to-pmtu
#上面這行其實我很疑惑 但是沒設又很多網站的開不了

iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport *** -j DNAT --to-destination 192.168.**.**:***
iptables -t nat -A PREROUTING -i ppp0 -p udp --dport ***** -j DNAT --to-destination 192.168.**.**:*****
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport **** -j DNAT --to-destination 192.168.**.**:****
iptables -t nat -A POSTROUTING -s 192.168.**.0/24 -o ppp0 -j MASQUERADE

iptables -F
iptables -X
iptables -Z
iptables -P INPUT DROP
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -s 192.168.**.0/24 -p icmp -j ACCEPT
iptables -A INPUT -s 192.168.**.* -p tcp --dport **** -j ACCEPT
iptables -A INPUT -s 192.168.**.** -p tcp --dport **** -j ACCEPT
exit 0

--
Tags: Linux

All Comments

Hardy avatar
By Hardy
at 2012-10-09T09:09
net.ipv4.ip_forward=1 有設這個

iptables設定問題

Agatha avatar
By Agatha
at 2012-10-06T10:04
我有個小問題想請問 iptables設定成 iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT 跟 iptables -P INPUT DROP iptables -A INPUT -i eth0 - ...

查詢ftp上的資料夾大小

Regina avatar
By Regina
at 2012-10-05T23:42
※ 引述《heliosy (這一欄是要做啥用的)》之銘言: : Folder_1/subFolder_1 : Folder_1/subFolder_2 : Folder_2/subFolder_1 : Folder_2/subFolder_2 : ... : 如果我登入遠端ftp之後 du似乎無法執行了 : ...

Linux mint 連接智慧手機會斷線

David avatar
By David
at 2012-10-05T20:00
我把手機 I9100 s2 接上電腦 linux mint 直接連上沒有辦法讀取裏面的資料 調整手機 USB儲存裝置之後可以 但是大概一分鐘後 手機會自動跳掉 自動離開電腦連接模式 請問這是什麼問題 該怎麼解決呢? - ...

securenetterm連線失敗

Jessica avatar
By Jessica
at 2012-10-05T15:14
用putty以ssh的方式連主機沒有問題, 但改用secure netterm以ssh的方式,輸入密碼後,出現了 buffer_get:tring to get more bytes than in buffer 請問各位高手,這個要怎麼解決啊??實在是想破頭了~而且google到的資料也不多。 謝 ...

請問我的Mail Server是open relay嗎?

Robert avatar
By Robert
at 2012-10-05T14:26
公司的Mail Server是CentOS 6.3+MailScanner+Postfix+dovecot 有使用者反映AOL封鎖了公司的Mail Server IP 剛剛試了一下 我用Outlook在電子郵件寄件地址上面亂打 譬如說cleardayatsdgfdfgd.com 然後內送/外寄伺服器 ...