Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
The FDP team is no longer accepting new bugs in Bugzilla. Please report your issues under FDP project in Jira. Thanks.

Bug 1931319

Summary: Provide the option to use the router ip for SNAT of load balancer traffic
Product: Red Hat Enterprise Linux Fast Datapath Reporter: Numan Siddique <nusiddiq>
Component: ovn2.13Assignee: Numan Siddique <nusiddiq>
Status: CLOSED ERRATA QA Contact: Jianlin Shi <jishi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: FDP 20.HCC: ctrautma, jishi, mmichels, ralongi, trozet
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-12 18:09:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Numan Siddique 2021-02-22 06:56:44 UTC
Description of problem:

Provide the option to set
ovn-nbctl set logical_router <gw_router> options.lb_force_snat_ip=router_ip

Sp that the load balanced traffic is SNAtted to the IP of the router port from which the packet leaves the logical router pipeline.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Dan Williams 2021-03-01 16:04:08 UTC
*** Bug 1924750 has been marked as a duplicate of this bug. ***

Comment 6 Jianlin Shi 2021-03-05 06:21:28 UTC
tested with following script:

#!/bin/bash                                                        
                                                                               
                                                                   
# Logical network:                                                                          
# Three LRs - R1, R2 and R3 that are connected to each other via LS "join"
# in 20.0.0.0/24 network. R1 has switchess foo (192.168.1.0/24) and 
# bar (192.168.2.0/24) connected to it. R2 has alice (172.16.1.0/24) connected
# to it.  R3 has bob (172.16.1.0/24) connected to it. Note how both alice and
# bob have the same subnet behind it.                               
#    foo -- R1 -- join - R2 -- alice                            
#           |          |                                                   
#    bar ----          - R3 --- bob                                                        
#                                                                   
                                                                            
systemctl start openvswitch                                                 
systemctl start ovn-northd                                
ovn-nbctl set-connection ptcp:6641                                                          
ovn-sbctl set-connection ptcp:6642                                    
ovs-vsctl set open . external_ids:system-id=hv1 external_ids:ovn-remote=tcp:20.0.173.25:6642 external_ids:ovn-encap-type=geneve external_ids:ovn-encap-ip=20.0.173.25
systemctl restart ovn-controller                                      
                                                                
ovs-vsctl add-br br-nat                                                    
ovs-vsctl set open . external_ids:ovn-bridge-mappings=nattest:br-nat
ip link set br-nat up                                                
                                                                   
ovn-nbctl lr-add R1                                                            
ovn-nbctl lr-add R2                                                  
ovn-nbctl lr-add R3                                                
                                                                                                 
ovn-nbctl set logical_router R2 options:chassis=hv1                  
ovn-nbctl set logical_router R3 options:chassis=hv1

ovn-nbctl ls-add foo
ovn-nbctl ls-add bar
ovn-nbctl ls-add alice
ovn-nbctl ls-add bob
ovn-nbctl ls-add join

ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24 2001::1/64
ovn-nbctl lsp-add foo rp-foo -- set logical_switch_port rp-foo \
        type=router options:router-port=foo addresses=\"00:00:01:01:02:03\"
        
ovn-nbctl lrp-add R1 bar 00:00:01:01:02:04 192.168.2.1/24 2002::1/64
ovn-nbctl lsp-add bar rp-bar -- set Logical_Switch_Port rp-bar \
        type=router options:router-port=bar addresses=\"00:00:01:01:02:04\"
        
ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24 3001::1/64
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
        type=router options:router-port=alice addresses=\"00:00:02:01:02:03\"
ovn-nbctl lrp-add R3 bob 00:00:03:01:02:03 172.16.1.2/24 3001::2/64
ovn-nbctl lsp-add bob rp-bob -- set Logical_Switch_Port rp-bob \
        type=router options:router-port=bob addresses=\"00:00:03:01:02:03\"

ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24 4000::1/64
ovn-nbctl lsp-add join r1-join -- set Logical_Switch_Port r1-join \
        type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"'
ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24 4000::2/64
ovn-nbctl lsp-add join r2-join -- set Logical_Switch_Port r2-join \
        type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"'
ovn-nbctl lrp-add R3 R3_join 00:00:04:01:02:05 20.0.0.3/24 4000::3/64
ovn-nbctl lsp-add join r3-join -- set Logical_Switch_Port r3-join \
        type=router options:router-port=R3_join addresses='"00:00:04:01:02:05"'
ovn-nbctl --policy="src-ip" lr-route-add R1 192.168.1.0/24 20.0.0.2
ovn-nbctl --policy="src-ip" lr-route-add R1 192.168.2.0/24 20.0.0.3
ovn-nbctl --policy="src-ip" lr-route-add R1 2001::/64 4000::2
ovn-nbctl --policy="src-ip" lr-route-add R1 2002::/64 4000::3

