當前位置:首頁 » 雲伺服器 » nat伺服器ip

nat伺服器ip

發布時間: 2024-05-30 11:31:48

⑴ NAT將私網IP轉換為公網IP的過程是哪些

隨著IPv6時代的到來,我也一直懷疑,是不是還有必要再去學習NAT技術——因為網路的資源不再如IPv4時代匱乏,而NAT技術正是為解決IP地址的緊缺而存在的,如此,NAT便沒有存在的必要了。

但是,隨著這篇文章的翻譯,我的懷疑慢慢變成慶幸,漸而又變為肯定,通過翻譯所學到的東西,不再僅僅是翻譯第一手資料帶來的成就感,更多的是通過翻譯,去領悟技術前輩們的智慧與經驗,也通過翻譯,養成自己從第一手資料獲得信息的習慣,從而將視野放得更寬,讓理解更為透徹——至少,很多東西都是要經過仔細斟酌才真正轉化為自己思想的一部分的。正是如此,我才堅定的要把這篇文章翻譯完,也如之前所提到的,如果時間允許的話,我會用C#來寫一些例子,讓大家更好的理解NAT技術,掌握NAT技術(主要涉及到即時通訊、文件對等傳輸和語音應用三個方面)。

這篇文章主要是介紹一下「代理」機制的起因以及給P2P應用帶來的不便,不需要任何基礎知識:)

1. Introction

1、簡介

關鍵詞:

middleboxe(s) —— 我翻譯成「代理」,也許有更好的翻譯

host —— 我翻譯成「主機」,希望大家不要理解成伺服器了,主機就是一台普通的終端機

Present-day Internet has seen ubiquitous deployment of "middleboxes" such as network address translators(NAT), driven primarily by the ongoing depletion of the IPv4 address space. The asymmetric addressing and connectivity regimes established by these middleboxes, however, have created unique problems for peer-to-peer (P2P) applications and protocols, such as teleconferencing and multiplayer on-line gaming. These issues are likely to persist even into the IPv6 world, where NAT is often used as an IPv4 compatibility mechanism [NAT-PT], and firewalls will still be commonplace even after NAT is no longer required.

在當今的Internet中,普遍存在使用「代理」設備來進行網路地址轉換(NAT),導致這種現象的原因是 IPV4 地址空間的資源耗盡危機。雖然不對稱 asymmetric 的地址分配和連通性制度已經在代理中被定義,但是卻給端對端應用程序和協議制定造成了一些特殊的問題。像電話會議和多媒體網路游戲。這些問題即使在IPV6世界中還是會存在,因為NAT作為IPV4的一種兼容性機制經常被使用[NAT-PT],並且防火牆將仍然將普遍存在,即使不再需要NAT技術。

Currently deployed middleboxes are designed primarily around the client/server paradigm, in which relatively anonymous client machines actively initiate connections to well-connected servers having stable IP addresses and DNS names.

Most middleboxes implement an asymmetric communication model in which hosts on the private internal network can initiate outgoing connections to hosts on the public network, but external hosts cannot initiate connections to internal hosts except as specifically configured by the middlebox's administrator. In the common case of NAPT, a client on the internal network does not have a unique IP address on the public Internet, but instead must share a single public IP address, managed by the NAPT, with other hosts on the same private network.The anonymity and inaccessibility of the internal hosts behind a middlebox is not a problem for client software such as web browsers, which only need to initiate outgoing connections. This inaccessibility is sometimes seen as a privacy benefit.

當前使用的「代理」技術主要是為 客戶端/服務端 C/S 結構設計的,為了實現那些需要連接但是又沒有固定IP地址的客戶端能夠連接到一台配置好的擁有固定IP和DNS域名的伺服器。
大多數的「代理」使用一種 asymmetric 通信模型,即 私網(區域網) 的主機能發起一個「外出」連接去連接公網上的主機。 但是公網上的主機卻無法發送信息給私網上的主機(除非對「代理」進行特殊的配置),NAPT(網路地址埠轉換)的普通情況是,一個私網客戶端不需要一個公網的固定的IP地址,但是必須要共享一個由NAPT控制的公網的固定IP地址(當然這個NAPT是處於同一個私網內部的)。這樣的話,這些匿名的並且看起來難以觸及的藏在NAT之後的內網主機對於像 Web瀏覽器 這種軟體來說就不是一個問題,因為內網的主機只需要發起向外部的連接就可以了。這樣一來,無法觸及也還是有他的優點的——那就是具有保密性。

