單臂路由

實驗目的:實現不同vlan之間的通信

拓撲圖:

 

 

實驗步驟:

1.switch0的配置


Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int f0/1
Switch(config-if)#sw
Switch(config-if)#switchport mo
Switch(config-if)#switchport mode tr
Switch(config-if)#switchport mode trunk   將端口設爲trunk模式

Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vlan 2    新建vlan2
VLAN 2 added:
    Name: VLAN0002
Switch(vlan)#vlan 3     新建vlan3
VLAN 3 added:
    Name: VLAN0003
Switch(vlan)#exit

Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int fa0/2
Switch(config-if)#sw
Switch(config-if)#switchport ac
Switch(config-if)#switchport access vlan 2   將端口劃到vlan 2上
Switch(config-if)#int fa0/3
Switch(config-if)#sw
Switch(config-if)#switchport ac
Switch(config-if)#switchport access vlan 3   將端口劃到vlan 3上
Switch(config-if)#
Switch#

2.配置Route0

outer>
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#no shut

%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)#int fa0/0.2

%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up
Router(config-subif)#de
Router(config-subif)#en
Router(config-subif)#encapsulation do
Router(config-subif)#encapsulation dot1Q 2    封裝協議
Router(config-subif)#ip add 172.168.10.1 255.255.255.0
Router(config-subif)#no shut
Router(config-subif)#int fa0/0.3
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.3, changed state to up

Router(config-subif)#en
Router(config-subif)#encapsulation do
Router(config-subif)#encapsulation dot1Q 3   封裝協議
Router(config-subif)#ip add 172.168.20.1 255.255.255.0
Router(config-subif)#no shut
Router(config-subif)#

3.配置pc1、pc2的IP

PC1:172.168.10.2 255.255.255.0 GW172.168.10.1

PC2:172.168.20.2 255.255.255.0 GW172.168.20.1

4.測試在PC1上pingPC2

Packet Tracer PC Command Line 1.0
PC>ping 172.168.20.2

Pinging 172.168.20.2 with 32 bytes of data:

Request timed out.
Reply from 172.168.20.2: bytes=32 time=9ms TTL=127
Reply from 172.168.20.2: bytes=32 time=19ms TTL=127
Reply from 172.168.20.2: bytes=32 time=11ms TTL=127

Ping statistics for 172.168.20.2:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 9ms, Maximum = 19ms, Average = 13ms
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章