# we have a default route to start with
$ sudo ip netns exec "snat-$router_id" ip route
default via 172.24.4.1 dev qg-9235492c-11 proto static
10.0.0.64/26 dev sg-7ef787ed-d0 proto kernel scope link src 10.0.0.80
172.24.4.0/24 dev qg-9235492c-11 proto kernel scope link src 172.24.4.40
$ openstack router set router2 --no-route --route destination=0.0.0.0/0,gateway=10.0.0.70
# default route is overriden by /0 extraroute
$ sudo ip netns exec "snat-$router_id" ip route
default via 10.0.0.70 dev sg-7ef787ed-d0 proto static
10.0.0.64/26 dev sg-7ef787ed-d0 proto kernel scope link src 10.0.0.80
172.24.4.0/24 dev qg-9235492c-11 proto kernel scope link src 172.24.4.40
$ openstack router set router2 --no-route
# original default route is not recovered after deleting /0 extraroute
$ sudo ip netns exec "snat-$router_id" ip route
10.0.0.64/26 dev sg-7ef787ed-d0 proto kernel scope link src 10.0.0.80
172.24.4.0/24 dev qg-9235492c-11 proto kernel scope link src 172.24.4.40
In a DVR environment with an external gateway I was able to reproduce the part of the bug Liu wrote about in comment #4. Please see below:
$ openstack router create router2
$ router_id="$( openstack router show router2 -f value -c id )"
$ openstack network create net2 subnet- pool subnet2
$ openstack subnet create --network net2 --use-default-
$ openstack router set --external-gateway public router2
$ openstack router add subnet router2 subnet2
# we have a default route to start with
$ sudo ip netns exec "snat-$router_id" ip route
default via 172.24.4.1 dev qg-9235492c-11 proto static
10.0.0.64/26 dev sg-7ef787ed-d0 proto kernel scope link src 10.0.0.80
172.24.4.0/24 dev qg-9235492c-11 proto kernel scope link src 172.24.4.40
$ openstack subnet show subnet2 ------- ------- --+---- ------- ------- ------- ------- ------+ ------- ------- --+---- ------- ------- ------- ------- ------+ 66-10.0. 0.126 | 29T15:17: 57Z | fixed_ip | None | e5d9-4f57- a4f1-118cfbc2eb 0b | 4458-48c6- ad21-bdf47a9638 b5 | 39d17bd2f5c3139 bd | fe19-4433- b491-bc40cb07fe 04 | 29T15:17: 57Z | ------- ------- --+---- ------- ------- ------- ------- ------+
+------
| Field | Value |
+------
| allocation_pools | 10.0.0.
| cidr | 10.0.0.64/26 |
| created_at | 2020-10-
| description | |
| dns_nameservers | |
| dns_publish_
| enable_dhcp | True |
| gateway_ip | 10.0.0.65 |
| host_routes | |
| id | 7bfb1bc6-
| ip_version | 4 |
| ipv6_address_mode | None |
| ipv6_ra_mode | None |
| name | subnet2 |
| network_id | e46a48c2-
| prefix_length | None |
| project_id | 928bf5e466e2450
| revision_number | 0 |
| segment_id | None |
| service_types | |
| subnetpool_id | 4d5019e3-
| tags | |
| updated_at | 2020-10-
+------
$ openstack router set router2 --no-route --route destination= 0.0.0.0/ 0,gateway= 10.0.0. 70
# default route is overriden by /0 extraroute
$ sudo ip netns exec "snat-$router_id" ip route
default via 10.0.0.70 dev sg-7ef787ed-d0 proto static
10.0.0.64/26 dev sg-7ef787ed-d0 proto kernel scope link src 10.0.0.80
172.24.4.0/24 dev qg-9235492c-11 proto kernel scope link src 172.24.4.40
$ openstack router set router2 --no-route
# original default route is not recovered after deleting /0 extraroute
$ sudo ip netns exec "snat-$router_id" ip route
10.0.0.64/26 dev sg-7ef787ed-d0 proto kernel scope link src 10.0.0.80
172.24.4.0/24 dev qg-9235492c-11 proto kernel scope link src 172.24.4.40