华为VRRP+VLAN+DHCP配置实例

华为VRRP搭建

  • 什么是VRRP?
    • VRRP配置实例
    • 配置命令
    • 检测

什么是VRRP?

VRRP全称为(Virtual Router Redundancy Protocol),即虚拟路由冗余协议,简单来说就是用于解决静态网关单点故障的问题。可以把多台网关设备合并为一台。使其中一台网关设备down掉后,可以保证不会出现断网现象。

VRRP配置实例

拓扑结构图:
华为VRRP+VLAN+DHCP配置实例_第1张图片
配置需求:
AR1为边界路由器
采用OSPF动态路由协议互联网段
SW1与SW2做VRRP虚拟网关
创建VLAN 10 VLAN20分割内网
VLAN10 IP:192.168.1.0 /24
VLAN20 IP: 192.168.2.0/24
虚拟网关:192.168.1.254/192.168.2.254
创建DHCP服务器网关指向虚拟网关
作用:
当SW1的下联接口down掉时,sw2可立马响应做为新网关,使内网网络不中断

配置命令

AR1:
interface GigabitEthernet0/0/0 #配置接口地址
ip address 11.0.0.1 255.255.255.0

interface GigabitEthernet0/0/1 #配置接口地址
ip address 12.0.0.1 255.255.255.0

interface LoopBack0 #配置环回口地址
ip address 1.1.1.1 255.255.255.255

ospf 100 router-id 1.1.1.1 #设置ospf进程号为100,ID为1.1.1.1
area 0.0.0.0 #设置为area0
network 1.1.1.1 0.0.0.0 #宣告环回口
network 11.0.0.1 0.0.0.0 #宣告接口地址
network 12.0.0.1 0.0.0.0 #宣告接口地址
SW1:
sysname SW1 #设置此交换机名称为SW1

vlan batch 10 20 30 #创建VLAN 10 20 30

dhcp enable #启用DHCP功能

ip pool dhcp2 #创建DHCP地址池,名字为dhcp2
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
excluded-ip-address 192.168.2.250 192.168.2.253
dns-list 114.114.114.114 8.8.8.8

ip pool dncp1 #创建DHCP地址池,名字为dhcp1
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
excluded-ip-address 192.168.1.250 192.168.1.253
dns-list 114.114.114.114 8.8.8.8

interface Vlanif10 #进入vlan10接口
ip address 192.168.1.1 255.255.255.0 #配置vlan10 ip
vrrp vrid 1 virtual-ip 192.168.1.254 #启用vrrp设置为组1,虚拟IP为192.168.1.254
vrrp vrid 1 priority 150 #修改此路由vrrp组1的优先级
dhcp select global #接口全局启用DHCP

interface Vlanif20
ip address 192.168.2.2 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.2.254
dhcp select global

interface Vlanif30
ip address 11.0.0.2 255.255.255.0

interface GigabitEthernet0/0/23 #进入接口
port link-type trunk #接口模式改为trunk
port trunk allow-pass vlan 2 to 4094 #允许所有vlan通过

interface GigabitEthernet0/0/24
port link-type access #接口模式改为access
port default vlan 30 #接口绑定vlan 30

ospf 100 router-id 2.2.2.2
area 0.0.0.0
network 11.0.0.2 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
SW2:
sysname SW2

vlan batch 10 20 40

dhcp enable

ip pool dhcp1
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
excluded-ip-address 192.168.1.250 192.168.1.253
dns-list 114.114.114.114 8.8.8.8

ip pool dhcp2
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
excluded-ip-address 192.168.2.250 192.168.2.253
dns-list 114.114.114.114 8.8.8.8

interface Vlanif10
ip address 192.168.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
dhcp select global

interface Vlanif20
ip address 192.168.2.1 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.2.254
dhcp select global

interface Vlanif40
ip address 12.0.0.2 255.255.255.0

interface GigabitEthernet0/0/23
port link-type trunk
port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/24
port link-type access
port default vlan 40

ospf 100 router-id 3.3.3.3
area 0.0.0.0
network 12.0.0.2 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
SW3:
sysname SW3

vlan batch 10 20

interface Ethernet0/0/1
port link-type access
port default vlan 10

interface Ethernet0/0/2
port link-type access
port default vlan 20

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094

检测

使用displady vrrp brief 可查看vrrp的状态
华为VRRP+VLAN+DHCP配置实例_第2张图片
使用displady vrrp 可查看vrrp详细信息
华为VRRP+VLAN+DHCP配置实例_第3张图片

你可能感兴趣的:(网络技术,交换机,网关,路由器,网络)