不少的網友,如今已經掌握或者瞭解Cisco 路由,交換技術。平時也可能作了比較多的分解實驗,可是從NA到NP以及到IE,發現本身的水平見長的不快,不少的知識點學完過一段就忘了,知識點關聯不起來。這時可想辦法,搭建綜合實驗環境,模擬真實網絡的故障,鍛鍊本身的排錯能力,以快速把所學的知識點聯繫起來。
實際上本實驗也是真實的項目案例,在實驗環境下,徹底模擬出來,這僅僅不是一次綜合實驗!
近日剛講完NA的課程,給學生們留一個NA綜合實驗,今天也發佈到網上,但願那些想學的新手,好好練習一下。
以下,綜合實驗拓撲和實驗要求
本篇博文發表於5月30日,當時我只留了需求,目的是讓更多的網友參與其中,自行搭建拓撲環境來模擬此案例。截止6月1日,有不少朋友參與了討論。特別是網友「拿貝馬凡」,能把本身的實驗過程,貼到評論區和你們相互交流,很欣賞該網友的學習精神。加油,你必定會成功的。
現在,如今提供完整的解法。歡迎你們來討論。
爲了讓不少的網友學習這個實驗,我在實驗過程使用了路由器來模擬PC,如須要關閉路由功能,並指定PC的網關地址,PC的網關地址實際上就是對應的子接口的IP地址。
------------------------- PC1---------------------------------
PC1(config)#no ip routing
PC1(config)#int f0/0
PC1(config-if)#ip add 192.168.1.10 255.255.255.0
PC1(config-if)#no sh
PC1(config-if)#exit
PC1(config)#ip default-gateway 192.168.1.254
PC1(config)#end
PC1#
---------------------------PC2------------------------------
Router(config-line)#host PC2
PC2(config)#no ip routing
PC2(config)#ip default-gateway 192.168.2.254
PC2(config)#int f0/0
PC2(config-if)#ip add 192.168.2.10 255.255.255.0
PC2(config-if)#no sh
--------------------------Sw1----------------------------------
Sw1#conf t
Sw1(config)#int f0/2
Sw1(config-if)#switchport trunk encapsulation dot1q
Sw1(config-if)#switchport mode trunk
Sw1#vlan database
Sw1(vlan)#vlan 10 name caiwubo
VLAN 10 added:
Name: xiaoshoubo
Sw1(vlan)#vlan 20 name xiaoshoubo
VLAN 20 added:
Name: renshibo
Sw1(vlan)#exit
APPLY completed.
Exiting....
Sw1#conf t
Sw1(config)#int f0/0
Sw1(config-if)#switchport mode access
Sw1(config-if)#switchport access vlan 10
Sw1(config-if)#spanning-tree portfast
Sw1(config-if)#int f0/1
Sw1(config-if)#switchport mode access
Sw1(config-if)#switchport access vlan 20
Sw1(config-if)#spanning-tree portfast
Sw1(config-if)#end
Sw1#sh vlan-s
VLAN Name Status Ports
---- -------------------------------- --------- ---
1 default active Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/11, Fa0/12, Fa0/13
Fa0/14, Fa0/15
10 xiaoshoubo active Fa0/0
20 renshibo active Fa0/1
------------------------------R2------------------------------
Router(config-line)#host R2
R2(config)#int e0/0
R2(config-if)#ip add 200.1.1.1 255.255.255.0
R2(config-if)#duplex full
R2(config-if)#no sh
R2(config-if)#ip nat outside
R2(config-if)#exit
R2(config)#int e0/2
R2(config-if)#duplex full
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#int e0/2.10
R2(config-subif)#encapsulation dot1q 10
R2(config-subif)#ip add 192.168.1.254 255.255.255.0
R2(config-subif)#ip nat inside
R2(config-subif)#ip access-group 150 in
R2(config-subif)#exit
R2(config)#int e0/2.20
R2(config-subif)#encapsulation dot1q 20
R2(config-subif)#ip add 192.168.2.254 255.255.255.0
R2(config-subif)#ip nat inside
R2(config-subif)#exit
R2(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.3
//定義須要NAT轉換的流量,列表爲100
R2(config)#acc 100 permit ip 192.168.1.0 0.0.0.255 any
R2(config)#acc 100 permit ip 192.168.2.0 0.0.0.255 any
R2(config)#ip nat inside source list 100 int e0/0 overload
R2(config)#acc 150 deny tcp 192.168.1.0 0.0.0.255 host 192.168.1.254
R2(config)#acc 150 deny tcp 192.168.1.0 0.0.0.255 host 192.168.2.254
R2(config)#acc 150 deny tcp 192.168.1.0 0.0.0.255 host 200.1.1.1
R2(config)#acc 150 permit ip any any
R2(config)#line vty 0 4
R2(config-line)#password
P@ssw0rd
R2(config-line)#login
R2(config-line)#exit
R2(config)#enable secret
P@ssw0rd
------------------------------R3--------------------------------
R3#conf t
R3(config)#int e0/0
R3(config-if)#ip add 200.1.1.3 255.255.255.0
R3(config-if)#duplex full
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#ip http server
R3(config)#line vty 0 4
R3(config-line)#no login
R3(config-line)#privilege level 15
R3(config-line)#exit
R3(config)#int lo0
R3(config-if)#ip add 222.222.222.222 255.255.255.0
R3(config-if)#exit
R3(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.1
--------------------PC1上測試telnet到R2的結果--------------
PC1#telnet 200.1.1.1
Trying 200.1.1.1 ...
% Destination unreachable; gateway or host down
PC1#telnet 192.168.2.254
Trying 192.168.2.254 ...
% Destination unreachable; gateway or host down
PC1#telnet 192.168.1.254
Trying 192.168.1.254 ...
% Destination unreachable; gateway or host down
----------------------PC2上測試Telnet 到R2的結果--------
PC2#telnet 192.168.1.254
Trying 192.168.1.254 ... Open
User Access Verification
Password:
PC2#telnet 192.168.2.254
Trying 192.168.2.254 ... Open
User Access Verification
Password:
PC2#telnet 200.1.1.1
Trying 200.1.1.1 ... Open
User Access Verification
Password:
PC2#
PC1#telnet 222.222.222.222
Trying 222.222.222.222 ... Open
R3#sh users
Line User Host(s) Idle Location
0 con 0 idle 00:08:38
*130 vty 0 idle 00:00:00 200.1.1.1
Interface User Mode Idle Peer Address
R3#
當PC2能成功telnet到222.222.222.222,會在R2觸發ACL100,進行NAT轉換
當 192.168.2.10去telnet 222.222.222.222
被轉換爲200.1.1.1去telnet 222.222.222.222
R2#sh ip nat translations Pro Inside global Inside local Outside local Outside global tcp 200.1.1.1:11007 192.168.1.10:11007 222.222.222.222:23 222.222.222.222:23 tcp 200.1.1.1:11005 192.168.2.10:11005 222.222.222.222:23 222.222.222.222:23 R2#