-------------------------------------------------------------------------------- 這份文件描述如何在一臺 linux 主機上起動 ip Masquerade 功能,允許沒有注冊網際網路 IP 位址的連線電腦經由你的 Linux 機器連接網際網路. --------------------------------------------------------------------------------
1.1 簡介 這份文件描述如何在一臺 Linux 主機上起動 IP Masquerade 功能,允許沒有注冊網際網路 IP 位址的連線電腦經由你的 Linux 機器連接網際網路.你的機器可能是以乙太網路連接 Linux, 也可能是其它種類,像是撥接的點對點(ppp) 連線.這份文件將會強調乙太網路連線的情況,因為這應該是最常見的案例.
這份文件傾向給使用 2.0.x 核心的使用者參考,不包含發展中的 2.1.x 核心.
1.2 前言,回饋 & 參考資訊
我發現新手在較新的核心上,像是 2.x 核心,設定 IP Masguerade 時非常困惑.雖然有份常見問答集(FAQ) 與郵遞列表(mailing list),然而沒有一份這方面的專門文件;而且在郵遞列表上有些對於這樣一份說明文件(HOWTO) 的請求.所以,我決定撰寫它給所有新手作為一個起點,并且希望能拋磚引玉,作為那些非常了解它的使用者建立文件的基礎.如果你認為我做的不好,不要在意告訴我,這樣我能把它做得更好.
這份文件很多是以原先 Ken Eves 的常見問答集以及 IP Masquerade 郵遞列表里許多有幫助的訊息作為基礎.特別感謝 Mr. Matthew Driver 在郵遞列表中的訊息引發我設立 IP Masquerade 的靈感以及最後撰寫了這份文件.
這份說明文件是想作為讓你的 IP Masquerade 能在最短時間內運作的快速指引.因為我不是一位專門作家,你可能會發現本文件的資訊并非如你想的那麼一般及客觀.最新的消息以及資訊可以在我所維護的 IP Masquerade Resource 網頁上找到.如果你有任何關於 IP Masquerade 的技術問題,請加入 IP Masquerade 郵遞列表而別寄電子郵件給我,因為我的時間有限,而且 IP Masquerade 的發展者們更有能力回答你的問題.
這份文件最新的版本可以在 IP Masquerade Resource 上找到,里面也有 HTML 以及 postscript 的版本:
http://ipmasq.home.ml.org/ 請參考 IP Masquerade Resource 映射站臺列表 以找到其它的映射站臺.
1.3 版權 & 宣告 這份文件版權屬於 Ambrose Au, 而且是免費的文件.你可以在 GNU 的通用公開授權方式下散播它.
This document is copyright(c) 1996 Ambrose Au, and it's a free document. You can redistribute it under the terms of the GNU General Public License.
The information and other contents in this document are to the best of my knowledge. However, ip_masq is experimental, and there is chance that I make mistakes as well; so you should determine if you want to follow the information in this document.
Nobody is responsible for any damage on your computers and any other losses by using the information on this document. i.e.
THE AUTHOR IS NOT RESPONSIBLE FOR ANY DAMAGES INCURRED DUE TO ACTIONS TAKEN BASED ON THE INFORMATION IN THIS DOCUMENT.
2.1 什麼是 IP Masquerade? IP Masquerade 是 Linux 發展中的一種網路功能.如果一臺 Linux 主機使用 IP Masquerade 功能連線到網際網路上,那麼接上它的電腦(不論是在同一個區域網路上或藉由數據機連線)也可以接觸網際網路,即使它們沒有獲得正式指定的 IP 位址.
2.2 現況 IP Masquerade 仍然在實驗階段.無論如何,核心從 1.3.x 開始已經內建這項支援.許多個人甚至公司正在使用它,而有滿意的結果.
瀏覽網頁以及遠端簽入(telnet)已經有回報表示可以在 IP Masquerade 上運作.檔案傳輸(FTP),網路交談(IRC) 以及聆聽 Real Audio 現在可以載入某些模組配合.其它的網路資料流音訊 (streaming audio) 像是 True Speech 以及 Internet Wave 也能運作.一些郵遞列表中的使用夥伴甚至還嘗試過視訊會議軟體. Ping 現在配合新近可以取得的網際網路控制訊息協定(ICMP)修補檔也能運作.
更完整的支援軟體列表請參考 4.3 節.
IP Masquerade 在數種不同的作業系統及平臺上與 '客戶端機器' 配合良好.成功的案例有使用 Unix, Windows95, Windows NT, Windows for Workgroup (with TCP/IP package), OS/2, Macintosh System's OS with Mac TCP, Mac Open Transport, DOS with NCSA Telnet package, VAX, Alpha with Linux, 甚至 Amiga with AmiTCP 或 AS225-stack 的系統.
2.3 誰可以從 IP Masquerade 中獲益?
如果你有臺連接網際網路的 Linux 主機,而且 如果你有一些執行 TCP/IP 連接到 Linux 機器的電腦在區域網路上,以及/或是 如果你的 Linux 主機有一個以上的數據機并且作為 PPP 或 SLIP 伺服器連接其它電腦,它們 這些其它機器沒有正式指定的 IP 位址.(這些機器從這里開始以後就稱為其它機器) 而且當然,如果你希望這些其它機器不必花額外的費用就能連上網際網路 :)
2.4 誰不需要 IP Masquerade?
如果你的機器是單獨一臺(stand-alone) 連接網際網路的 Linux 主機,那麼執行 IP Masquerade 沒什麼意義,或者 如果你的其它機器擁有正式指定的 IP 位址,那麼你就不需要 IP Masquerade 而且當然,如果你不喜歡免費使用(free ride) 這個主意的話.
2.5 IP Masquerade 是如何運作的? 節自 Ken eves 的 IP Masquerade FAQ:
ipfwadm -F -p deny ipfwadm -F -a m -S yyy.yyy.yyy.yyy/x -D 0.0.0.0/0
其中 x 視你的子網路而定,為下列數字之一,而 yyy.yyy.yyy.yyy 則是你的網路位址. netmask | x | Subnet ~~~~~~~~~~~~~~~~|~~~~|~~~~~~~~~~~~~~~ 255.0.0.0 | 8 | Class A 255.255.0.0 | 16 | Class B 255.255.255.0 | 24 | Class C 255.255.255.255 | 32 | Point-to-point
例如,如果我是在一個 class C 子網路上,我得輸入:
ipfwadm -F -p deny ipfwadm -F -a m -S 192.168.1.0/24 -D 0.0.0.0/0
** 下面的列表將不再被維護了.可經由 Linux IP masquerading 運作的應用程式請參考 這里 和 IP Masquerade Resource 以取得進一步的細節. ** 一般說來,使用傳輸控制協定(TCP) 或是使用者定義資料協定 (UDP)的應用程式應該都能運作.如果你有任何關於應用程式與 IP Masquerade 相容的建議,提示或問題,請拜訪由 Lee Nevo 維護的 可與 Linux IP masquerading 運作的應用程式 網頁.
PC-anywhere for windows 2.0 MS-Windows, 經由 TCP/IP 遠端遙控 PC ,只有在作為客戶端而非主機端的情形下才能運作
Socket Watch 使用 ntp - 網路時間協定
Linux net-acct package Linux, 網路帳號管理套件
無法使用的客戶端軟體
Intel Internet Phone Beta 2 可以連上但聲音只能單向(往外)傳送
Intel Streaming Media Viewer Beta 1 無法連上伺服器
Netscape CoolTalk 無法連接對方
talk,ntalk 這將不會運作 - 需要撰寫一份核心代理程式.
WebPhone 目前無法運作(它做了不合法的位址假設).
X 沒有測試過,但我想除非有人建立一套 X 代理程式否則它無法運作,這可能是 masquerading 程式碼之外的一個外部程式.一個讓它運作的方式是使用 ssh 作為鏈結并且使用其內部的 X 代理功能來執行!
已測試過可以作為其它機器的平臺/作業系統
Linux Solaris Windows 95 Windows NT (both workstation and server) Windows For Workgroup 3.11 (with TCP/IP package) Windows 3.1 (with Chameleon package) Novel 4.01 Server OS/2 (including Warp v3) Macintosh OS (with MacTCP or Open Transport) DOS (with NCSA Telnet package, DOS Trumpet works partially) Amiga (with AmiTCP or AS225-stack) VAX Stations 3520 and 3100 with UCX (TCP/IP stack for VMS) Alpha/AXP with Linux/Redhat SCO Openserver (v3.2.4.2 and 5) IBM RS/6000 running AIX (誰還測試過其它平臺?)
4.4 IP Firewall Administration (ipfwadm) 這一節提供關於 ipfwadm 更深入的使用指引.
** 請不要嘗試送電子郵件給我問 IP Masquerade 的問題.因於個人工作的負擔,我無法保證回覆所有非 website 相關的問題.請將你的問題送到 IP Masquerade mailing list (我想這是最佳的求助來源).這點很抱歉,但我不想讓你等幾個星期才收到回信. **
IP Masquerade Resource page 應該有足夠的資訊設定 IP Masquerade. 加入 IP masquerade 郵遞列表(建議) 要訂閱的話,寄封標題為 "subscribe" (不包含引號)的郵件到 [email protected] 要取消訂閱的話,寄封標題為 "unsubscribe" (不包含引號)的郵件到 [email protected] 要獲得使用這個郵遞列表的協助說明的話,寄封標題為 "archive help" 或 "archive dir" (不包含引號)的郵件到 [email protected] IP masquerade 郵遞列表檔案 包含所有過去送到這個郵遞列表的訊息。 本文件 Linux IP Masquerade mini HOWTO for kernel 2.x (如果你使用 1.3.x or 2.x 的核心) IP Masquerade HOWTO for kernel 1.2.x 如果你使用比較舊的核心 IP masquerade FAQ 有些一般性的資訊 X/OS Ipfwadm page 包含關於 ipfwadm 套件的原始程式碼,執行檔,文件,以及其它資訊 由 Lee Nevo 所維護的網頁 可與 Linux IP masquerading 運作的應用程式 提供提示與技巧使得應用程式能與 IP Masquerade 運作. LDP Network Administrator's Guide 這是新手嘗試設定網路的必要資訊 Linux NET-2 HOWTO 也有許多關於 Linux 網路方面有用的資訊 Linux ISP Hookup HOWTO 以及 Linux PPP HOWTO 給你如何把 Linux 主機連上網際網路的相關資訊 Linux Ethernet-Howto 有關設定執行乙太網路的區域網路很棒的資訊來源 你也可能對 Linux Firewalling and Proxy Server HOWTO 有興趣 Linux Kernel HOWTO 將會指引你編譯核心的過程 其它 Linux HOWTOs 像是 Kernel HOWTO 張貼到這個 USENET 新聞群組: comp.os.linux.networking
5.2 感謝
Gabriel Beitler, [email protected] on providing section 3.3.8 (setting up Novel) Ed Doolittle, [email protected] on suggestion to -V option in ipfwadm command for improved security Matthew Driver, [email protected] on helping extensively on this HOWTO, and providing section 3.3.1 (setting up Windows 95) Ken Eves, [email protected] on the FAQ that provides invaluable information for this HOWTO Ed. Lott, [email protected] for a long list of tested system and software Nigel Metheringham, [email protected] on contributing his version of IP Packet Filtering and IP Masquerading HOWTO, which make this HOWTO a better and technical in-depth document section 4.1, 4.2, and others Keith Owens, [email protected] on providing an Excellent guide on ipfwadm section 4.2 on correction to ipfwadm -deny option which avoids a security hole, and clarified the status of ping over IP Masquerade Rob Pelkey, [email protected] on providing section 3.3.6 and 3.3.7 (setting up MacTCP and Open Transport) Harish Pillay, [email protected] on providing section 4.5 (dial-on-demand using diald) Mark Purcell, [email protected] on providing section 4.6 (IPautofw) Ueli Rutishauser, [email protected] on providing section 3.3.9 (setting up OS/2 Warp) John B. (Brent) Williams, [email protected] on providing section 3.3.7 (setting up Open Transport) Enrique Pessoa Xavier, [email protected] on the bootp setup suggestion developers of IP Masquerade for this great feature Delian Delchev, [email protected] Nigel Metheringham, [email protected] Keith Owens, [email protected] Jeanette Pauline Middelink, [email protected] David A. Ranch, [email protected] Miquel van Smoorenburg, [email protected] Jos Vos, [email protected] 還有其它我忘了提的(請讓我知道) 所有送回饋及建議到郵遞列表上的使用者,特別是那些報告文件上的錯誤以及已支援與未支援的客戶端的. 如果我沒有包括某些使用者送給我的資訊我感到抱歉.有如此多的建議與想法送到我這里,但我只是沒有足夠的時間去確定或者我不小心丟了.我正盡我最大的努力整合所有送給我的資訊到這份文件里.感謝你的辛勞,而我也希望你能諒解我的情況.
5.3 參考資料
Ken Eves 的 IP masquerade 常見問答集 Indyramp Consulting 之 IP masquerade 郵遞列表 X/OS 的 Ipfwadm 網頁 各個關於網路的 Linux HOWTOs