In the peer-to-peer paradigm, however, Internet hosts that would normally be considered "clients" need to establish communication sessions directly with each other. The initiator and the responder might lie behind different middleboxes with neither endpoint having any permanent IP address or other form of public network presence. A common on-line gaming architecture, for example, is for the participating application hosts to contact a well-known server for initialization and administration purposes. Subsequent to this, the hosts establish direct connections with each other for fast and efficient propagation of updates ring game play.

Similarly, a file sharing application might contact a well-known server for resource discovery or searching, but establish direct connections with peer hosts for data transfer. Middleboxes create problems for peer-to-peer connections because hosts behind a middlebox normally have no permanently usable public ports on the Internet to which incoming TCP or UDP connections from other peers can be directed.

RFC 3235 [NAT-APPL] briefly addresses this issue, but does not offer any general solutions.

然而,在P2P的應用中,Internet上的「客戶機」之間是需要建立一個通信會話直連的。邀請者和響應者也許會處於不同的NAT之後,也許他們都沒有固定IP或者即使有也不是公網的IP地址。舉例來說,在一個普通的網路游戲體系結構中,都是通過客戶端向一個具有公網固定IP的伺服器發起申請進行初始化並通過驗證的。同時,客戶端之間也要建立直連,才使網路間傳輸的速度加快,保證數據即時更新(不然搶不到裝備啊,呵呵)。

同樣的,一個文件共享應用程序也必須通過到一個伺服器上去查找它想要的資源,然後再到擁有這個數據的主機上去下載(BT網站,走了一個中介),「代理」造成了很多P2P直連的問題,因為藏在「代理」之後的的主機通常沒有固定的埠來使其他的客戶端發起的TCP或UDP連接能夠最終到達。

RFC 3235[NAT-APPL] 簡要的提到了這個問題,但是沒有給出任何的解決方案。

In this document we address the P2P/middlebox problem in two ways. First, we summarize known methods by which P2P applications can work around the presence of middleboxes. Second, we provide a set of application design guidelines based on these practices to make P2P applications operate more robustly over currently-deployed middleboxes. Further, we provide design guidelines for future middleboxes to allow them to support P2P applications more effectively. Our focus is to enable immediate and wide deployment of P2P applications requiring to traverse middleboxes.

在這篇文章中,我們用兩種方式討論 P2P/代理 的問題。首先,概要的講敘已有的P2P應用程序能夠在現有的代理機制中的工作原理。然後,我們提供一組應用程序設計指南,基於已有的實踐,在現有的配置好的代理上,來使得P2P應用程序操作更加有條理。最後,我們提供了設計指南,為以後的代理機制能夠更方便支持P2P應用程序。討論的焦點是如何 直接的、廣泛的 配置那些需要經過「代理」的P2P應用程序。
Peer-to-Peer (P2P) communication across middleboxes(術語篇)

2. Terminology

2. 術語

In this section we first summarize some middlebox terms. We focus hereon the two kinds of middleboxes that commonly cause problems for P2P applications.

在這一章節中,首先概要的介紹一下「代理」技術的一些術語。然後集中討論兩種造成P2P應用問題的代理機制。

Firewall

A firewall restricts communication between a private internal network and the public Internet, typically by dropping packets that are deemed unauthorized. A firewall examines but does not modify the IP address and TCP/UDP port information in packets crossing the boundary.

防火牆

防火牆限制了私網與公網的通信,它主要是將(防火牆)認為未經授權的的包丟棄,防火牆只是檢驗包的數據,並不修改數據包中的IP地址和TCP/UDP埠信息。

Network Address Translator (NAT)

