日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

一、要求

1.在cisco1、2、3上完成基本的配置,根據拓撲

2.在cisco2上完成NAT的基本配置

3.理解靜態(tài)NAT,動態(tài)NAT和PAT的原理

二、拓撲

「實戰(zhàn)」網絡技術中的NAT地址轉換技術,一分鐘了解下

 

三、配置步驟

設備從左到右分別為1-3

1、配置每個設備的名稱和接口的ip地址

cisco1(config)#interface serial 0

cisco1(config-if)#ip address 192.168.12.1 255.255.255.0

cisco1(config-if)#ip address 192.168.12.2 255.255.255.0 secondary

注:配置輔助ip地址。

cisco1(config-if)#ip address 192.168.12.3 255.255.255.0 secondary

cisco1(config-if)#no sh

cisco2(config)#interface serial 0

cisco2(config-if)#ip address 192.168.12.254 255.255.255.0

cisco2(config-if)#no shutdown

cisco2(config-if)#clock rate 64000

cisco2(config)#interface serial 1

cisco2(config-if)#ip add 192.168.23.2 255.255.255.0

cisco2(config-if)#no shutdown

cisco2(config-if)#clock rate 64000

cisco2(config-if)#exit

cisco3(config)#interface serial 1

cisco3(config-if)#ip add 192.168.23.3 255.255.255.0

cisco3(config-if)#no shutdown

cisco3(config-if)#exit

2、在cisco2上完成靜態(tài)NAT的配置。

cisco2(config)#ip nat inside source static 192.168.12.1 192.168.23.4

注:Inside關鍵字指定內部源本地ip地址轉換成內部全局ip地址。當數據由內向外是轉換是源地址。回應時轉換的是目標地址。靜態(tài)NAT轉換一對一。內部局部地址:在內部網絡使用的地址。內部全局地址:用來代替一個或多個本地地址的,對外的,向NIC注冊過的地址。

cisco2(config)#interface serial 0

cisco2(config-if)#ip nat inside-----------指定了s0接口在內部。

cisco2(config-if)#int s 1

cisco2(config-if)#ip nat out--------------指定s1接口在外部。

cisco2(config-if)#end

cisco2#debug ip nat

IP NAT debugging is on

cisco1#ping 192.168.23.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

.....

Success rate is 0 percent (0/5)

注:用本地地址192.168.12.1 Ping 192.168.23.3,結果沒有ping通,為什么?

cisco2#show ip nat translations

注:查看cisco2上是否有地址轉換的NAT表。

cisco1(config)#ip route 192.168.23.0 255.255.255.0 serial 0

cisco1(config)#end

注:為cisco1上加上去往cisco3的路由。

cisco1#ping 192.168.23.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

!!!!!

注:可以ping 通說明加上了路由可以讓數據發(fā)出去也能回來。

Success rate is 100 percent (5/5), round-trip min/avg/max = 68/74/88 ms

cisco1#ping---------------使用擴展ping。

Protocol [ip]:

Target IP address: 192.168.23.3

Repeat count [5]: 50----------發(fā)送50數據包。

Datagram size [100]:

Timeout in seconds [2]:

Extended commands [n]: ----------------這里不使用擴展的命令,直接回車。表示使用主ip地址192.168.12.1來ping192.168.23.3。

Sweep range of sizes [n]:

Type escape sequence to abort.

Sending 50, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

!!!!!!!!!!!!!!!!!!!!!

Terminal-Server#2-----------快速切換到cisco2上。來查看具體的轉換過程。

[Resuming connection 2 to cisco2 ... ]

00:18:28: NAT*: s=192.168.12.1->192.168.23.4, d=192.168.23.3 [38]

00:18:28: NAT*: s=192.168.23.3, d=192.168.23.4->192.168.12.1 [38] 省略…

注:第一個條目是將源地址進行轉化。那第二個條目是將目的地址進行轉化。

cisco2#show ip nat translations

Pro Inside global Inside local Outside local Outside global

--- 192.168.23.4 192.168.12.1 --- ---