ovn-nbctl lr-route-add R2 192.168.0.0/16 20.0.0.1
ovn-nbctl lr-route-add R3 192.168.0.0/16 20.0.0.1
ovn-nbctl lr-route-add R2 2001::/64 4000::1
ovn-nbctl lr-route-add R2 2002::/64 4000::1
ovn-nbctl lr-route-add R3 2001::/64 4000::1
ovn-nbctl lr-route-add R3 2002::/64 4000::1

# add load balancer
ovn-nbctl lb-add lb0 30.0.0.1 192.168.1.2,192.168.2.2
ovn-nbctl lb-add lb0 6010::1 2001::2,2002::2
uuid=`ovn-nbctl lb-list | grep lb0 | awk '{print $1}'`
ovn-nbctl set logical_router R2 load_balancer=$uuid
ovn-nbctl set logical_router R3 load_balancer=$uuid

ovn-nbctl show

ip netns add foo1
ovs-vsctl add-port br-int foo1 -- set interface foo1 type=internal
ip link set foo1 netns foo1
ip netns exec foo1 ip link set foo1 address f0:00:00:01:02:03
ip netns exec foo1 ip link set foo1 up
ip netns exec foo1 ip addr add 192.168.1.2/24 dev foo1
ip netns exec foo1 ip -6 addr add 2001::2/64 dev foo1
ip netns exec foo1 ip route add default via  192.168.1.1 dev foo1
ip netns exec foo1 ip -6 route add default via 2001::1 dev foo1
ovs-vsctl set interface foo1 external_ids:iface-id=foo1
ovn-nbctl lsp-add foo foo1 -- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2 2001::2"

ip netns add bar1
ip link add bar1 netns bar1 type veth peer name bar1_br
ip netns exec bar1 ip link set bar1 address f0:00:00:01:02:05
ip netns exec bar1 ip link set bar1 up
ip netns exec bar1 ip addr add 192.168.2.2/24 dev bar1
ip netns exec bar1 ip -6 addr add 2002::2/64 dev bar1
ip netns exec bar1 ip route add default via 192.168.2.1 dev bar1
ip netns exec bar1 ip -6 route add default via 2002::1 dev bar1
ip link set bar1_br up
ovs-vsctl add-port br-int bar1_br
ovs-vsctl set interface bar1_br external_ids:iface-id=bar1
ovn-nbctl lsp-add bar bar1 -- lsp-set-addresses bar1 "f0:00:00:01:02:05 192.168.2.2 2002::2"

ip netns add alice1 
ovs-vsctl add-port br-int alice1 -- set interface alice1 type=internal
ip link set alice1 netns alice1
ip netns exec alice1 ip link set alice1 address f0:00:00:01:02:04
ip netns exec alice1 ip link set alice1 up
ip netns exec alice1 ip addr add 172.16.1.3/24 dev alice1
ip netns exec alice1 ip -6 addr add 3001::3/64 dev alice1
ip netns exec alice1 ip route add default via 172.16.1.1 dev alice1
ip netns exec alice1 ip -6 route add default via 3001::1 dev alice1
ovs-vsctl set interface alice1 external_ids:iface-id=alice1
ovn-nbctl lsp-add alice alice1 -- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.3 3001::3"

ip netns add bob1
ip link add bob1 netns bob1 type veth peer name bob1_br
ip netns exec bob1 ip link set bob1 address f0:00:00:01:02:06
ip netns exec bob1 ip link set bob1 up
ip netns exec bob1 ip addr add 172.16.1.4/24 dev bob1
ip netns exec bob1 ip -6 addr add 3001::4/64 dev bob1
ip netns exec bob1 ip route add default via 172.16.1.2 dev bob1
ip netns exec bob1 ip -6 route add default via 3001::2 dev bob1
ip link set bob1_br up
ovs-vsctl add-port br-int bob1_br
ovs-vsctl set interface bob1_br external_ids:iface-id=bob1
ovn-nbctl lsp-add bob bob1 -- lsp-set-addresses bob1 "f0:00:00:01:02:06 172.16.1.4 3001::4"

#ovn-nbctl set logical_router R2 options:lb_force_snat_ip="20.0.0.2 4000::2"
#ovn-nbctl set logical_router R3 options:lb_force_snat_ip="20.0.0.3 4000::3"

ovn-nbctl set logical_router R2 options:lb_force_snat_ip=router_ip
ovn-nbctl set logical_router R3 options:lb_force_snat_ip=router_ip

ip netns exec foo1 tcpdump -i any -w foo1.pcap &
ip netns exec bar1 tcpdump -i any -w bar1.pcap &
sleep 5