A network address translator not only examines but also modifies the header information in packets flowing across the boundary, allowing many hosts behind the NAT to share the use of a smaller number of public IP addresses (often one). Network address translators in turn have two main varieties:

網路地址轉換(NAT)

當有數據包通過時,網路地址轉換器不僅檢查包的信息,還要將包頭中的IP地址和埠信息進行修改。以使得處於NAT之後的機器共享幾個僅有的公網IP地址(通常是一個)。網路地址轉換器主要有兩種類型:

Basic NAT

A Basic NAT maps an internal host's private IP address to a public IP address without changing the TCP/UDP port numbers in packets crossing the boundary. Basic NAT is generally only useful when the NAT has a pool of public IP addresses from which to make address bindings on behalf of internal hosts.

基礎NAT

基礎NAT 將私網主機的私有IP地址轉換成公網IP地址,但並不將TCP/UDP埠信息進行轉換。基礎NAT一般用在當NAT擁有很多公網IP地址的時候,它將公網IP地址與內部主機進行綁定,使得外部可以用公網IP地址訪問內部主機。(譯者註:實際上是只將IP轉換,192.168.0.23 <-> 210.42.106.35,這與直接設置IP地址為公網IP還是有一定區別的,特別是對於企業來說,外部的信息都要經過統一防火牆才能到達內部,但是內部主機又可以使用公網IP)

Network Address/Port Translator (NAPT)

By far the most common, a Network Address/Port Translator examines and modifies both the IP address and the TCP/UDP port number fields of packets crossing the boundary, allowing multiple internal hosts to share a single public IP address simultaneously.

Refer to [NAT-TRAD] and [NAT-TERM] for more general information on NAT taxonomy and terminology. Additional terms that further classify NAPT are defined in more recent work [STUN]. When an internal host opens an outgoing TCP or UDP session through a network address/port translator, the NAPT assigns the session a public IP address and port number so that subsequent response packets from the external endpoint can be received by the NAPT, translated, and forwarded to the internal host. The effect is that the NAPT establishes a port binding between (private IP address, private port number) and (public IP address, public port number).

The port binding defines the address translation the NAPT will perform for the ration of the session. An issue of relevance to P2P applications is how the NAT behaves when an internal host initiates multiple simultaneous sessions from a single (private IP, private port) pair to multiple distinct endpoints on the external network.

網路地址和埠轉換 (NAPT)

這是最普遍的情況,網路地址/埠轉換器檢查、修改包的IP地址和TCP/UDP埠信息,這樣,更多的內部主機就可以同時使用一個公網IP地址。

請參考[NAT-TRAD]和[NAT-TERM]兩個文檔了解更多的NAT分類和術語信息。另外,關於NAPT的分類和術語,[STUN]在最近做了更多的定義。當一個內部網主機通過NAT打開一個「外出」的TCP或UDP會話時,NAPT分配給這個會話一個公網IP和埠,用來接收外網的響應的數據包,並經過轉換通知內部網的主機。這樣做的效果是,NAPT在 [私有IP:私有埠] 和[公網IP:公網埠]之間建立了一個埠綁定。

埠綁定指定了NAPT將在這個會話的生存期內進行地址轉換任務。這中間存在一個這樣的問題,如果P2P應用程序從內部網路的一個[私有IP地址:埠]對同時發出多條會話給不同的外網主機,那麼NAT會怎樣處理呢?請看以下幾種方案。

Cone NAT

After establishing a port binding between a (private IP, private port) tuple and a (public IP, public port) tuple, a cone NAT will re-use this port binding for subsequent sessions the application may initiate from the same private IP address and port number, for as long as at least one session using the port binding remains active.

錐形NAT

(譯者註:為什麼叫做錐形呢?請看以下圖形,終端和外部伺服器,都通過NAT分派的這個綁定地址對來傳送信息,就象一個漏斗一樣,篩選並傳遞信息)

當建立了一個 [私有IP:埠]-[公網IP:埠] 埠綁定之後,對於來自同一個[私有IP:埠]會話,錐形NAT伺服器允許發起會話的應用程序 重復使用這個埠綁定,一直到這個會話結束才解除(埠綁定)。

