關於 鳥哥的私房菜的 簡易 Firewall 架設 這篇文章,我照做可是不能用也??

顯示結果從第 1 筆 到 5 筆,共計 5 筆
  1. #1
    美麗與智慧並重英 bigmichael 的大頭照
    註冊日期
    2001-07-20
    所在地區
    ADSL 2M/256
    討論區文章
    374

    關於 鳥哥的私房菜的 簡易 Firewall 架設 這篇文章,我照做可是不能用也??

    我的環境和鳥哥的列子有些不同
    我的主機只有一張網卡有實體ip並且我不做nat所以做了以下的修改,如下綠色的部份
    我將鳥哥的iptables.rule的某部份的內容

    #!/bin/bash
    #
    # ³o­Ó script ¬O¥Î¨Ó«Ø¥ß iptables ¨¾¤õÀ𪺰ò¥»³W«h¡I
    # °ò¥»³W«h©w¸q¬°¡y©Úµ´©Ò¦³¡A¶}©ñ‾S©w¡zªº¼Ò¦¡¡I
    # §A¥i¥H±N³o­ÓÀɮשñ¸m¦b /usr/local/virus/iptables ©³¤U¡AÀɦW¥i©w¸q¬° iptables.rule ¡I
    # °ò¥»¤W¡A§A¥i¥H°Ñ¦Ò³o­Óºô‾¸¸ê®Æ¡G http://linux.vbird.org
    #
    # HISTORY:
    # 2002/08/20 First release by VBird
    #

    # 0.0 Please key in your parameters
    EXTIF="eth1" # the interface that connect Internet
    INIF="" # the inside interface. if you don't have this one
    # and you must let this be black ex> INIF=""
    INNET="" # This is for NAT's network


    # 1.0 Testing your Kernel version and remove the ipchains module
    kver=`uname -r | cut -c 1-3`
    if [ "$kver" != "2.4" ] && [ "$kver" != "2.5" ]; then
    echo "Your Linux Kernel Version may not be suported by this script!"
    echo "This scripts will not be runing"
    exit
    fi
    ipchains=`lsmod | grep ipchains`
    if [ "$ipchains" != "" ]; then
    echo "unload ipchains in your system"
    rmmod ipchains 2> /dev/null
    fi

    # 2.0 Loading some modules
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    export PATH EXTIF INIF INNET
    modprobe ip_tables > /dev/null 2>&1
    modprobe iptable_nat > /dev/null 2>&1
    modprobe ip_nat_ftp > /dev/null 2>&1
    modprobe ip_nat_irc > /dev/null 2>&1
    modprobe ip_conntrack > /dev/null 2>&1
    modprobe ip_conntrack_ftp > /dev/null 2>&1
    modprobe ip_conntrack_irc > /dev/null 2>&1

    # 3.0 Clear the iptables's rules
    /sbin/iptables -F
    /sbin/iptables -X
    /sbin/iptables -Z
    /sbin/iptables -F -t nat
    /sbin/iptables -X -t nat
    /sbin/iptables -Z -t nat
    /sbin/iptables -P INPUT ACCEPT
    /sbin/iptables -P OUTPUT ACCEPT
    /sbin/iptables -P FORWARD ACCEPT
    /sbin/iptables -t nat -P PREROUTING ACCEPT
    /sbin/iptables -t nat -P POSTROUTING ACCEPT
    /sbin/iptables -t nat -P OUTPUT ACCEPT

    # 4.0 Allow the lo and inside interface to access the server and internet
    # /sbin/iptables -A INPUT -i lo -j ACCEPT
    # if [ "$INIF" != "" ]; then
    # /sbin/iptables -A INPUT -i $INIF -j ACCEPT
    # echo "1" > /proc/sys/net/ipv4/ip_forward
    # /sbin/iptables -t nat -A POSTROUTING -s $INNET -o $EXTIF -j MASQUERADE
    # fi


    # 5.0 Deny and Allow IP or host or network from files
    if [ -f /usr/local/virus/iptables/iptables.deny ]; then
    /usr/local/virus/iptables/iptables.deny
    fi
    if [ -f /usr/local/virus/iptables/iptables.allow ]; then
    /usr/local/virus/iptables/iptables.allow
    fi

    # 6.0 Allow ICMP come in
    AICMP="0 3 3/4 4 11 12 14 16 18"
    for tyicmp in $AICMP
    do
    /sbin/iptables -A INPUT -i $EXTIF -p icmp --icmp-type $tyicmp -j ACCEPT
    done

    # 7.0 Allow services
    /sbin/iptables -A INPUT -p TCP -i $EXTIF --dport 21 -j ACCEPT # FTP
    /sbin/iptables -A INPUT -p TCP -i $EXTIF --dport 22 -j ACCEPT # SSH
    /sbin/iptables -A INPUT -p TCP -i $EXTIF --dport 25 -j ACCEPT # SMTP
    /sbin/iptables -A INPUT -p UDP -i $EXTIF --dport 53 -j ACCEPT # DNS
    /sbin/iptables -A INPUT -p TCP -i $EXTIF --dport 53 -j ACCEPT # DNS
    /sbin/iptables -A INPUT -p TCP -i $EXTIF --dport 80 -j ACCEPT # WWW
    /sbin/iptables -A INPUT -p TCP -i $EXTIF --dport 110 -j ACCEPT # POP3

    # 8.0 Allow RELATED and ESTABLISHED
    /sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

    # 9.0 deny all
    /sbin/iptables -A INPUT -m state --state NEW,INVALID -j DROP



    其它的和鳥哥的設定一樣
    則得到如下的結果

    [root@linux root]# /usr/local/virus/iptables/iptables.rule
    bash: /usr/local/virus/iptables/iptables.rule: bad interpreter: No such file or directory
    [root@linux root]# lsmod
    Module Size Used by
    binfmt_misc 6416 1
    iscsi 21984 0 (unused)
    scsi_mod 95696 1 [iscsi]
    autofs 11520 0 (autoclean) (unused)
    via-rhine 11424 1
    eepro100 17664 1
    appletalk 20912 0 (autoclean)
    ipx 16448 0 (autoclean)
    usb-uhci 21536 0 (unused)
    usbcore 51712 1 [usb-uhci]
    [root@linux root]#


    不能用也,是哪裡出問題呢?



  2. #2
    莫道君行早 blueshen 的大頭照
    註冊日期
    2002-02-26
    所在地區
    台固 ADSL 2M/256
    討論區文章
    671

    一般: 關於 鳥哥的私房菜的 簡易 Firewall 架設 這篇文章,我照做可是不能用也??

    最初由 bigmichael 發表
    [B]我的環境和鳥哥的列子有些不同

    其它的和鳥哥的設定一樣
    則得到如下的結果

    [root@linux root]# /usr/local/virus/iptables/iptables.rule
    bash: /usr/local/virus/iptables/iptables.rule: bad interpreter: No such file or directory
    它不是說了嗎:檔案找不到。

  3. #3
    美麗與智慧並重英 bigmichael 的大頭照
    註冊日期
    2001-07-20
    所在地區
    ADSL 2M/256
    討論區文章
    374

    一般: 一般: 關於 鳥哥的私房菜的 簡易 Firewall 架設 這篇文章,我照做可是不能用也??

    最初由 blueshen 發表
    它不是說了嗎:檔案找不到。
    它明明存在啊!如下:
    [root@linux root]# cd /usr/local/virus/iptables/
    [root@linux iptables]# ls
    iptables.allow iptables.deny iptables.rule
    [root@linux iptables]# /usr/local/virus/iptables/iptables.rule
    bash: /usr/local/virus/iptables/iptables.rule: bad interpreter: No such file or directory
    [root@linux iptables]#


  4. #4
    莫道君行早 blueshen 的大頭照
    註冊日期
    2002-02-26
    所在地區
    台固 ADSL 2M/256
    討論區文章
    671

    一般: 一般: 一般: 關於 鳥哥的私房菜的 簡易 Firewall 架設 這篇文章,我照做可是不能用也??

    最初由 bigmichael 發表
    它明明存在啊!如下:
    [root@linux root]# cd /usr/local/virus/iptables/
    [root@linux iptables]# ls
    iptables.allow iptables.deny iptables.rule
    [root@linux iptables]# /usr/local/virus/iptables/iptables.rule
    bash: /usr/local/virus/iptables/iptables.rule: bad interpreter: No such file or directory
    [root@linux iptables]#


    你把這個檔案叫進 X-window 的文字編輯器,再存一次檔,看看能不能用。
    (可以除去檔案堿搕ㄗㄙ熔顫)

  5. #5
    會員
    註冊日期
    2003-02-26
    討論區文章
    628

    一般: 一般: 一般: 關於 鳥哥的私房菜的 簡易 Firewall 架設 這篇文章,我照做可是不能用也??

    最初由 bigmichael 發表
    它明明存在啊!如下:
    [root@linux root]# cd /usr/local/virus/iptables/
    [root@linux iptables]# ls
    iptables.allow iptables.deny iptables.rule
    [root@linux iptables]# /usr/local/virus/iptables/iptables.rule
    bash: /usr/local/virus/iptables/iptables.rule: bad interpreter: No such file or directory
    [root@linux iptables]#


    檔案有執行的權限嗎???
    /usr/local/virus/iptables/iptables.rule