ip netns exec alice1 ping 30.0.0.1 -c 1
ip netns exec bob1 ping 30.0.0.1 -c 1
ip netns exec alice1 ping6 6010::1 -c 1
ip netns exec bob1 ping6 6010::1 -c 1

pkill tcpdump

result on ovn2.13-20.12.0-24:

[root@wsfd-advnetlab18 bz1931319]# rpm -qa | grep -E "openvswitch2.13|ovn2.13"
ovn2.13-central-20.12.0-24.el7fdp.x86_64
openvswitch2.13-2.13.0-84.el7fdp.x86_64
ovn2.13-20.12.0-24.el7fdp.x86_64
ovn2.13-host-20.12.0-24.el7fdp.x86_64

[root@wsfd-advnetlab18 bz1931319]# tcpdump  -r foo1.pcap host 192.168.1.2 or host 2001::2 -nnle -v
reading from file foo1.pcap, link-type LINUX_SLL (Linux cooked)
01:14:59.059925  In 00:00:01:01:02:03 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 62, id 48637, offset 0, flags [DF], proto ICMP (1), length 84)
    172.16.1.3 > 192.168.1.2: ICMP echo request, id 16336, seq 1, length 64

<==== not snated

01:14:59.059979 Out f0:00:00:01:02:03 ethertype ARP (0x0806), length 44: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.1 tell 192.168.1.2, length 28
01:14:59.060523  In 00:00:01:01:02:03 ethertype ARP (0x0806), length 44: Ethernet (len 6), IPv4 (len 4), Reply 192.168.1.1 is-at 00:00:01:01:02:03, length 28
01:14:59.060540 Out f0:00:00:01:02:03 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 64, id 29935, offset 0, flags [none], proto ICMP (1), length 84)
    192.168.1.2 > 172.16.1.3: ICMP echo reply, id 16336, seq 1, length 64
01:14:59.137642  In 00:00:01:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 62, next-header ICMPv6 (58) payload length: 64) 3001::3 > 2001::2: [icmp6 sum ok] ICMP6, echo request, seq 1

<=== not snated

01:14:59.137778 Out f0:00:00:01:02:03 ethertype IPv6 (0x86dd), length 88: (hlim 255, next-header ICMPv6 (58) payload length: 32) 2001::2 > ff02::1:ff00:1: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001::1
          source link-address option (1), length 8 (1): f0:00:00:01:02:03
01:14:59.143142  In 00:00:01:01:02:03 ethertype IPv6 (0x86dd), length 88: (hlim 255, next-header ICMPv6 (58) payload length: 32) 2001::1 > 2001::2: [icmp6 sum ok] ICMP6, neighbor advertisement, length 32, tgt is 2001::1, Flags [router, solicited, override]
          destination link-address option (2), length 8 (1): 00:00:01:01:02:03
01:14:59.143177 Out f0:00:00:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 64, next-header ICMPv6 (58) payload length: 64) 2001::2 > 3001::3: [icmp6 sum ok] ICMP6, echo reply, seq 1
01:14:59.181555  In 00:00:01:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 62, next-header ICMPv6 (58) payload length: 64) 3001::4 > 2001::2: [icmp6 sum ok] ICMP6, echo request, seq 1

<=== not snated

01:14:59.181607 Out f0:00:00:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 64, next-header ICMPv6 (58) payload length: 64) 2001::2 > 3001::4: [icmp6 sum ok] ICMP6, echo reply, seq 1

[root@wsfd-advnetlab18 bz1931319]# tcpdump  -r bar1.pcap host 192.168.2.2 or host 2002::2 -nnle -v 
reading from file bar1.pcap, link-type LINUX_SLL (Linux cooked)
01:14:59.098609  In 00:00:01:01:02:04 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 62, id 8457, offset 0, flags [DF], proto ICMP (1), length 84)
    172.16.1.4 > 192.168.2.2: ICMP echo request, id 16337, seq 1, length 64

<=== not snated

01:14:59.098662 Out f0:00:00:01:02:05 ethertype ARP (0x0806), length 44: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.2.1 tell 192.168.2.2, length 28
01:14:59.099216  In 00:00:01:01:02:04 ethertype ARP (0x0806), length 44: Ethernet (len 6), IPv4 (len 4), Reply 192.168.2.1 is-at 00:00:01:01:02:04, length 28
01:14:59.099225 Out f0:00:00:01:02:05 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 64, id 426, offset 0, flags [none], proto ICMP (1), length 84)
    192.168.2.2 > 172.16.1.4: ICMP echo reply, id 16337, seq 1, length 64

Comment 9 Mark Michelson 2021-03-16 17:23:21 UTC
Moving this back to MODIFIED since the patch Tim linked has been merged upstream and backported downstream.

Comment 12 Jianlin Shi 2021-03-18 02:20:52 UTC
Verified on 20.12.0-85:

[root@wsfd-advnetlab18 bz1931319]# rpm -qa | grep -E "openvswitch2.13|ovn2.13"
openvswitch2.13-2.13.0-84.el7fdp.x86_64
ovn2.13-host-20.12.0-85.el7fdp.x86_64
ovn2.13-central-20.12.0-85.el7fdp.x86_64
ovn2.13-20.12.0-85.el7fdp.x86_64

+ ip netns exec alice1 ping 30.0.0.1 -c 1
PING 30.0.0.1 (30.0.0.1) 56(84) bytes of data.
64 bytes from 30.0.0.1: icmp_seq=1 ttl=62 time=3.92 ms
                   
--- 30.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 3.920/3.920/3.920/0.000 ms                                                 
+ ip netns exec bob1 ping 30.0.0.1 -c 1                        
PING 30.0.0.1 (30.0.0.1) 56(84) bytes of data.                                                                                                                                                             
64 bytes from 30.0.0.1: icmp_seq=1 ttl=62 time=3.40 ms                   
                                                                                                                                                                                                           
--- 30.0.0.1 ping statistics ---                                                                                                                                                                           
1 packets transmitted, 1 received, 0% packet loss, time 0ms                                                                                                                                                
rtt min/avg/max/mdev = 3.404/3.404/3.404/0.000 ms                      
+ ip netns exec alice1 ping6 6010::1 -c 1                                                                                                                                                                  
PING 6010::1(6010::1) 56 data bytes                                                                                                                                                                         64 bytes from 6010::1: icmp_seq=1 ttl=62 time=4.78 ms
                                                                         
--- 6010::1 ping statistics ---                                                                                                                                                                             1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 4.787/4.787/4.787/0.000 ms                             
+ ip netns exec bob1 ping6 6010::1 -c 1                                                                                                                                                                    
PING 6010::1(6010::1) 56 data bytes                                                                                                                                                                        
64 bytes from 6010::1: icmp_seq=1 ttl=62 time=3.83 ms                                                                                                                                                      
                                  
--- 6010::1 ping statistics ---                                                                   
1 packets transmitted, 1 received, 0% packet loss, time 0ms    
rtt min/avg/max/mdev = 3.832/3.832/3.832/0.000 ms

[root@wsfd-advnetlab18 bz1931319]# tcpdump  -r foo1.pcap host 192.168.1.2 or host 2001::2 -nnle -v
reading from file foo1.pcap, link-type LINUX_SLL (Linux cooked)
22:17:46.978668  In 00:00:01:01:02:03 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 62, id 14500, offset 0, flags [DF], proto ICMP (1), length 84)                                                    
    20.0.0.2 > 192.168.1.2: ICMP echo request, id 29356, seq 1, length 64
<=== snated
22:17:46.979360 Out f0:00:00:01:02:03 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 64, id 35047, offset 0, flags [none], proto ICMP (1), length 84)                                                  
    192.168.1.2 > 20.0.0.2: ICMP echo reply, id 29356, seq 1, length 64
22:17:47.059459  In 00:00:01:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 62, next-header ICMPv6 (58) payload length: 64) 4000::2 > 2001::2: [icmp6 sum ok] ICMP6, echo request, seq 1 
<== snated             
22:17:47.060914 Out f0:00:00:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 64, next-header ICMPv6 (58) payload length: 64) 2001::2 > 4000::2: [icmp6 sum ok] ICMP6, echo reply, seq 1                
22:17:47.098986  In 00:00:01:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 62, next-header ICMPv6 (58) payload length: 64) 4000::3 > 2001::2: [icmp6 sum ok] ICMP6, echo request, seq 1  
<=== snated            
22:17:47.099037 Out f0:00:00:01:02:03 ethertype IPv6 (0x86dd), length 120: (hlim 64, next-header ICMPv6 (58) payload length: 64) 2001::2 > 4000::3: [icmp6 sum ok] ICMP6, echo reply, seq 1

[root@wsfd-advnetlab18 bz1931319]# tcpdump  -r bar1.pcap host 192.168.2.2 or host 2002::2 -nnle -v
reading from file bar1.pcap, link-type LINUX_SLL (Linux cooked)
22:17:47.012244  In 00:00:01:01:02:04 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 62, id 23518, offset 0, flags [DF], proto ICMP (1), length 84)                                                    
    20.0.0.3 > 192.168.2.2: ICMP echo request, id 29357, seq 1, length 64
<=== snated                                          
22:17:47.012894 Out f0:00:00:01:02:05 ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 64, id 8761, offset 0, flags [none], proto ICMP (1), length 84)                                                   
    192.168.2.2 > 20.0.0.3: ICMP echo reply, id 29357, seq 1, length 64

Comment 14 errata-xmlrpc 2021-04-12 18:09:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ovn2.13 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1164