A-A+
单臂路由和交换机一起实现VLAN间路由的组网和配置
一台思科1841路由器、一台C2950-24交换机和两台PC主机组成一个三叉戟形状的网络,利用单臂路由来实现VLAN间的路由通信,组网拓扑图如下:
第一台PC主机为静态ip,具体设置如下图:
第二台PC主机的ip配置:
交换机的配置命令如下:
- Switch>
- Switch>en
- Switch>enable
- Switch#conf
- Switch#configure
- Configuring from terminal, memory, or network [terminal]?
- Enter configuration commands, one per line. End with CNTL/Z.
- Switch(config)#h
- Switch(config)#hostname SW1
- SW1(config)#vl
- SW1(config)#vlan 2
- SW1(config-vlan)#exit
- SW1(config)#in f0/1
- SW1(config-if)#sw
- SW1(config-if)#switchport m
- SW1(config-if)#switchport mode a
- SW1(config-if)#switchport mode access
- SW1(config-if)#sw
- SW1(config-if)#switchport a
- SW1(config-if)#switchport access v
- SW1(config-if)#switchport access vlan 1
- SW1(config-if)#in f0/2
- SW1(config-if)#sw
- SW1(config-if)#switchport m
- SW1(config-if)#switchport mode a
- SW1(config-if)#switchport mode access
- SW1(config-if)#sw
- SW1(config-if)#switchport a
- SW1(config-if)#switchport access v
- SW1(config-if)#switchport access vlan 2
- SW1(config-if)#in f0/3
- SW1(config-if)#sw
- SW1(config-if)#switchport m
- SW1(config-if)#switchport mode t
- SW1(config-if)#switchport mode trunk
- SW1(config-if)#exit
- SW1(config)#
- %LINK-5-CHANGED: Interface FastEthernet0/3, changed state to up
- %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
- --------------------------------------------------------------------------------
- Router>en
- Router>enable
- Router#conf
- Router#configure
- Configuring from terminal, memory, or network [terminal]?
- Enter configuration commands, one per line. End with CNTL/Z.
- Router(config)#h
- Router(config)#hostname R1
- R1(config)#in f0/0
- R1(config-if)#no shu
- R1(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
- R1(config-if)#in 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
- R1(config-subif)#en
- R1(config-subif)#encapsulation d
- R1(config-subif)#encapsulation dot1Q 1 n
- R1(config-subif)#encapsulation dot1Q 1 native
- R1(config-subif)#ip add 172.16.1.1 255.255.255.0
- R1(config-subif)#in 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
- R1(config-subif)#en
- R1(config-subif)#encapsulation d
- R1(config-subif)#encapsulation dot1Q 2
- R1(config-subif)#ip add 172.16.2.1 255.255.255.0
- R1(config-subif)#exit
- R1(config)#