單臂路由實驗

 

 

實驗條件:
switch 1pc : 2960-24TT
router 1pc : 2811
pc1:
192.168.1.100
255.255.255.0
192.168.1.1

pc2:
192.168.2.100
255.255.255.0
192.168.2.1

先配連接兩個pc的switch端口0/1, 0/2的vlan

Switch#configure  t                                                                                    #配置模式
Switch(config)#vlan 100                                                                            #建立vlan 100
Switch(config-vlan)#exit               
Switch(config)#interface fastEthernet 0/1                                           #指定port
Switch(config-if)#switchport access vlan 100                                      #指定port為vlan 100
Switch(config-if)#spanning-tree portfast

Switch#configure  t                                                                                    #配置模式
Switch(config)#vlan 200                                                                            #建立vlan 200
Switch(config-vlan)#exit                                                            
Switch(config)#interface fastEthernet 0/2                                           #指定port
Switch(config-if)#switchport access vlan 200                                      #指定port為vlan 200
Switch(config-if)#spanning-tree portfast

配置switch連接router的端口0/3為trunk模式。

Switch#conf t
Switch(config-if)#int fa 0/3
Switch(config-if)#switchport mode trunk                                                #指定端口做trunk
這時在不同vlan中的pc是無法ping通的。因為,沒有配置路由。

 ***switch 操作結束***

========================================================================

配置路由器

Router>en

Router#conf t

R1(config)#in fa 0/0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface fastEthernet 0/0.100                                           #0/0.100就是給vlan100的網關

R1(config-subif)#encapsulation dot1Q 100                                          #打上vlan 100 的標

R1(config-subif)#ip address 192.168.1.1 255.255.255.0                   #配置pc1的網關

R1(config-subif)#no shutdown

R1(config-subif)#exit

————————————————————————————————————————————————————————————————————————————————————————————

R1(config)#interface fastEthernet 0/0.200                                           #0/0.200就是給vlan200的網關

R1(config-subif)#encapsulation dot1Q 200                                          #打上vlan 200 的標

R1(config-subif)#ip address 192.168.2.1 255.255.255.0                   #配置pc2的網關

R1(config-subif)#no shutdown

R1(config-subif)#exit

--------------------------------------------------------------------------------------------

R1#show ip int brief

Interface              IP-Address      OK? Method Status                Protocol

FastEthernet0/0        unassigned      YES unset  up                    up

FastEthernet0/0.100    192.168.1.1     YES manual up                    up

FastEthernet0/0.200    192.168.2.1     YES manual up                    up

******************1個物理端口,虛擬出來2個子端口***************

 ***Router 操作結束***

posted @ 2020-11-16 16:35  k98091518  阅读(141)  评论(0编辑  收藏  举报