SW1
SW1(config)#interface ethernet0/1 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 10 % Access VLAN does not exist. Creating vlan 10 SW1(config-if)#interface ethernet0/2 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 20 % Access VLAN does not exist. Creating vlan 20 SW1(config-if)#interface ethernet0/0 SW1(config-if)#switchport trunk encapsulation dot1q SW1(config-if)#switchport mode trunk
SW2
SW2(config)#interface ethernet0/1 SW2(config-if)#switchport mode access SW2(config-if)#switchport access vlan 10 % Access VLAN does not exist. Creating vlan 10 SW2(config-if)#interface ethernet0/2 SW2(config-if)#switchport mode access SW2(config-if)#switchport access vlan 20 % Access VLAN does not exist. Creating vlan 20 SW2(config-if)#interface ethernet0/0 SW2(config-if)#switchport trunk encapsulation dot1q SW2(config-if)#switchport mode trunk
配置PC网关
PC1 & PC3
PCX(config)#no ip routing PCX(config)#ip default-gateway 192.168.10.254
PC2 & PC4
PCX(config)#no ip routing PCX(config)#ip default-gateway 192.168.20.254
在单播中,当数据需要跨广播域/网段进行传输时,需要网关来进行转发
配置SW2 TrunkSW2
SW2(config)#interface ethernet 0/3 SW2(config-if)#switchport trunk encapsulation dot1q SW2(config-if)#switchport mode trunk配置R1子接口,实现单臂路由
R1
R1(config)#interface ethernet 0/0 R1(config-if)#no shutdown R1(config-if)#interface ethernet 0/0.10 R1(config-subif)#encapsulation dot1Q 10 R1(config-subif)#ip address 192.168.10.254 255.255.255.0 R1(config-subif)#no shutdown R1(config-subif)#interface ethernet 0/0.20 R1(config-subif)#encapsulation dot1Q 20 R1(config-subif)#ip address 192.168.20.254 255.255.255.0 R1(config-subif)#no shutdown
相关课程内容推荐
思科认证备考须知:CCNA 备考指南
思博全新思科课程399活动价限额限时优惠:新版CCNA 课程
思博CCNA课程安排表: CCNA课表
ccna教程:最全中文版CCNA书籍推荐
CCNA如何学习:CCNA学习指南简单分析介绍
即刻预约
免费试听-咨询课程-获取免费资料