在这里做一个网络拓扑给各位同学使用,希望大家相互学习~~~

要求三成交换配置vlan间的路由,交换机之间启用vtp协议,与外网通讯使用默认的路由
R1:使用静态的路由协议
其他的路由器使用rip version2路由协议,要将静态路由协议注入到rip当中
R4:使用单臂路由使vlan间路由
最终目的,保证网络全网ping通~~~

三层交换:
en
vlan database    启用vtp
vtp domain aa
vtp server
vtp password 123
vlan 10      创建vlan
vlan 20
vlan 30
exit
conf t
int range f0/1 - 2   交换机与交换机连接的接口使用trunk
switchport     定义接口为二层的
switchport mode trunk
exit
ip routing     开启三层交换的路由功能
int vlan 10
ip add 192.168.1.1 255.255.255.224    配置vlan 的ip地址,作为相应pc的网关
no sh
int vlan 20
ip add 192.168.1.33 255.255.255.224
no sh
int vlan 30
ip add 192.168.1.65 255.255.255.224
no sh
exit

二层交换机:
en
vlan database     开启vtp客户端
vtp domain aa
vtp client
vtp password 123
exit
conf t
en
conf t
int f0/24     设置交换之间连接的为trunk
switchport mode trunk
int f0/1
switchport access vlan 10
int f0/2
switchport access vlan 20
int f0/3
switchport access vlan 30
exit
end

计算机的ip和网关对应

三层交换开启路由功能,配置ip地址
swl3:
en
conf t
int f0/24
no switchport   定义与路由器连接的接口为三层接口
ip add 192.168.2.1 255.255.255.0
no sh
exit
ip route 0.0.0.0 0.0.0.0 192.168.2.2   设置默认路由
exit

R1:   使用的是静态的路由协议,配置ip地址
en
conf t
int f0/0
ip add 192.168.2.2 255.255.255.0
no sh
int s0/0
ip add 192.168.3.1 255.255.255.0
clock rate 64000
no sh
int s0/1
ip add 192.168.5.1 255.255.255.0
clock rate 64000
no sh
exit

把所有为直接连接的地址配置静态路由

ip route 192.168.1.0 255.255.255.224 192.168.2.1
ip route 192.168.1.32 255.255.255.224 192.168.2.1
ip route 192.168.1.64 255.255.255.224 192.168.2.1
ip route 192.168.1.128 255.255.255.224 192.168.3.2
ip route 192.168.1.160 255.255.255.224 192.168.3.2
ip route 192.168.1.192 255.255.255.224 192.168.3.2
ip route 192.168.4.0 255.255.255.0 192.168.3.2
ip route 192.168.6.0 255.255.255.0 192.168.3.2
ip route 192.168.1.128 255.255.255.224 192.168.5.2
ip route 192.168.1.160 255.255.255.224 192.168.5.2
ip route 192.168.1.192 255.255.255.224 192.168.5.2
ip route 192.168.4.0 255.255.255.0 192.168.5.2
ip route 192.168.6.0 255.255.255.0 192.168.5.2
exit

R2:    为边界路由,即启用静态,又使用rip
en
conf t
int s0/0
ip add 192.168.3.2 255.255.255.0
clock rate 64000
no sh
int s0/1
ip add 192.168.4.1 255.255.255.0
clock rate 64000
no sh
exit
ip route 192.168.1.0 255.255.255.224 192.168.3.1
ip route 192.168.1.32 255.255.255.224 192.168.3.1
ip route 192.168.1.64 255.255.255.224 192.168.3.1
ip route 192.168.2.0 255.255.255.0 192.168.3.1
router rip    使用rip  version2版本
version 2
no auto-summary    关闭自动汇总
net 192.168.3.0
net 192.168.4.0
redistribute static metric 10   将静态的路由注入到动态的路由协助中 10为代价
exit

R3:   和路由器2一样

en
conf t
int s0/0
ip add 192.168.6.1 255.255.255.0
clock rate 64000
no sh
int s0/1
ip add 192.168.5.2 255.255.255.0
clock rate 64000
no sh
exit
ip route 192.168.1.0 255.255.255.224 192.168.5.1
ip route 192.168.1.32 255.255.255.224 192.168.5.1
ip route 192.168.1.64 255.255.255.224 192.168.5.1
ip route 192.168.2.0 255.255.255.0 192.168.5.1
router rip
version 2
no auto-summary
net 192.168.5.0
net 192.168.6.0
redistribute static metric 10
exit

R4:   启用rip,又开启单臂路由
en
conf t
int s0/0
ip add 192.168.6.2 255.255.255.0
clock rate 64000
no sh
int s0/1
ip add 192.168.4.2 255.255.255.0
clock rate 64000
no sh
int f0/0
no sh
exit
int f0/0.1    设置子接口
encapsulation dot1Q  10    封装为trunk
ip add 192.168.1.129 255.255.255.224
int f0/0.2
encapsulation dot1Q  20
ip add 192.168.1.161 255.255.255.224
int f0/0.3
encapsulation dot1Q  30
ip add 192.168.1.193 255.255.255.224
exit
router rip
version 2
no auto-summary
net 192.168.1.128
net 192.168.1.160
net 192.168.1.192
net 192.168.4.0
net 192.168.6.0
exit