For example, suppose Client A in the diagram below initiates two simultaneous outgoing sessions through a cone NAT, from the same internal endpoint (10.0.0.1:1234) to two different external servers, S1 and S2. The cone NAT assigns just one public endpoint tuple(元組), 155.99.25.11:62000, to both of these sessions, ensuring that the "identity" of the client's port is maintained across address translation. Since Basic NATs and firewalls do not modify port numbers as packets flow across the middlebox, these types of middleboxes can be viewed as a degenerate form of Cone NAT.

例如,假設 Client A(IP地址信息如上圖所示)通過一個 錐形NAT 同時發起兩個外出的連接,它使用同一個內部埠(10.0.0.1:1234)給公網的兩台不同的伺服器,S1和S2。錐形NAT 只分配一個公網IP和埠(155.99.25.11:62000)給這個兩個會話,通過地址轉換可以 確保 Client使用埠的「同一性」(譯者註:即這個Client只使用這個埠)。而基礎NATs和防火牆卻不能修改經過的數據包埠號,它們可以看作是錐形NAT的精簡版本。

Symmetric NAT

A symmetric NAT, in contrast, does not maintain a consistent port binding between (private IP, private port) and (public IP, public port) across all sessions.

Instead, it assigns a new public port to each new session. For example, suppose Client A initiates two outgoing sessions from the same port as above, one with S1 and one with S2. A symmetric NAT might allocate the public endpoint 155.99.25.11:62000 to session 1, and then allocate a different public endpoint 155.99.25.11:62001, when the application initiates session 2. The NAT is able to differentiate between the two sessions for translation purposes because the external endpoints involved in the sessions (those of S1 and S2) differ, even as the endpoint identity of the client application is lost across the address translation boundary.

對稱NAT

對稱NAT,與Cone NAT是大不相同的,並不對會話進行埠綁定,而是分配一個全新的 公網埠 給每一個新的會話。

還是上面那個例子:如果 Client A (10.0.0.1:1234)同時發起兩個 "外出" 會話,分別發往S1和S2。對稱Nat會分配公共地址155.99.25.11:62000給Session1,然後分配另一個不同的公共地址155.99.25.11:62001給Session2。對稱Nat能夠區別兩個不同的會話並進行地址轉換,因為在 Session1 和 Session2中的外部地址是不同的,正是因為這樣,Client端的應用程序就迷失在這個地址轉換邊界線了,因為這個應用程序每發出一個會話都會使用一個新的埠,無法保障只使用同一個埠了。

The issue of cone versus symmetric NAT behavior applies equally to TCP and UDP traffic. Cone NAT is further classified according to how liberally the NAT accepts incoming traffic directed to an already-established (publicIP, public port) pair. This classification generally applies only to UDP traffic, since NATs and firewalls reject incoming TCP connection attempts unconditionally unless specifically configured to do otherwise.

在TCP和UDP通信中, (到底是使用同一個埠,還是分配不同的埠給同一個應用程序),錐形NAT和對稱NAT各有各的理由。當然錐形NAT在根據如何公平地將NAT接受的連接直達一個已創建的地址對上有更多的分類。這個分類一般應用在Udp通信(而不是Tcp通信上),因為NATs和防火牆阻止了試圖無條件傳入的TCP連接,除非明確設置NAT不這樣做。這些分類如下:

Full Cone NAT

After establishing a public/private port binding for a new outgoing session, a full cone NAT will subsequently accept incoming traffic to the corresponding public port from ANY external endpoint on the public network. Full cone NAT is also sometimes called "promiscuous" NAT.

全雙工錐形NAT

當內部主機發出一個「外出」的連接會話,就會創建了一個 公網/私網 地址,一旦這個地址對被創建,全雙工錐形NAT會接收隨後任何外部埠傳入這個公共埠地址的通信。因此,全雙工錐形NAT有時候又被稱為"混雜"NAT。

Restricted Cone NAT