注:建立了NAT表,當有流量符合這個匹配規(guī)則時就會兩個地址進行轉換。

2、在cisco2上完成動態(tài)NAT的配置。

cisco2(config)#no ip nat inside source static 192.168.12.1 192.168.23.4------------將原來的靜態(tài)NAT的條目刪除。

若不能刪除請執(zhí)行命令:clear ip nat tran *

cisco2(config)#access-list 1 permit 192.168.12.0 0.0.0.255

注:通過使用用戶訪問控制列表來定義本地地址池。

cisco2(config)#ip nat pool cisco 192.168.34.1 192.168.34.2 p 24

注:通過使用用戶訪問控制列表來定義本地地址池。

cisco2(config)#ip nat inside source list 1 pool cisco

注:定義公有地址池,命名為cisco。地址的范圍是192.168.34.1到192.168.34.2,子網掩碼用前綴表示24。也可以使用關鍵字network+具體的網段。

3、用192.168.12.1 ping 192.168.23.3

cisco1#ping 192.168.23.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

.....

Success rate is 0 percent (0/5)

注:當數據包到達cisco2時會將192.168.12.1轉化成192.168.34.1,這時cisco3會收到這個數據包,因為目的地址沒變。但cisco3給cisco1回應時,將以192.168.34.1為目的地址,這是在cisco3上沒有相關的路由條目。

cisco3(config)#ip route 192.168.34.0 255.255.255.0 s 1

注:在cisco3上配置去往cisco1上公有地址的路由。

cisco1#ping

Protocol [ip]:

Target IP address: 192.168.23.3

Repeat count [5]: 50

Sending 50, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

!!!!!!!!!!!!!!! ------------------Ping通說明路由添加正確。

Terminal-Server#2

[Resuming connection 2 to cisco2 ... ]

01:16:55: NAT*: s=192.168.12.1->192.168.34.1, d=192.168.23.3 [134]

01:16:55: NAT*: s=192.168.23.3, d=192.168.34.1->192.168.12.1 [134]

省略…

cisco2#show ip nat tr

Pro Inside global Inside local Outside local Outside global

--- 192.168.34.1 192.168.12.1 --- ---

4、用192.168.12.2 ping 192.168.23.3

cisco1#ping

Protocol [ip]:

Target IP address: 192.168.23.3

Repeat count [5]: 20

Datagram size [100]:

Timeout in seconds [2]:

Extended commands [n]: y

Source address or interface: 192.168.12.2

Sending 20, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

Packet sent with a source address of 192.168.12.2

!!!!!!!!!!

注:要求使用擴展的命令。可以選擇詳細的參數。比如這里可以使用輔助的ip地址。使用cisco1接口s0的輔助ip地址來作為源地址。

Terminal-Server#2

[Resuming connection 2 to cisco2 ... ]

01:35:02: NAT*: s=192.168.12.2->192.168.34.2, d=192.168.23.3 [22]

01:35:02: NAT*: s=192.168.23.3, d=192.168.34.2->192.168.12.2 [22]

省略…

注:源地址192.168.12.2轉換成192.168.34.2。很明顯調用了第2個公有地址。

cisco2#show ip nat tr

Pro Inside global Inside local Outside local Outside global

--- 192.168.34.1 192.168.12.1 --- ---

--- 192.168.34.2 192.168.12.3 --- ---

5、用192.168.12.3 ping 192.168.23.3

cisco1#ping

Protocol [ip]:

Target IP address: 192.168.23.3

Repeat count [5]: 20

Extended commands [n]: y

Source address or interface: 192.168.12.3-------------用第3個私有地址來ping192.168.23.3。

Sending 20, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

Packet sent with a source address of 192.168.12.3

U.U.U.U.U.--------------結果不能ping通到目的。

Terminal-Server>2

[Resuming connection 2 to cisco2 ... ]

00:22:02: NAT: translation failed (A), dropping packet s=192.168.12.3 d=192.168.23.3

