實驗一
實驗名稱:搭建一個連通外網的環境
實驗過程
步驟1:配置基本環境
首先,打開Cisco Packet Tacer,購買三臺主機,一臺交換機,一臺路由器,並用合適的線纜連接起來。單擊主機選擇Desktop-ipconfiguration,爲三臺主機分別配192.168.1.1;192.168.1.2;192.168.1.3的IP。
步驟2:配置交換機的IP與網關
單擊交換機進入CLI命令行模式輸入enable進入特權模式,輸入configure terminal 進入全局配置模式;在全局配置模式下 interface vlan 1- ip address 192.168.1.253 255.255.255.0 -no shutdown;
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.1.253 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
Switch(config-if)#
這樣就配置好了交換機IP。爲了驗證我們可以主機1 ping一下交換機IP。
ping statistics for 192.168.1.253:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
發現時可以ping通的。下面輸入exit回到全局配置模式。在命令行輸入ip default-gateway 192.168.1.100就可以爲交換機配置網關,這樣可以方便不同網段主機對交換機的管理。
步驟3:配置路由器接口IP
單擊路由器進入CLI命令行模式,通交換機一樣,enable進入用戶模式,configure terminal 進入全局配置模式。輸入interface fastethernet 0/0進入接口,輸入ip address 192.168.1.254 255.255.255.0然後no shutdown。
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#interface fastethernet 0/0
Router(config-if)#ip address 192.168.1.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#
這樣就配置好了路由器的IP了,用一個主機ping一下
PC>ping 192.168.1.254
Pinging 192.168.1.254 with 32 bytes of data:
Reply from 192.168.1.254: bytes=32 time=2ms TTL=255
Reply from 192.168.1.254: bytes=32 time=0ms TTL=255
Reply from 192.168.1.254: bytes=32 time=0ms TTL=255
Reply from 192.168.1.254: bytes=32 time=0ms TTL=255
Ping statistics for 192.168.1.254:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 2ms, Average = 0ms
PC>
可以Ping通,至此,實驗完成。
實驗結果:本次實驗其實不難,主要的還是在於熟練,工作上以後,對於這樣的操作,應該做到秒殺。