为了更明白点,自己画了个图,....摆上来了.....呵呵

R1-s0/0——R3-s0/0
R2-s0/1——R3-s0/1
R3-e1/0——sw1-f0/15
R3-e1/1——sw2-f0/15
sw1-f0/11——sw2-f0/11
sw1-f0/12——sw2-f0/12
sw1-f0/1——sw3-f0/1
sw1-f0/2——sw4-f0/2
sw2-f0/1——sw4-f0/1
sw2-f0/2——sw3-f0/2
sw3-f0/0——pc1-f0/0
sw4-f0/0——pc2-f0/0
配置:
R1:
ena 进入特权模式
conf t 进入全局模式
no ip do lo 关闭DNS转发
line console 0 进入console接口
no exec-t 关闭屏幕延迟(超时不退出端口)
logg syn 开启光标跟随
host dianxin 给主机取名dianxin
inter s0/0 进入s0/0接口
ip add 202.101.224.1 225.255.255.0 配置ip及掩码
no sh 打开接口
R2:
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host wangtong
inter s0/1
ip add 60.1.1.1 255.255.255.0
no sh
R3:
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host qiye
inte s0/0
ip add 202.101.224.2 255.255.255.0
ip nat outside 转发出站ip
no sh
inter s0/1
ip add 60.1.1.2 255.255.255.0
ip nat outside
no sh
inter e1/0
ip add 192.168.2.2 255.255.255.0
ip nat inside 转发进站ip
duplex full 配置转发速率为全双工
no sh
inter e1/1
ip add 192.168.3.2 255.255.255.0
ip nat inside
duplex full
no sh
ip route 0.0.0.0 0.0.0.0 202.101.224.1 指向静态路由为202.101.224.1
ip route 0.0.0.0 0.0.0.0 60.1.1.1 10
access-list 1 permit 192.168.100.0 0.0.1.255 建立一个感兴趣的数据流
route-map dianxin permit 10 建立一个路由图为10
match ip add 1 匹配ip地址的数据流为1
match inter s0/0 匹配下一跳接口为s0/0
route-map wangtong permit 20
match ip add 1
match inter s0/1
router rip 开启rip协议
ve 2 更改版本为verison 2
net 192.168.2.0 宣告192.168.2.0网段
net 192.168.3.0
default-information origenate 转发缺省路由
no auto-summary 关闭自动汇总
ip nat inside source route-map dianxin inter s0/0 overload 指向出站接口s0/0
ip nat inside source route-map wangtong inter s0/1 overload
sw1:
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host sw1
exit
vlan database 进入vlan数据库,创建vlan
vlan 2 建立vlan2
vlan 100
vlan 101
inter f0/15 进入f0/15接口
switchport access vlan 2 将f0/15加入vlan2
no sh
inter range f0/11 -12 同时进入f0/11,f0/12(可以分别进入做相应的配置)
switchport mode trunk 配置交换机的模式为干道
switchport trunk encapsulation dot1q 封装干道
speed 100 配置转发速率为100
duplex full
channel-group 1 mode on 启动渠道模式
no sh
inter range f0/0 -2
switchport mode trunk
switchport trunk encapsulation dot1q 封装干道
no sh
inter vlan1 进入vlan1接口(默认vlan1存在,不用建)
ip add 192.168.1.1 255.255.255.0
standby 1 ip 192.168.1.254 虚拟热备份ip为192.168.1.254
standby 1 priority 90 设置优先级为90
standby 1 preempt delay minimum 5 抢占优先级延迟最小值为5s
standby 1 track f0/15 设置虚拟出站接口为f0/1(当做为主干道时需做此设置)
inter vlan 2
ip add 192.168.2.1 255.255.255.0
no sh
inter vlan 100
ip add 192.168.100.252 255.255.255.0
standby 1 ip 192.168.100.254
standby 1 priority 90
standby 1 preempt delay minimum 5
standby 1 track f0/15
no sh
inter vlan 101
ip add 192.168.101.252 255.255.255.0
standby 1 ip 192.168.101.254
standby 1 priority 80
standby 1 preempt delay minimum 5
no sh
spanning-tree vlan 1 root primary 配置vlan1 为主通道其优先级默认值为8192
spanning-tree vlan 100 root primary
spanning-tree vlan 101 root secondary 配置vlan101为辅通道其优先级默认值为16384
ip routing 启动路由
router rip
ve 2
net 192.168.1.0
net 192.168.2.0
net 192.168.100.0
net 192.168.101.0
no auto-summary
sw2:
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host sw2
exit
vlan database
vlan 2
vlan 100
vlan 101
inter f0/15
switchport access vlan 2
no sh
inter range f0/11 -12
switchport mode trunk
switchport trunk encapsulation dot1q 封装干道
speed 100
duplex full
channel-group 1 mode on
no sh
inter range f0/1 -2
switchport mode trunk
switchport trunk encapsulation dot1q 封装干道
no sh
interface Port-channel1 进入捆绑接口渠道
switchport mode trunk 配置交换机模式为干道
switchport trunk encapsulation dot1q 封装干道
inter vlan1
ip add 192.168.1.2 255.255.255.0
standby 1 ip 192.168.1.254
standby 1 priority 80
standby 1 preempt delay minimum 5
inter vlan 2
ip add 192.168.3.1 255.255.255.0
no sh
inter vlan 100
ip add 192.168.100.253 255.255.255.0
standby 1 ip 192.168.100.254
standby 1 priority 80
standby 1 preempt delay minimum 5
no sh
inter vlan 101
ip add 192.168.101.253 255.255.255.0
standby 1 ip 192.168.101.254
standby 1 priority 90
standby 1 preempt delay minimum 5
standby 1 track f0/15
no sh
spanning-tree vlan 1 root secondary
spanning-tree vlan 100 root secondary
spanning-tree vlan 101 root primary
ip routing
router rip
ve 2
net 192.168.1.0
net 192.168.3.0
net 192.168.100.0
net 192.168.101.0
no auto-summary
sw3:
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host sw3
exit
vlan database
vlan 100
vlan 101
inter range f0/1 -2
switchport mode trunk
switchport trunk encapsulation dot1q 封装干道
no sh
inter f0/0
switchport access vlan 100
no sh
sw4:
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host sw4
exit
vlan database
vlan 100
vlan 101
inter range f0/1 -2
switchport mode trunk
switchport trunk encapsulation dot1q 封装干道
no sh
inter f0/0
switchport access vlan 101
no sh
pc1:
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host pc1
inter f0/'0
ip add 192.168.100.100 255.255.255.0
no sh
ip route 0.0.0.0 0.0.0.0 192.168.100.254
pc2
ena
conf t
no ip do lo
line console 0
no exec-t
logg syn
host pc2
inter f0/0
ip add 192.168.101.100 255.255.255.0
no sh
ip route 0.0.0.0 0.0.0.0 192.168.101.254
show cdp neighbers 查看各接口信息
show spanning-tree summary
转载于:https://blog.51cto.com/yaozefeng/322459