5

Linux下ECMP等价路由的建立

 4 months ago
source link: https://bajie.dev/posts/20231227-linux_ecmp/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
  1. 主页
  2. Posts
  3. Linux下ECMP等价路由的建立

Linux下ECMP等价路由的建立

2023-12-27 1 分钟阅读

我们有两个出口,一个从无锡出,一个从世纪互联出

这台机器的em1接世纪互联,em2接无锡尚航,两个网关,有ipv6和ipv4

ISP 1:
    Gateways:
        172.16.9.254
        2001:db8:a::1
    Interface: em1
	
ISP 2:
    Gateways:
        172.18.9.254
        2001:db8:b::1
    Interface: em2

那么这台机器的ECMP等价路由这么做:

ip route replace default proto static scope global \
    nexthop dev em1 via 172.16.9.254 weight 1 \
    nexthop dev em2 via 172.18.9.254 weight 1

ip -6 route replace default proto static scope global \
    nexthop dev em1 via 2001:db8:a::1 weight 1 \
    nexthop dev em2 via 2001:db8:b::1 weight 1

这两条命令需要放到 /etc/rc.d/rc.locl 或者ifup里面去

之后发包的时候就会一左一右轮流发。



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK