session 1 接口备份配置
此技术应用于单台多接口备份场景,可以单独配置接口备份或者实现接口链路的流量负载均衡效果。
一、以太链路接口主备配置实例
AR1与AR2使用三条链路连接,为了确保冗余现在AR1和AR2相连的接口g/0/0配置为主接口,g/0/0/1、g/0/0/2分别配置为备用接口,且优先级g/0/0/1高于g/0/0/2。配置完成后就会像图中显示的,只有主接口会up,备用接口会自动逻辑down,只有当主接口故障时才会启用优先级高的备用接口。
AR1上的配置
#
interface Ethernet4/0/0
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet0/0/0 配置 g/0/0为主接口,g/0/1接口为备用接口,优先级为30,g/0/2接口为备用接口优先级为20
ip address 12.1.0.1 255.255.255.0
standby interface GigabitEthernet0/0/1 30
standby interface GigabitEthernet0/0/2 20
#
interface GigabitEthernet0/0/1
ip address 12.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 12.1.2.1 255.255.255.0
#
# 配置三条链路对应的三条路由
ip route-static 172.16.1.0 255.255.255.0 12.1.0.2
ip route-static 172.16.1.0 255.255.255.0 12.1.1.2
ip route-static 172.16.1.0 255.255.255.0 12.1.2.2
#
AR2上的配置
#
interface Ethernet4/0/0
ip address 172.16.1.1 255.255.255.0
#
interface Ethernet4/0/1
#
interface GigabitEthernet0/0/0
ip address 12.1.0.2 255.255.255.0
standby interface GigabitEthernet0/0/1 30
standby interface GigabitEthernet0/0/2 30
#
interface GigabitEthernet0/0/1
ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 12.1.2.2 255.255.255.0
#
#ip route-static 192.168.1.0 255.255.255.0 12.1.0.1
ip route-static 192.168.1.0 255.255.255.0 12.1.1.1
ip route-static 192.168.1.0 255.255.255.0 12.1.2.1
#
检查配置命令
[Huawei]display standby state
Interface Interfacestate Backupstate Backupflag Pri Loadstate 可以看到接口状态是主还是备
GigabitEthernet0/0/0 UP MUP MU
GigabitEthernet0/0/1 STANDBY STANDBY BU 30
GigabitEthernet0/0/2 STANDBY STANDBY BU 20
Backup-flag meaning:
M---MAIN B---BACKUP V---MOVED U---USED
D---LOAD P---PULLED
----------------------------------------------------------------------------
Below is track BFD information:
Bfd-Name Bfd-State BackupInterface State
----------------------------------------------------------------------------
Below is track IP route information:
Destination/Mask Route-State BackupInterface State
----------------------------------------------------------------------------
Below is track NQA Information:
Instance Name BackupInterface State
[Huawei]
在pc1上测试到达pc2 的路径
PC>tracert 172.16.1.10
traceroute to 172.16.1.10, 8 hops max
(ICMP), press Ctrl+C to stop
1 192.168.1.1 16 ms 16 ms <1 ms
2 12.1.0.2 31 ms 31 ms 16 ms
3 172.16.1.10 15 ms 16 ms 15 ms
PC>
查看主接口和备用接口的状态,可以看到备用接口被standby-down了
[Huawei]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
Ethernet4/0/0 192.168.1.1/24 up up
Ethernet4/0/1 unassigned down down
GigabitEthernet0/0/0 12.1.0.1/24 up up
GigabitEthernet0/0/1 12.1.1.1/24 ^down down
GigabitEthernet0/0/2 12.1.2.1/24 ^down down
NULL0 unassigned up up(s)
[Huawei]
二、以太网链路接口负载分担配置实例
还是以上图拓扑为例,要求g/0/0接口作为主接口,并且当主接口上的流量达到接口带宽的80%时候,启用优先级高的备用接口来分担流量,当主接口g/0/0上的流量恢复到低于接口带宽的20%时,关闭备用接口。
AR1上的配置
#
interface Ethernet4/0/0
ip address 192.168.1.1 255.255.255.0
#
interface Ethernet4/0/1
#
interface GigabitEthernet0/0/0 主接口g/0/0,备用接口g/0/1优先级30,g0/0/2优先级20,主接口总带宽为
ip address 12.1.0.1 255.255.255.0 1Gbps,当接口流量超过1Gbps的80%时候启用优先级高的备用接口,当流量
standby interface GigabitEthernet0/0/1 30 低于1Gbps的20%时候再重新关闭备用接口
standby interface GigabitEthernet0/0/2 20
standby bandwidth 1000000 指定接口总带宽1000000kbps(kbit/s)
standby threshold 80 20 设置流量阈值,上线80%,下线20%用于判断是否启用备用接口
#
interface GigabitEthernet0/0/1
ip address 12.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 12.1.2.1 255.255.255.0
#
#
ip route-static 172.16.1.0 255.255.255.0 12.1.0.2
ip route-static 172.16.1.0 255.255.255.0 12.1.1.2
ip route-static 172.16.1.0 255.255.255.0 12.1.2.2
#
AR2的配置
#
interface Ethernet4/0/0
ip address 172.16.1.1 255.255.255.0
#
interface Ethernet4/0/1
#
interface GigabitEthernet0/0/0
ip address 12.1.0.2 255.255.255.0
standby interface GigabitEthernet0/0/1 30
standby interface GigabitEthernet0/0/2 20
standby bandwidth 1000000
standby threshold 80 20
#
interface GigabitEthernet0/0/1
ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 12.1.2.2 255.255.255.0
#
#
ip route-static 192.168.1.0 255.255.255.0 12.1.0.1
ip route-static 192.168.1.0 255.255.255.0 12.1.1.1
ip route-static 192.168.1.0 255.255.255.0 12.1.2.11
#
检查命令依然使用
[Huawei]display standby state
Interface Interfacestate Backupstate Backupflag Pri Loadstate
GigabitEthernet0/0/0 UP MUP MUD TO-HYPNOTIZE
GigabitEthernet0/0/1 STANDBY STANDBY BU 30
GigabitEthernet0/0/2 STANDBY STANDBY BU 20
Backup-flag meaning:
M---MAIN B---BACKUP V---MOVED U---USED
D---LOAD P---PULLED
----------------------------------------------------------------------------
Below is track BFD information:
Bfd-Name Bfd-State BackupInterface State
----------------------------------------------------------------------------
Below is track IP route information:
Destination/Mask Route-State BackupInterface State
----------------------------------------------------------------------------
Below is track NQA Information:
Instance Name BackupInterface State
[Huawei]
注意:接口备用功能其实和路由备用相同,负载均衡效果和路由静态路由的负载均衡效果一样,只是路由的负载均衡不需要配置,只需要2条同目的地址和优先级一样的路由条目就可以了,并且华为路由的负载均衡方式是根据5元组来进行分担流量的,和思科的CEF负载分担方式不一样。