Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keepalived: Generate the proper route for the interface IP configured… #605

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

andrewhit
Copy link

… within

static_ipaddress{}.

  • With this patch, we can get the below two expected result with the below
    configuration example.

static_ipaddress {
/30 dev eth1
}

a) "dpvs-wan-ip" related route is generated.
inet /30 scope global eth1
valid_lft forever preferred_lft forever
...

b) "dpvs-wan-ip" is configured on the related interface for arp request.
inet /32 via 0.0.0.0 src dev eth1 mtu 1500 tos 0 scope link metric 0 proto auto
...

… within

static_ipaddress{}.

- With this patch, we can get the below two expected result with the below
  configuration example.

static_ipaddress {
    dpvs-wan-ip/30 dev eth1
}

a) "dpvs-wan-ip" related route is generated.
inet dpvs-wan-ip/30 scope global eth1
     valid_lft forever preferred_lft forever
...

b) "dpvs-wan-ip" is configured on the related interface for arp request.
inet dpvs-wan-network-ip/30 via 0.0.0.0 src dpvs-wan-ip dev eth1 mtu 1500 tos 0 scope link metric 0 proto auto
...
@ywc689 ywc689 added pr/to-test-codes Compile and test the patch of pr to verify if it works. pr/codes-reviewed-ok code review passed and no problem found labels Jul 20, 2020
@ywc689
Copy link
Collaborator

ywc689 commented Jul 29, 2020

Test failed for the keepalived config file.

static_ipaddress {
    172.21.33.4/30 dev dpdk0
}

vrrp_instance vrrp_instance_252 {
    state MASTER
    interface dpdk0.kni
    dpdk_interface dpdk0
    virtual_router_id 252
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 12345
    }

    virtual_ipaddress {
        1.1.1.1
    }
    virtual_ipaddress_excluded {
        2.2.2.2
    }
}

logs:

169159 Jul 29 15:15:55 10 systemd: Started DPVS and VRRP High Availability Monitor.
169160 Jul 29 15:15:55 10 Keepalived[11545]: Starting VRRP child process, pid=11546
169161 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: Registering Kernel netlink reflector
169162 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: Registering Kernel netlink command channel
169163 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: Opening file '/etc/keepalived/keepalived.conf'.
169164 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: (Line 24) WARNING - interface dpdk0 for ip address 172.21.33.4/30 doesn't exist
169165 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: find dpdk interface -- dpdk0
169166 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: Non-existent interface specified in configuration
169167 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: Unregistering DPVS gratuitous ARP.
169168 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: Stopped
169169 Jul 29 15:15:55 10 Keepalived[11545]: Keepalived_vrrp exited with permanent error CONFIG. Terminating
169170 Jul 29 15:15:55 10 Keepalived[11545]: Stopped Keepalived v2.0.19 (07/29,2020), git commit v1.8.4-15-g0dd0c43

problems:

  1. add static address 172.21.33.4/30 to dpvs interface dpdk0 failed.
  2. virtual ip addresses 1.1.1.1/32 and 2.2.2.2/32 were not added.

@ywc689 ywc689 added pr/codes-test-failed compile problem exists or specified test cases not passed and removed pr/to-test-codes Compile and test the patch of pr to verify if it works. labels Jul 29, 2020
@andrewhit
Copy link
Author

andrewhit commented Jul 29, 2020

I just tested the config within static_ipaddress{} without the config within vrrp_instance{}, for vrrp_instance{} is not used in our deployment.

static_ipaddress {
    172.21.33.4/30 dev dpdk0
}

@ywc689
Copy link
Collaborator

ywc689 commented Jul 29, 2020

I tested the patch without vrrp. The first problem still exists. Keepalived process exit abnormally immediately after startup.

169164 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: (Line 24) WARNING - interface dpdk0 for ip address 172.21.33.4/30 doesn't exist

@andrewhit
Copy link
Author

169164 Jul 29 15:15:55 10 Keepalived_vrrp[11546]: (Line 24) WARNING - interface dpdk0 for ip address 172.21.33.4/30 doesn't exist

Have you tried use eth1 instead of dpdk1? Here I do not use the name, dpdk1 or dpdk0, but eth1 or eth0. And for kni interface, we use eth1_kni or eth0_kni for mlx nic.

static_ipaddress {
172.21.33.4/30 dev eth1
}

@ywc689
Copy link
Collaborator

ywc689 commented Jul 30, 2020

The dpdk interface name doesn't matter.

I followed the flow of the static address parser:
"static_addresses_handler -> alloc_saddress -> alloc_ipaddress -> if_get_by_ifname(ifname, IF_CREATE_IF_DYNAMIC)"
if_get_by_ifname failed because the specified ifname was not existing or created. I think this is why the patch didn't work.

@andrewhit
Copy link
Author

andrewhit commented Jul 31, 2020

The dpdk interface name doesn't matter.

I followed the flow of the static address parser:
"static_addresses_handler -> alloc_saddress -> alloc_ipaddress -> if_get_by_ifname(ifname, IF_CREATE_IF_DYNAMIC)"
if_get_by_ifname failed because the specified ifname was not existing or created. I think this is why the patch didn't work.

The reason is that when dpvs is started, we need to use dpdk-devbind --bind=igb_uio <dpdk-port> whose name is eth1 or eth0.

static_ipaddress {
    10.25.255.129/32 dev eth1
}

static_routes {
    10.0.0.0/8 via 10.25.255.1 dev eth0
}

local_address_group laddr_g1 {
   10.25.255.2 eth0
   10.25.255.3 eth0
   10.25.255.4 eth0
   10.25.255.5 eth0
   10.25.255.6 eth0
   10.25.255.7 eth0
   10.25.255.8 eth0
   10.25.255.9 eth0
   10.25.255.10 eth0
   10.25.255.11 eth0
   10.25.255.12 eth0
   10.25.255.13 eth0
   10.25.255.14 eth0
   10.25.255.15 eth0
   10.25.255.16 eth0
   10.25.255.17 eth0
}

root@n25-146-090:~# dpip addr show
inet 10.25.255.14/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.7/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.11/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.4/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.15/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.8/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.12/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.5/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.16/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.9/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.2/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.13/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.6/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.17/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.10/32 scope global eth0
     valid_lft forever preferred_lft forever
inet 10.25.255.129/32 scope global eth1
     valid_lft forever preferred_lft forever
inet 10.25.255.3/32 scope global eth0
     valid_lft forever preferred_lft forever

root@n25-146-090:~# dpip route show
inet 10.25.255.2/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 192.168.100.2/32 via 0.0.0.0 src 0.0.0.0 dev eth1 mtu 1500 tos 0 scope kni_host metric 0 proto auto
inet 10.25.255.3/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.4/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.5/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.6/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.7/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.8/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.9/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.10/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.11/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.12/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.13/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.14/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.15/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.16/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.255.17/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.25.146.90/32 via 0.0.0.0 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope kni_host metric 0 proto auto
inet 10.25.255.129/32 via 0.0.0.0 src 0.0.0.0 dev eth1 mtu 1500 tos 0 scope host metric 0 proto auto
inet 10.0.0.0/8 via 10.25.255.1 src 0.0.0.0 dev eth0 mtu 1500 tos 0 scope global metric 0 proto auto

And the below lines are observed above.

# dpip addr show
inet 10.25.255.129/32 scope global eth1
     valid_lft forever preferred_lft forever

# dpip route show
inet 10.25.255.129/32 via 0.0.0.0 src 0.0.0.0 dev eth1 mtu 1500 tos 0 scope host metric 0 proto auto

@ywc689
Copy link
Collaborator

ywc689 commented Aug 6, 2020

Please test the case where ifnames of dpvs and kni are different.

@ywc689 ywc689 removed the pr/codes-test-failed compile problem exists or specified test cases not passed label Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/codes-reviewed-ok code review passed and no problem found
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants