单臂路由

一、配置交换机
Switch>en
----进入特权模式
Switch#config t
----进入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
----配置第一个
vlan
Switch(config-vlan)#name 10
----给
vlan命名
Switch(config-vlan)#exit
Switch(config)#vlan 20
----配置第一个
vlan
Switch(config-vlan)#name 20
----给
vlan命名
Switch(config-vlan)#exit
Switch(config)#int f0/1
----进入
f0/1端口
Switch(config-if)#switchport access vlan 10 ----把端口分配给
vlan10
Switch(config-if)#exit
Switch(config)#int f0/11
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#int f0/24
Switch(config-if)#switchport mode trunk --配置
f0/24为TRUNK模式
Switch(config-if)#exit
二、 配置路由器
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
----进入
f0/0端口
Router(config-if)#no ip add
----不配置
IP地址
Router(config-if)#no shutdown
----开启端口
%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)#exit
Router(config)#int f0/0.1
----配置子接口
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
Router(config-subif)#encapsulation dot1Q 10 ----配置
dot1Q协议
Router(config-subif)#ip address
192.168.1.254 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#int f0/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)#encapsulation dot1Q 20
Router(config-subif)#ip add
192.168.2.254 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#
三、 验证
P1的
IP地址

P2的
IP地址

P1能够
ping通P2,P2能够ping通P1则配置成功。
