Linux 7.2 分享ADSL 的一個問題

顯示結果從第 1 筆 到 8 筆,共計 8 筆
  1. #1
    會員
    註冊日期
    2001-01-21
    討論區文章
    16

    Linux 7.2 分享ADSL 的一個問題

    請教各位高手 , 7.2 的 NAT 一直無法架起來 >_<"
    使用
    depmod -a
    modprobe ip_masq_ftp
    echo 1 > /proc/sys/net/ipv4/ip_forward
    ipchains -A forward -j MASQ -s 192.168.1.0/24
    麻煩各位了,謝謝大家



  2. #2
    會員
    註冊日期
    2001-12-17
    討論區文章
    2
    嗯!印象中linux72核心是2.3 or 2.4,nat改用iptables的方式,你可以參考下面這裡的資料:
    http://www.study-area.org/tips/iptables.htm

  3. #3
    會員 rachel 的大頭照
    註冊日期
    2001-09-10
    討論區文章
    182
    7.2使用2.4核心,以iptables為主,跟ipchains會相衝。

  4. #4
    會員
    註冊日期
    2000-12-29
    討論區文章
    384
    應該不是kernel衝不衝的問題,預設上
    ipchains & iptables 都有啟動,所以要把其中一個給關掉
    用 ntsysv 去關掉iptables吧

  5. #5
    會員 rachel 的大頭照
    註冊日期
    2001-09-10
    討論區文章
    182
    我不是指Kernel會衝突,我是說7.2的Kernel是2.4。
    而這兩個套件不能同時使用,會相衝到!
    必須關掉其中一個



  6. #6
    會員 aday 的大頭照
    註冊日期
    2001-07-06
    討論區文章
    508
    Iptables rules for a simple masquerading gateway (no server services)
    • Bootstrapping Iptables
    o Insert connection-tracking modules (only needed if not built into the kernel).

    modprobe ip_tables
    modprobe ip_conntrack
    modprobe ip_conntrack_ftp (needed only if you plan on using FTP)
    o Set the default policies - sets the default actions of the built-in chains.

    iptables -P INPUT DROP
    iptables -P FORWARD DROP
    iptables -P OUTPUT ACCEPT
    • Blocks all new connections unless initiated from the "protected" network.

    iptables -N state_chk
    iptables -A state_chk -m state --state ESTABLISHED,RELATED -j ACCEPT
    iptables -A state_chk -m state --state NEW -i ! eth0 -j ACCEPT
    iptables -A state_chk -j DROP
    • Jump to the state_chk chain from INPUT and FORWARD chains.

    iptables -A INPUT -j state_chk
    iptables -A FORWARD -j state_chk
    • Masquerade connections - only needed on the firewall box if you have an internal network that you wish to route traffic to and from the Internet.
    o Enable IP forwarding between the interfaces - remember to disable this if you're going to unload the Iptables rules.

    echo "1" > /proc/sys/net/ipv4/ip_forward
    o Load the NAT modules - needed only if you compiled as modules

    modprobe iptable_nat
    modprobe ip_nat_ftp (needed only if you plan on using FTP)
    o Enable IP masquerading - Use if your eth0 has a dynamic IP address. For static IP, it's recommended that you use source NAT instead.

    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    o Enable source NAT - Use if your eth0 has a static IP address.

    iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to ip_address_of_eth0
    Port Forwarding
    Port Forwarding in Netfilter is done with Iptables. You do not need another tool (such as ipmasqadmin w/ Ipchains). This is only needed if you need to forward traffic from one machine to another. Note that this is different from redirecting traffic.
    Port forwarding under Netfilter is done via a two step process.
    • Destination NAT the packets (changes the destination IP address in the IP header and port number in the TCP/UDP header)

    iptables -t nat -A PREROUTING -i eth0 -p protocol -d ip_address_of_eth0 --dport original_port_number -j DNAT --to destination_ip_address:destination_port_number
    • Forward the natted packets (allow the natted packet to be forwarded)

    iptables -A FORWARD -i eth0 -o eth1 -p protocol -d destination_ip_address --dport destination_port_number -j ACCEPT
    Note that port forwarding also requires IP forwarding and masq'ing or source NAT (the return packets need their source IP addresses to be modified as well).
    Putting it together (rc files and such)
    Now that you have your first working firewall, you'll probably want to keep these rules in effect between boots. There are basically two options. The first is to include all of the rules and syntax in a custom rc shell script. The second is to use the iptables-save and iptables-restore commands (currently experimental and only recommended for brave souls).
    To use the rc script approach, start your firewall rc file immediately after your network initiation. Actually, the exact time that you start your firewall rc script isn't that crucial because you can setup rules for interfaces that don't exist.

  7. #7
    會員
    註冊日期
    2001-05-18
    討論區文章
    1,939

    Re: Linux 7.2 分享ADSL 的一個問題

    最初由 BOBO123 發表
    請教各位高手 , 7.2 的 NAT 一直無法架起來 >_<"
    使用
    depmod -a
    modprobe ip_masq_ftp
    echo 1 > /proc/sys/net/ipv4/ip_forward
    ipchains -A forward -j MASQ -s 192.168.1.0/24
    麻煩各位了,謝謝大家
    安裝 Webmin
    http://www.niemueller.de/webmin/

  8. #8
    會員 aday 的大頭照
    註冊日期
    2001-07-06
    討論區文章
    508

    Re: Re: Linux 7.2 分享ADSL 的一個問題

    最初由 bx2aa 發表

    安裝 Webmin
    http://www.niemueller.de/webmin/
    請教bx2aa兄
    我安裝此東東,出現下列訊息,如何解決呢
    附加圖片 附加圖片 iptables.gif  

類似的主題

  1. 【求助】請教各位前輩ADSL的一個問題
    作者:diablored 所在討論版:---- ADSL 軟 硬 體 技 術
    回覆: 4
    最後發表: 2005-06-23, 07:12 PM
  2. 【求助】execl 的一個問題
    作者:jtain 所在討論版:-- OFFICE 相 關 軟 體 討 論 版
    回覆: 5
    最後發表: 2004-08-03, 09:56 PM
  3. 【問題】PapaGo 的一個問題
    作者:ulimie 所在討論版:-- 其 他 軟 體 討 論 版
    回覆: 3
    最後發表: 2004-04-16, 02:22 AM
  4. 請問一下flash 5 字體上的一個問題
    作者:handman 所在討論版:-- 繪 圖 軟 體 討 論 版
    回覆: 13
    最後發表: 2002-06-23, 05:03 AM
  5. acpi的一個問題
    作者:handman 所在討論版:-- 電 腦 硬 體 討 論 版
    回覆: 1
    最後發表: 2001-12-10, 12:39 PM

 

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

發表文章規則

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