A restricted cone NAT only forwards an incoming packet directed to a public port if its external (source) IP address matches the address of a node to which the internal host has previously sent one or more outgoing packets. A restricted cone NAT effectively refines the firewall principle of rejecting unsolicited incoming traffic, by restricting incoming traffic to a set of "known" external IP addresses.

受限制的錐形NAT

受限制的錐形NAT會對傳入的數據包進行篩選,當內部主機發出「外出」的會話時,NAT會記錄這個外部主機的IP地址信息,所以,也只有這些有記錄的外部IP地址,能夠將信息傳入到NAT內部,受限制的錐形NAT 有效的給防火牆提煉了篩選包的原則——即限定只給那些已知的外部地址「傳入」信息到NAT內部。

Port-Restricted Cone NAT

A port-restricted cone NAT, in turn, only forwards an incoming packet if its external IP address AND port number match those of an external endpoint to which the internal host has previously sent outgoing packets. A port-restricted cone NAT provides internal nodes the same level of protection against unsolicited incoming traffic that a symmetric NAT does, while maintaining a private port's identity across translation.

埠受限制的Cone NAT

埠受限制的錐形NAT,與受限制的錐形NAT不同的是:它同時記錄了外部主機的IP地址和埠信息,埠受限制的錐形NAT給內部節點提供了同一級別的保護,在維持埠「同一性」過程中,將會丟棄對稱NAT傳回的信息。

Finally, in this document we define new terms for classifying the P2P-relevant behavior of middleboxes:

最後,在這篇文檔里我們將定義一組新的術語 ,以便更好的對P2P代理相關的行為進行分類。

P2P應用程序

P2P應用程序是指,在已有的一個公共伺服器的基礎上,並分別利用自己的私有地址或者公有地址(或者兩者兼備)來建立一個端到端的會話通信。

P2P-Application

P2P-application as used in this document is an application in which each P2P participant registers with a public registration server, and subsequently uses either its private endpoint, or public endpoint, or both, to establish peering sessions.

P2P-Middlebox

A P2P-Middlebox is middlebox that permits the traversal of P2P applications.

P2P代理

P2P代理是一個允許 P2P應用程序進行通信的代理機制

P2P-firewall

A P2P-firewall is a P2P-Middlebox that provides firewall functionality but performs no address translation.

P2P防火牆

P2P防火牆是一個提供了防火牆的功能的P2P代理,但是不進行地址轉換.

P2P-NAT

A P2P-NAT is a P2P-Middlebox that provides NAT functionality, and may also provide firewall functionality. At minimum, a P2P-Middlebox must implement Cone NAT behavior for UDP traffic, allowing applications to establish robust P2P connectivity using the UDP hole punching technique.

P2P-NAT

P2P-NAT 是一個 P2P代理,提供了NAT的功能,也提供了防火牆的功能,一個最簡的P2P代理必須具有 錐形NAT對Udp通信支持的功能,並允許應用程序利用Udp打洞技術建立強健的P2P連接。

Loopback translation

When a host in the private domain of a NAT device attempts to connect with another host behind the same NAT device using the public address of the host, the NAT device performs the equivalent of a "Twice-nat" translation on the packet as follows. The originating host's private endpoint is translated into its assigned public endpoint, and the target host's public endpoint is translated into its private endpoint, before the packet is forwarded to the target host. We refer the above translation performed by a NAT device as "Loopback translation".

回環轉換

當NAT的私網內部機器想通過公共地址來訪問同一台區域網內的機器的時,NAT設備等價於做了兩次NAT的事情,在包到達目標機器之前,先將私有地址轉換為公網地址,然後再將公網地址轉換回私有地址。我們把具有上敘轉換功能的NAT設備叫做「回環轉換」設備。

⑵ nat伺服器 公網IP 只有一個,那麼NAT伺服器可以為內網多少台電腦提供服務

你理解有誤,埠映射是PAT,而NAT是網路地址轉棗譽轎換,就是把A、B、C類的私網地址轉換成一個或多個合法的凳肆公網地址,並通過其訪問網際網路。私網地址的數量與IP地址的類型虛彎和子網掩碼有關
你可以通過 SUBNET軟體對區域網進行規劃設計。

