documentation:examples:ecmp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
documentation:examples:ecmp [2020/09/21 12:08] – [VM 5 (ECMP router)] olivier | documentation:examples:ecmp [2022/12/11 18:39] – [R2 (ECMP router)] olivier | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Equal-cost multi-path routing (ECMP) ====== | ====== Equal-cost multi-path routing (ECMP) ====== | ||
- | This lab is testing new ECMP routing code from [[https:// | + | This lab need a FreeBSD 13-head r366390 minimum ([[https:// |
===== Presentation ===== | ===== Presentation ===== | ||
Line 20: | Line 20: | ||
===== Static routing setup ===== | ===== Static routing setup ===== | ||
- | ==== VM 1 (client) | + | ==== Client |
- | VM1 is configured as a simple host with multiples aliases: | + | A simple host with static routes: |
< | < | ||
- | sysrc hostname=VM1 \ | + | sysrc hostname=client |
gateway_enable=NO \ | gateway_enable=NO \ | ||
ipv6_gateway_enable=NO \ | ipv6_gateway_enable=NO \ | ||
- | ifconfig_igb1=" | + | ifconfig_igb1=" |
- | ifconfig_igb1_alias1=" | + | ifconfig_igb1_ipv6=" |
- | ifconfig_igb1_alias2=" | + | static_routes=" |
- | ifconfig_igb1_alias3=" | + | route_LAB=" |
- | ifconfig_igb1_alias4=" | + | ipv6_static_routes=" |
- | ifconfig_igb1_alias5=" | + | ipv6_route_LAB=" |
- | ifconfig_igb1_ipv6=" | + | |
- | ifconfig_igb1_alias61=" | + | |
- | ifconfig_igb1_alias62=" | + | |
- | ifconfig_igb1_alias63=" | + | |
- | ifconfig_igb1_alias64=" | + | |
- | ifconfig_igb1_alias65=" | + | |
- | static_routes=" | + | |
- | route_LAB=" | + | |
- | ipv6_static_routes=" | + | |
- | ipv6_route_LAB=" | + | |
service hostname restart | service hostname restart | ||
service netif restart | service netif restart | ||
Line 50: | Line 40: | ||
</ | </ | ||
- | ==== VM 2 (ECMP router) ==== | + | ==== R1 (ECMP router) ==== |
- | VM 2 is a router with ECMP: 2 static routes toward the same destination but using 2 different next-hop. | + | R1 is a router with ECMP: 2 static routes toward the same destination but using 2 different next-hop. |
< | < | ||
- | sysrc hostname=VM2 \ | + | |
- | ifconfig_igb0=" | + | sysrc hostname=R1 \ |
- | | + | gateway_enable=YES \ |
- | ifconfig_igb1=" | + | ipv6_gateway_enable=YES |
- | ifconfig_igb1_ipv6=" | + | ifconfig_igb0=" |
- | ifconfig_igb2=" | + | |
- | | + | ifconfig_igb1=" |
+ | ifconfig_igb1_ipv6=" | ||
+ | ifconfig_igb2=" | ||
+ | | ||
static_routes=" | static_routes=" | ||
- | route_MPATH1=" | + | route_MPATH1=" |
- | route_MPATH2=" | + | route_MPATH2=" |
ipv6_static_routes=" | ipv6_static_routes=" | ||
- | ipv6_route_MPATH1=" | + | ipv6_route_MPATH1=" |
- | ipv6_route_MPATH2=" | + | ipv6_route_MPATH2=" |
service hostname restart | service hostname restart | ||
service netif restart | service netif restart | ||
Line 77: | Line 70: | ||
< | < | ||
- | [root@VM2]~# # netstat -rn4 | grep 10.0.0.0/ | + | root@R1:~ # netstat -rn4 | grep 10.0.0.0/ |
- | 10.0.0.0/ | + | 10.0.0.0/ |
- | 10.0.0.0/ | + | 10.0.0.0/ |
- | [root@VM2]~# route -n get 10.0.0.0/ | + | root@R1:~ # netstat -4onW |
- | route to: 10.0.0.0 | + | |
- | destination: | + | |
- | mask: 255.255.0.0 | + | |
- | gateway: 10.0.112.2 | + | |
- | fib: 0 | + | |
- | interface: igb1 | + | |
- | flags: < | + | |
- | | + | |
- | | + | |
- | + | ||
- | [root@VM2]~# netstat -4onW | + | |
Nexthop data | Nexthop data | ||
Internet: | Internet: | ||
Idx | Idx | ||
- | 1 | + | 1 |
- | 2 | + | 2 |
- | 3 | + | 3 |
- | 4 | + | 4 |
- | 5 | + | 5 |
- | 6 | + | 6 |
- | 7 | + | 7 |
- | 8 v4/gw 10.0.112.1 10.0.112.2 GS 0 | + | 8 v4/gw 10.0.231.2 10.0.231.3 GS 0 |
- | 9 v4/gw 10.0.212.1 10.0.212.2 GS 0 | + | 9 v4/gw 10.0.232.2 10.0.232.3 GS 0 |
- | + | ||
- | [root@VM2]~# | + | |
- | route to: 2001: | + | |
- | destination: | + | |
- | mask: ffff: | + | |
- | gateway: 2001: | + | |
- | fib: 0 | + | |
- | interface: igb1 | + | |
- | flags: < | + | |
- | | + | |
- | | + | |
- | [root@VM2]~# netstat -6onW | + | root@R1:~ # netstat -6onW |
Nexthop data | Nexthop data | ||
Internet6: | Internet6: | ||
Idx | Idx | ||
- | 1 | + | 1 |
- | 2 | + | 2 |
- | 3 | + | 3 |
- | 4 | + | 4 |
- | 5 | + | 5 |
- | 6 | + | 6 |
- | 7 | + | 7 |
- | 8 | + | 8 |
- | 9 | + | 9 |
- | 10 v6/gw ::1 :: | + | 10 v6/gw ::1 :: |
- | 11 v6/resolve | + | 11 |
- | 12 v6/gw 2001:db8:212::1 2001:db8:212::2 GS 0 | + | 12 v6/gw 2001:db8:232::2 2001:db8:232::3 GS 0 |
</ | </ | ||
+ | ==== R2 (ECMP router) ==== | ||
- | + | R2 is like R1, a router with ECMP: 2 static routing toward the same destination but using 2 different next-hop.. | |
- | ==== VM 5 (ECMP router) ==== | + | |
- | + | ||
- | VM 5 is like VM 2, a router with ECMP: 2 static routing toward the same destination but using 2 different next-hop.. | + | |
< | < | ||
- | sysrc hostname=VM5 \ | + | sysrc hostname=R2 \ |
- | ifconfig_igb0=" | + | gateway_enable=YES \ |
- | | + | ipv6_gateway_enable=YES |
- | ifconfig_igb1=" | + | ifconfig_igb0=" |
- | ifconfig_igb1_ipv6=" | + | |
- | ifconfig_igb2=" | + | ifconfig_igb1=" |
- | | + | ifconfig_igb1_ipv6=" |
- | static_routes=" | + | ifconfig_igb2=" |
- | | + | |
- | | + | static_routes=" |
- | ipv6_static_routes=" | + | |
- | ipv6_route_MPATH1=" | + | |
- | ipv6_route_MPATH2=" | + | route_SRC1=" |
+ | route_SRC2=" | ||
+ | ipv6_static_routes=" | ||
+ | ipv6_route_MPATH1=" | ||
+ | ipv6_route_MPATH2=" | ||
+ | ipv6_route_SRC1=" | ||
+ | ipv6_route_SRC2=" | ||
service hostname restart | service hostname restart | ||
service netif restart | service netif restart | ||
Line 161: | Line 136: | ||
config save | config save | ||
</ | </ | ||
+ | ==== Server ==== | ||
- | ==== VM 6 (server) ==== | + | A simple host with some static routes: |
- | + | ||
- | VM 6, like VM 1 is configured as a simple host with multiple aliases: | + | |
< | < | ||
- | sysrc hostname=VM6 \ | + | sysrc hostname=server |
- | gateway_enable=NO \ | + | gateway_enable=NO \ |
- | ipv6_gateway_enable=NO \ | + | ipv6_gateway_enable=NO \ |
- | ifconfig_vtnet4="inet 10.0.56.6/24" \ | + | |
- | ifconfig_vtnet4_alias1="inet 10.0.56.16/32" \ | + | |
- | ifconfig_vtnet4_alias2="inet 10.0.56.26/32" \ | + | static_routes=" |
- | ifconfig_vtnet4_alias3=" | + | route_12=" |
- | ifconfig_vtnet4_alias4="inet 10.0.56.46/32" \ | + | |
- | ifconfig_vtnet4_alias5=" | + | |
- | ifconfig_vtnet4_ipv6="inet6 2001: | + | |
- | ifconfig_vtnet4_alias61="inet6 2001:db8:56::16 prefixlen 64" \ | + | |
- | ifconfig_vtnet4_alias62=" | + | |
- | ifconfig_vtnet4_alias63="inet6 2001:db8:56::36 prefixlen 64" \ | + | |
- | ifconfig_vtnet4_alias64=" | + | |
- | ifconfig_vtnet4_alias65="inet6 2001:db8:56::56 prefixlen 64" \ | + | |
- | defaultrouter=" | + | |
- | ipv6_defaultrouter=" | + | |
service hostname restart | service hostname restart | ||
service netif restart | service netif restart | ||
Line 190: | Line 160: | ||
</ | </ | ||
- | ==== Testing Load balancing | + | ===== FRR Multipath setup ===== |
+ | |||
+ | Replacing static routes by FRR (OSPF) compiled with MULTIPATH option. | ||
+ | |||
+ | ==== R1 (ECMP router) ==== | ||
+ | |||
+ | In place of static routes, OSPF with FRR is used: | ||
- | <note warning> | ||
- | Flows from VM1 to VM6 should be " | ||
- | Using ping record feature like with this example: | ||
< | < | ||
- | [root@VM1]~# | + | sysrc frr_vtysh_boot=" |
- | PING 10.0.56.26 (10.0.56.26) from 10.0.12.21: 56 data bytes | + | frr_enable=" |
- | 64 bytes from 10.0.56.26: icmp_seq=0 ttl=61 time=0.455 ms | + | frr_daemons=" |
- | RR: 10.0.24.2 | + | watchfrr_flags=" |
- | 10.0.45.4 | + | watchfrr_enable=" |
- | 10.0.56.5 | + | |
- | 10.0.56.26 | + | cat > / |
- | 10.0.45.5 | + | frr version 8.4.1 |
- | 10.0.24.4 | + | frr defaults traditional |
- | 10.0.12.2 | + | hostname R1 |
- | 10.0.12.21 | + | ! |
+ | interface igb0 | ||
+ | ip ospf passive | ||
+ | ipv6 ospf6 area 0.0.0.0 | ||
+ | ipv6 ospf6 passive | ||
+ | exit | ||
+ | ! | ||
+ | interface igb1 | ||
+ | ipv6 ospf6 area 0.0.0.0 | ||
+ | exit | ||
+ | ! | ||
+ | interface igb2 | ||
+ | ipv6 ospf6 area 0.0.0.0 | ||
+ | exit | ||
+ | ! | ||
+ | router ospf | ||
+ | ospf router-id 1.1.1.1 | ||
+ | | ||
+ | | ||
+ | network | ||
+ | exit | ||
+ | ! | ||
+ | router ospf6 | ||
+ | exit | ||
+ | ! | ||
+ | EOF | ||
+ | service frr start | ||
+ | service watchfrr start | ||
+ | </ | ||
+ | |||
+ | ==== R2 (ECMP router) ==== | ||
+ | |||
+ | Same as R1 with OSPF and FRR: | ||
+ | < | ||
+ | sysrc frr_vtysh_boot=" | ||
+ | frr_enable=" | ||
+ | frr_daemons=" | ||
+ | watchfrr_flags=" | ||
+ | watchfrr_enable=" | ||
+ | |||
+ | cat > / | ||
+ | frr version 8.4.1 | ||
+ | frr defaults traditional | ||
+ | hostname R2 | ||
+ | ! | ||
+ | ip route 10.0.0.0/16 10.0.34.4 | ||
+ | ipv6 route 2001:db8::/32 2001: | ||
+ | ! | ||
+ | interface igb0 | ||
+ | ip ospf passive | ||
+ | ipv6 ospf6 area 0.0.0.0 | ||
+ | ipv6 ospf6 passive | ||
+ | exit | ||
+ | ! | ||
+ | interface igb1 | ||
+ | ipv6 ospf6 area 0.0.0.0 | ||
+ | exit | ||
+ | ! | ||
+ | interface igb2 | ||
+ | ipv6 ospf6 area 0.0.0.0 | ||
+ | exit | ||
+ | ! | ||
+ | router ospf | ||
+ | ospf router-id 2.2.2.2 | ||
+ | | ||
+ | | ||
+ | | ||
+ | network | ||
+ | exit | ||
+ | ! | ||
+ | router ospf6 | ||
+ | | ||
+ | exit | ||
+ | ! | ||
+ | EOF | ||
+ | service frr start | ||
+ | service watchfrr start | ||
+ | </ | ||
+ | |||
+ | ==== Checking routes installed ==== | ||
+ | |||
+ | On R1: | ||
+ | < | ||
+ | root@R1:~ # vtysh | ||
+ | Hello, this is FRRouting (version 8.4.1). | ||
+ | Copyright 1996-2005 Kunihiro Ishiguro, et al. | ||
+ | |||
+ | R1# sh ip route 10.0.34.0/24 | ||
+ | Routing entry for 10.0.34.0/24 | ||
+ | Known via " | ||
+ | Last update 00:01:51 ago | ||
+ | * 10.0.231.3, via igb1, weight 1 | ||
+ | | ||
+ | |||
+ | R1# sh ipv6 route 2001: | ||
+ | Routing entry for 2001: | ||
+ | Known via " | ||
+ | Last update 00:02:15 ago | ||
+ | * fe80:: | ||
+ | * fe80:: | ||
+ | |||
+ | route1# sh ipv6 route 2001:db8:24::/64 | ||
+ | Routing entry for 2001: | ||
+ | Known via " | ||
+ | Last update 00:02:42 ago | ||
+ | * fe80:: | ||
+ | * fe80:: | ||
+ | </ | ||
+ | |||
+ | ===== Test Load balancing IP packets ===== | ||
+ | |||
+ | Flows from the client to the server should be " | ||
+ | |||
+ | On server: | ||
+ | < | ||
+ | root@server: | ||
+ | </ | ||
+ | |||
+ | On client: | ||
+ | < | ||
+ | root@client: | ||
+ | </ | ||
+ | |||
+ | On R1: | ||
+ | < | ||
+ | systat -ifstat -match igb0, | ||
+ | |||
+ | /0 / | ||
+ | Load Average | ||
+ | |||
+ | Interface | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | </ | ||
+ | |||
+ | => We confirm that 20 Kps entering igb0 and are equally split by exiting by igb1 and igb2 | ||
+ | |||
+ | On R2: | ||
+ | < | ||
+ | systat -ifstat -match igb0, | ||
+ | |||
+ | /0 / | ||
+ | Load Average | ||
+ | |||
+ | Interface | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
- | --- 10.0.56.26 ping statistics --- | + | |
- | 1 packets transmitted, | + | |
- | round-trip min/avg/ | + | |
</ | </ | ||
- | ^ Source ^ Destination ^ Ongoing path selected by VM2 ^ Returning path selected by VM5^ | + | => R2 has no choice than receiving packets from igb1 and igb2, and forwarding them through igb0. |
- | | 10.0.12.1 | 10.0.35.5 | VM3 | VM4 | | + | |
- | | 10.0.12.1 | 10.0.45.5 | VM4 | VM4 | | + | |
- | | 10.0.12.1 | 10.0.56.6 | VM4 | VM4 | | + | |
- | | 10.0.12.11 | 10.0.56.16 | VM4 | VM4 | | + | |
- | | 10.0.12.21 | 10.0.56.26 | VM4 | VM4 | | + | |
- | | 10.0.12.31 | 10.0.56.36 | VM4 | VM4 | | + | |
- | | 10.0.12.41 | 10.0.56.46 | VM4 | VM4 | | + | |
- | | 10.0.12.51 | 10.0.56.56 | VM4 | VM4 | | + | |
- | | 2001: | + | |
- | | 2001: | + | |
- | | 2001: | + | |
- | | 2001: | + | |
- | | 2001: | + | |
- | | 2001: | + | |
documentation/examples/ecmp.txt · Last modified: 2024/03/28 23:19 by olivier