類似的主題

  1. 【求知】關於"嗯,第一次來,我是内地的 "這篇文章.
    作者:kinyo 所在討論版:-- 閒 話 家 常 灌 水 版
    回覆: 11
    最後發表: 2005-08-18, 02:14 AM
  2. 關於★★★★★寬頻網路最佳化★★★★★這篇文章
    作者:goto430 所在討論版:---- ADSL 軟 硬 體 技 術
    回覆: 1
    最後發表: 2004-11-07, 11:42 PM
  3. 【……】這篇文章....
    作者:cgm.tw 所在討論版:-- 站 務 公 告 與 建 議 版
    回覆: 13
    最後發表: 2003-06-24, 01:10 AM
  4. 我完全照鳥哥的簡易防火牆架設了,可以用,但是今天發現多開了
    作者:bigmichael 所在討論版:-- FreeBSD & Linux 討 論 版
    回覆: 0
    最後發表: 2003-03-27, 01:47 PM
  5. 請問我照鳥哥的私房防菜中的文章架設防火牆成功了,但是要如何關呢?
    作者:bigmichael 所在討論版:-- FreeBSD & Linux 討 論 版
    回覆: 0
    最後發表: 2003-03-24, 03:55 PM

 

此網頁沒有從搜尋引擎而來的訪客

發表文章規則

  • 不可以發表新主題
  • 不可以回覆文章
  • 不可以上傳附加檔案
  • 不可以編輯自己的文章
  •