⑶ NAT鏈嶅姟鍣ㄧ殑NAT鍦↖Pv6涓鐨勫簲鐢

澶у跺筃AT鏅閬嶅瓨鍦ㄨ瑙o紝浠ヨ嚦浜嶯AT娌℃湁鍑虹幇鍦↖Pv6涓琚璇瑙d負澶村彿瀹夊叏椋庨櫓銆傚湪IPv6鐜澧冧腑鏈塏AT鍙鑳戒篃涓嶉敊錛屼絾浜嬪疄涓婏紝瀹冧滑騫朵笉鎻愪緵浠諱綍鐨勯濆栫殑瀹夊叏鎬с傞槻鐏澧欐彁渚涗簡瀹夊叏鎬э紝鑰屼笉鏄緗戠粶鍦板潃杞璇戙
IPv6瀹夊叏涓嶈兘鍙鏄疘Pv4瀹夊叏鐨勭畝鍗曞厠闅嗭紝榪欑嶆兂娉曟槸闈炲父鍗遍櫓鐨勩傛垜浠蹇呴』瀹夋帓鍩硅銆佹墿澶ф斂絳栵紝浠ュ強鍦ㄧ綉緇滀腑閮ㄧ講鏂扮殑鎶鏈鏉ユ姷寰℃柊鐨勫▉鑳併備粠鍚岃川IPv4緗戠粶榪囧害鍒板紓鏋処Pv4/v6緗戠粶甯︽潵浜嗘柊鐨勬祦閲忕被鍨嬩互鍙婅懼囷紝浼佷笟蹇呴』閲嶆柊鑰冭檻銆
姝ゅ栵紝鐢變簬IPv6鐩稿硅緝鏂幫紝鍏跺競鍦烘墠鍒氬垰寮濮嬶紝IPv6瀹夊叏浜у搧涔熻繕涓嶅熸垚鐔熴傚湪鍥寸粫IPv6鐨勫畨鍏ㄦу畬鍠勪箣鍓嶏紝鍦ㄨ繍钀ュ晢璁㊣Pv6涓嶪Pv4鐪嬮綈涔嬪墠錛岃繖鏄涓涓鏈夎叮鐨勫嵄闄╃殑鏃舵湡銆

⑷ nat鍜屽師ip鐨勫叧緋伙紵

婧恘at鍜岀洰鐨刵at鐨勫尯鍒濡備笅錛

絎涓縐嶈存硶

鈶犳簮NAT錛氬氨鏄鎶婂唴緗戜富鏈虹殑IP鍙樻崲鎴愪負緗戝叧鐨勪簰鑱旂綉IP錛岃繖鏍峰唴緗戜富鏈哄彲浠ヤ笂緗
host_inside------>NAT----->Internet--->緗戠珯/QQ/娓告垙鏈嶅姟鍣

鈶$洰鐨凬AT錛氭槸鍦ㄧ綉鍏崇殑NAT鏈嶅姟鍣ㄤ笂鍋氱鍙f槧灝勶紝灝嗙綉鍏崇殑浜掕仈緗戠鍙f槧灝勭粰鍐呯綉IP銆
鍦↖P鍦板潃鏈夐檺鐨勬儏鍐典笅錛屽皢鍐呯綉涓繪満鐨勬湇鍔″彂甯冨埌浜掕仈緗戜笂錛屾瘮濡傚唴緗戞湁涓涓繪満鍋氱綉絝
host_outside---->Internet--->NAT:80------>Host_inside:80
鎴栬呭唴緗戞湁涓狶inux涓繪満闇瑕佽繙紼嬬$悊錛屽彲浠ユ槧灝勯潪鏍囧噯絝鍙
host_outside---->Internet--->NAT:62222------>Host_inside:22

絎浜岀嶈存硶

鈶㈡簮NAT錛氬湴鍧杞鎹㈡槸鍐呯綉鐢ㄦ埛瑕佽塊棶澶栫綉鏃訛紝鍐呯綉鍦板潃杞鎹涓哄叕緗戝湴鍧錛岀劧鍚庢墠鍙浠ヨ塊棶浜掕仈緗戜笂鐨勮祫婧愮殑

鈶g洰鐨凬AT錛氬湴鍧杞鎹㈡槸澶栫綉鍦板潃瑕佽塊棶鍐呯綉鏈嶅姟鍣ㄦ椂錛屽唴緗戞湇鍔″櫒鍦板潃鏄犲皠涓哄栫綉鍦板潃錛岃屽栫綉鐢ㄦ埛閫氳繃璁塊棶璇ユ槧灝勭殑澶栫綉鍦板潃灝卞彲浠ヨ塊棶鍐呯綉鏈嶅姟鍣ㄤ簡錛岃繖鏍峰彲浠ヤ繚鎶ゅ唴閮ㄦ湇鍔″櫒鐨勫畨鍏


鎵╁睍璧勬枡

NAT鍦1994騫存彁鍑虹殑銆傚綋鍦ㄤ笓鐢ㄧ綉鍐呴儴鐨勪竴浜涗富鏈烘湰鏉ュ凡緇忓垎閰嶅埌浜嗘湰鍦癐P鍦板潃錛屼絾鐜板湪鍙堟兂鍜屽洜鐗圭綉涓婄殑涓繪満閫氫俊(騫朵笉闇瑕佸姞瀵)鏃訛紝鍙浣跨敤NAT鏂規硶銆

榪欑嶆柟娉曢渶瑕佸湪涓撶敤緗戣繛鎺ュ埌鍥犵壒緗戠殑璺鐢卞櫒涓婂畨瑁匩AT杞浠躲傝呮湁NAT杞浠剁殑璺鐢卞櫒鍙鍋歂AT璺鐢卞櫒錛屽畠鑷沖皯鏈変竴涓鏈夋晥鐨勫栭儴鍏ㄧ悆IP鍦板潃銆傝繖鏍鳳紝鎵鏈変嬌鐢ㄦ湰鍦板湴鍧鐨勪富鏈哄湪鍜屽栫晫閫氫俊鏃訛紝閮借佸湪NAT璺鐢卞櫒涓婂皢鍏舵湰鍦板湴鍧杞鎹㈡垚鍏ㄧ悆IP鍦板潃錛屾墠鑳藉拰鍥犵壒緗戣繛鎺ャ

NAT涓嶄粎鑳借В鍐矷P鍦板潃涓嶈凍鐨勯棶棰橈紝鑰屼笖榪樿兘澶熸湁鏁堝湴閬垮厤鏉ヨ嚜緗戠粶澶栭儴鐨勬敾鍑伙紝闅愯棌騫朵繚鎶ょ綉緇滃唴閮ㄧ殑璁$畻鏈恆

1.瀹藉甫鍒嗕韓錛氳繖鏄 NAT 涓繪満鐨勬渶澶у姛鑳姐

2.瀹夊叏闃叉姢錛歂AT 涔嬪唴鐨 PC 鑱旀満鍒 Internet 涓婇潰鏃訛紝浠栨墍鏄劇ず鐨 IP 鏄 NAT 涓繪満鐨勫叕鍏 IP錛屾墍浠 Client 絝鐨 PC 褰撶劧灝卞叿鏈変竴瀹氱▼搴︾殑瀹夊叏浜嗭紝澶栫晫鍦ㄨ繘琛 portscan錛堢鍙f壂鎻忥級 鐨勬椂鍊欙紝灝變睛嫻嬩笉鍒版簮Client 絝鐨 PC 銆

鍙傝冭祫鏂欐潵婧愶細鐧懼害鐧劇-nat

⑸ NAT怎麼配置

前很多人都通過NAT接入互聯網。NAT可以在內網IP和公網IP間轉換,這樣內網用戶就可以直接訪問到互聯網了。大多數用戶使用的NAT叫做埠地址轉換(PAT),Cisco稱這種方式為NAT overload 。在開始前,我們首先了解一下什麼是靜態NAT。圖A是一個網路拓撲圖。

