HCIP 交换机综合实验

实验题目:

 画出来的拓扑图:

 

接下来是写的步骤:

思路:先配 eth-trunk 然后 vlan stp svi vrrp 最后dhcp配置给pc地址

下面是具体的配置命令:

Sw1
sysname sw1

vlan batch 2 100

stp instance 1 root primary                          //设置根网桥    一个主要
stp instance 2 root secondary                         一个备选

dhcp enable

stp region-configuration                            //生成树配置
 region-name a
 instance 1 vlan 1                                  // 分组 ,每个组一个生成树
 instance 2 vlan 2                                         
 active region-configuration                    //激活配置 

ip pool vlan1                                                      地址池
 gateway-list 172.16.128.3                                   设置网关
 network 172.16.128.0 mask 255.255.224.0              可用地址 以及掩码                         
 dns-list 8.8.8.8                                                 dns地址
 
ip pool vlan2
 gateway-list 172.16.96.3
 network 172.16.96.0 mask 255.255.224.0             如上:
 dns-list 114.114.114.144 114.114.114.114

interface Vlanif1                                                  在三层交换机上特有的
 ip address 172.16.128.1 255.255.224.0
 vrrp vrid 1 virtual-ip 172.16.128.3
 vrrp vrid 1 priority 120                                  //优先级越大,谁将是主网关
 vrrp vrid 1 track interface Ethernet0/0/3 reduced 30  //上行链路追踪,如果检查到该接口断了,则优先级减30
 dhcp select global

interface Vlanif2
 ip address 172.16.96.1 255.255.224.0
 vrrp vrid 1 virtual-ip 172.16.96.3
 vrrp vrid 1 track interface Ethernet0/0/5 reduced 30
 dhcp select global

interface Vlanif100                        //由于华为模拟器接口改为三层时配不了地址,所以用vlan100代替
 ip address 172.16.32.2 255.255.224.0

interface Eth-Trunk0                                       
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2

 interface Ethernet0/0/3
 port link-type access
 port default vlan 100

interface GigabitEthernet0/0/1                  //把二个物理接口虚拟成一个接口
 eth-trunk 0

interface GigabitEthernet0/0/2
 eth-trunk 0

ospf 1
 silent-interface all                               //沉默接口,如果网络中vlan很多,链路中会收发大量的hello包,占用大量链路资源,所以选择沉默一些接口
 undo silent-interface Vlanif100
 undo silent-interface Eth-Trunk0
 undo silent-interface Vlanif2
 area 0.0.0.0
  network 172.16.32.2 0.0.0.0
 area 0.0.0.1
  abr-summary 172.16.0.0 255.255.0.0                              //区域1路由汇总
  network 172.16.128.1 0.0.0.0
  network 172.16.96.1 0.0.0.0


Sw2
sysname sw2

vlan batch 2 100

stp instance 1 root secondary
stp instance 2 root primary

dhcp enable

stp region-configuration
 region-name a
 instance 1 vlan 1
 instance 2 vlan 2
 active region-configuration

ip pool vlan1
 gateway-list 172.16.128.3
 network 172.16.128.0 mask 255.255.224.0
 dns-list 8.8.8.8

ip pool vlan2
 gateway-list 172.16.96.3
 network 172.16.96.0 mask 255.255.224.0
 dns-list 114.114.114.144 114.114.114.114

interface Vlanif1
 ip address 172.16.128.2 255.255.224.0
 vrrp vrid 1 virtual-ip 172.16.128.3
 dhcp select global

interface Vlanif2
 ip address 172.16.96.2 255.255.224.0
 vrrp vrid 1 virtual-ip 172.16.96.3
 vrrp vrid 1 priority 120
 vrrp vrid 1 track interface Ethernet0/0/3 reduced 30
 dhcp select global

interface Vlanif100
 ip address 172.16.64.2 255.255.224.0

interface Eth-Trunk0
 port link-type trunk

interface Ethernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/3
 port link-type access
 port default vlan 100

interface GigabitEthernet0/0/1
 eth-trunk 0

interface GigabitEthernet0/0/2
 eth-trunk 0

ospf 1 router-id 2.2.2.2
 silent-interface all
 undo silent-interface Vlanif100
 undo silent-interface Vlanif2
 undo silent-interface Eth-Trunk0
 area 0.0.0.0
  network 172.16.64.2 0.0.0.0
 area 0.0.0.1
 area 0.0.0.2
  abr-summary 172.16.0.0 255.255.0.0
  network 172.16.96.2 0.0.0.0
  network 172.16.128.2 0.0.0.0


Sw3
sysname sw3

vlan batch 2

stp region-configuration
 region-name a
 instance 1 vlan 1
 instance 2 vlan 2
 active region-configuration

interface Ethernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/3
 port link-type access
 stp edged-port enable

interface Ethernet0/0/4
 port link-type access
 port default vlan 2
 stp edged-port enable

Sw4
sysname sw4

vlan batch 2

stp region-configuration
 region-name a
 instance 1 vlan 1
 instance 2 vlan 2
 active region-configuration

interface Ethernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2

interface Ethernet0/0/3
 port link-type access
 stp edged-port enable

interface Ethernet0/0/4
 port link-type access
 port default vlan 2
 stp edged-port enable


R1
sysname r1 

acl number 2000  
 rule 5 permit source 172.16.0.0 0.0.255.255 

interface GigabitEthernet0/0/0
 ip address 172.16.32.1 255.255.224.0 

interface GigabitEthernet0/0/1
 ip address 10.1.1.1 255.255.255.0 
 nat outbound 2000

interface GigabitEthernet0/0/2
 ip address 172.16.64.1 255.255.224.0 

ospf 1 router-id 1.1.1.1 
 default-route-advertise                       //下放本地静态缺省
 area 0.0.0.0 
  network 10.1.1.0 0.0.0.255 
  network 172.16.0.0 0.0.255.255 
  network 172.16.32.0 0.0.0.255 
  network 172.16.64.1 0.0.0.0 

ip route-static 0.0.0.0 0.0.0.0 10.1.1.2

R2
sysname LSP

interface GigabitEthernet0/0/0
 ip address 10.1.1.2 255.255.255.0 

interface LoopBack0
 ip address 2.2.2.2 255.255.255.0

最后测试:

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值