00:22:02: NAT: translation failed (A), dropping packet s=192.168.12.3 d=192.168.23.3

省略…

注:從調試的信息中可以查找出不能ping通的原因。是因為地址轉換的失敗而丟包。

cisco2#show ip nat tr--通過顯示NAT表也可以發(fā)現沒有192.168.12..3的條目。

Pro Inside global Inside local Outside local Outside global

--- 192.168.34.1 192.168.12.1 --- ---

--- 192.168.34.2 192.168.12.2 --- ---

解決的方法: 1、清除NAT表中的條目,將公有地址池中的公有地址釋放出來。

2、將NAT超時時間改小,讓被轉換的目標地址能在短時間內得到釋放。請大家自己研究

cisco2#clear ip nat tr *

cisco2#show ip nat tr

Terminal-Server>1

[Resuming connection 1 to r4 ... ]

cisco1#ping

Protocol [ip]:

Target IP address: 192.168.23.3

Extended commands [n]: y

Source address or interface: 192.168.12.3

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

Packet sent with a source address of 192.168.12.3

!!!!!-------又可以ping通對端。

Terminal-Server>2

[Resuming connection 2 to cisco2 ... ]

00:46:21: NAT: s=192.168.12.3->192.168.34.2, d=192.168.23.3 [55]

00:46:21: NAT*: s=192.168.23.3, d=192.168.34.2->192.168.12.3 [55]

省略…

注:調試所顯示的轉換過程。

cisco2#sh ip nat tr

Pro Inside global Inside local Outside local Outside global

--- 192.168.34.2 192.168.12.3 --- ---

注:NAT表中有了轉換的條目。

6、配置PAT

cisco2(config)#no ip nat pool cisco 192.168.34.1 192.168.34.2 prefix-length 24

cisco2(config)#ip nat pool cisco 192.168.34.1 192.168.34.1 prefix-length 24

cisco2(config)#no ip nat inside source list 1 pool cisco

cisco2(config)#ip nat inside source list 1 pool cisco overload

7、在cisco1用192.168.12.1上ping 192.168.23.3

cisco1#ping 192.168.23.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 68/71/80 ms

Terminal-Server>2

[Resuming connection 2 to cisco2 ... ]

01:01:55: NAT*: s=192.168.12.1->192.168.34.1, d=192.168.23.3 [74]

01:01:55: NAT*: s=192.168.23.3, d=192.168.34.1->192.168.12.1 [74]

省略…

cisco2#sh ip nat tr

Pro Inside global Inside local Outside local Outside global

Icmp 192.168.34.1:6 192.168.12.1:6 192.168.23.3:6 192.168.23.3:6

注:由于發(fā)送的ping包,所以顯示轉換的是icmp協議。隨機產生端口號6。

cisco2#

01:02:55: NAT: expiring 192.168.34.1 (192.168.12.1) icmp 6 (6)

注:約1分鐘的時間釋放地址轉換的空間。

cisco2# sh ip nat translations----查找NAT,表中沒有任何的轉換條目。

cisco2#

8、在cisco1用192.168.12.2上ping 192.168.23.3

cisco1#ping

Protocol [ip]:

Target IP address: 192.168.23.3

Extended commands [n]: y

Source address or interface: 192.168.12.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:

Packet sent with a source address of 192.168.12.2

!!!!!

Terminal-Server>2

[Resuming connection 2 to r5 ... ]

01:03:37: NAT: s=192.168.12.2->192.168.34.1, d=192.168.23.3 [75]

01:03:37: NAT*: s=192.168.23.3, d=192.168.34.1->192.168.12.2 [75]

省略…

cisco2#sh ip nat tr

Pro Inside global Inside local Outside local Outside global

icmp 192.168.34.1:7 192.168.12.2:7 192.168.23.3:7 192.168.23.3:7

注:端口號已改為7。

cisco2#

01:04:37: NAT: expiring 192.168.34.1 (192.168.12.2) icmp 7 (7)

分享到:
標簽:地址 NAT
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰(zhàn)2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定