我們的目標是:將互聯網上的靜態IP通過路由器轉換為內部網路IP。對於帶有Web設置界面的Linksys路由器來說,這個工作實現起來很簡單。但是對於採用命令行(CLI)模式的Cisco路由器來說,如果不知道相應的命令就麻煩了。因此在開始前多收集一些信息是很必要的。比如在我們給出的圖例中,我們需要通過以下方法採集必要的信息:◆路由器內聯埠 E0/0: IP 10.1.1.1
◆路由器外聯埠 S0/0: IP 63.63.63.1
◆Web/mail伺服器內網 IP: 10.1.1.2
◆Web/mail 伺服器公網 IP: 63.63.63.2要讓外網用戶訪問內網的 Web/mail伺服器,有兩步必要的工作:1.配置NAT
2.配置防火牆在本文中,我重點講述基本的靜態NAT配置。但是各位讀者應該確保外網的有關數據可以通過防火牆進入內網。不論是使用ACL還是Cisco IOS配置防火牆,都要確保你熟悉Cisco IOS的操作順序,並設定正確的IP地址(公網和內網)。換句話說,你應該知道是NAT先工作還是防火牆過濾先工作。在獲取了相關信息後,我們就開始配置靜態NAT了。在我們的例子中,我們首先進行一下基本配置:interface Serial0/0
ip address 63.63.63.1 255.255.255.0
ip nat outside
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0
ip nat inside我們需要使用 NAT轉換將Web/mail伺服器的公網IP地址從63.63.63.2 轉換到 10.1.1.2 (並從10.1.1.2 轉換到 63.63.63.2)。 下面就是內網和公網間的NAT配置:router (config)# ip nat inside source static tcp 10.1.1.2 25 63.63.63.2 25
router (config)# ip nat inside source static tcp 10.1.1.2 443 63.63.63.2 443
router (config)# ip nat inside source static tcp 10.1.1.2 80 63.63.63.2 80
router (config)# ip nat inside source static tcp 10.1.1.2 110 63.63.63.2 110之所以用以上埠,是因為這些埠符合相應服務所對應的埠。比如25埠對應SMTP郵件發送,443埠對應安全的Web連接HTPS,80埠對應HTTP,110埠對應POP3收信。以上配置是假定我們有一個固定的公網IP,如果沒有,我們也可以使用路由器出口IP(本例中是Serial 0/0),配置方法如下:router (config)# ip nat inside source static tcp 10.1.1.2 25 interface serial 0/0 25如果你的公網IP地址是通過ISP的DHCP分配的 IP,也可以用上述配置方式。另外,我們還需要將Web伺服器和郵件伺服器的域名注冊到互聯網上的DNS注冊表中。這樣當用戶在瀏覽器中輸入域名就可以訪問到我們的網站了。比如用戶輸入www.mywebserver.com,就可以訪問到63.63.63.2,然後我們的路由器會把這個地址轉化為10.1.1.2 。這樣Web伺服器就會受到瀏覽請求並順利進行響應。除了配置靜態NAT,也許你希望同時能學會如何配置動態NAT,這樣你的內網PC就可以通過動態NAT(比如NAT overload或PAT)訪問互聯網了。

熱點內容
php是什麼呢 發布:2024-06-18 19:34:55 瀏覽:409
設計加密技術 發布:2024-06-18 04:23:50 瀏覽:363
安卓wetv哪裡下 發布:2024-06-18 03:18:53 瀏覽:372
怎麼把照片上傳到雲端 發布:2024-06-18 02:00:24 瀏覽:769
sqlupdate字元串 發布:2024-06-18 01:56:14 瀏覽:679
ftp怎麼上傳文件到手錶 發布:2024-06-18 01:43:32 瀏覽:222
正則表達式匹配sql 發布:2024-06-18 01:21:06 瀏覽:882
夢幻西遊手游腳本免費 發布:2024-06-18 00:42:05 瀏覽:195
linuxmysql56 發布:2024-06-18 00:16:00 瀏覽:620
大眾suv配置如何 發布:2024-06-18 00:08:51 瀏覽:616