Title: Expunge vm not release in-memory dhcp record in vpc redundant virtual route correctly · Issue #10182 · apache/cloudstack · GitHub
Open Graph Title: Expunge vm not release in-memory dhcp record in vpc redundant virtual route correctly · Issue #10182 · apache/cloudstack
X Title: Expunge vm not release in-memory dhcp record in vpc redundant virtual route correctly · Issue #10182 · apache/cloudstack
Description: Environment cloudstack 4.19.1.2 Problem In-memory record never released before next reboot of virtual router, finally run out of ip address, new vm can not get ip from dhcp. Reproduce 1. Create vpc with redundant router and vm 2. After v...
Open Graph Description: Environment cloudstack 4.19.1.2 Problem In-memory record never released before next reboot of virtual router, finally run out of ip address, new vm can not get ip from dhcp. Reproduce 1. Create vpc...
X Description: Environment cloudstack 4.19.1.2 Problem In-memory record never released before next reboot of virtual router, finally run out of ip address, new vm can not get ip from dhcp. Reproduce 1. Create vpc...
Opengraph URL: https://github.com/apache/cloudstack/issues/10182
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Expunge vm not release in-memory dhcp record in vpc redundant virtual route correctly","articleBody":"### Environment\ncloudstack 4.19.1.2\n### Problem\nIn-memory record never released before next reboot of virtual router, finally run out of ip address, new vm can not get ip from dhcp.\n### Reproduce\n```\n1. Create vpc with redundant router and vm\n2. After vm success boot up, expunge it.\n3. Check `/var/lib/misc/dnsmasq.leases`, the vm record still there.\n```\n### Research\n1. When expunging vm, cloudstack will call shell command like `dhcp_release eth3 172.29.101.250 02:02:00:d4:00:4f` try to release in-memory dhcp record in dnsmasq in virtual router vm\n2. the `dhcp_release` command will actually do nothing, because dnsmasq will check the server address in config is matching the request address. check the dnsmasq source code below\n\n```\n// dnsmasq v2.85 src\\rfc2131.c:1046\n case DHCPRELEASE:\n if (!(context = narrow_context(context, mess-\u003eciaddr, tagif_netid)) ||\n\t !(opt = option_find(mess, sz, OPTION_SERVER_IDENTIFIER, INADDRSZ)) ||\n\t option_addr(opt).s_addr != server_id(context, override, fallback).s_addr) \u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\n\treturn 0;\n\n```\n3. The address will not match because `dhcp_release` is requesting the primary address, and dnsmasq is listening the secondary address.\n```\n// /etc/dnsmasq.d/cloud.conf\ndhcp-hostsfile=/etc/dhcphosts.txt\nlisten-address=127.0.0.1,172.29.101.1 \u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\ndhcp-range=set:interface-eth3-1,172.29.101.1,static\ndhcp-option=tag:interface-eth3-1,15,cs2cloud.internal\ndhcp-option=tag:interface-eth3-1,6,172.29.101.1,10.1.2.146\ndhcp-option=tag:interface-eth3-1,3,172.29.101.1\ndhcp-option=eth3,26,1450\ndhcp-option=tag:interface-eth3-1,1,255.255.255.0\n```\n```\n// tcpdump view of packet emit by dhcp_release\n08:23:24.200332 lo In IP (tos 0x0, ttl 64, id 61594, offset 0, flags [DF], proto UDP (17), length 576)\n 172.29.101.245.57053 \u003e 172.29.101.245.67: [bad udp cksum 0x2663 -\u003e 0xd1aa!] BOOTP/DHCP, Request from 02:02:00:d4:00:51, length 548, Flags [none] (0x0000)\n Client-IP 172.29.101.49\n Client-Ethernet-Address 02:02:00:d4:00:51\n Vendor-rfc1048 Extensions\n Magic Cookie 0x63825363\n DHCP-Message (53), length 1: Release\n Server-ID (54), length 4: 172.29.101.245\n END (255), length 0\n PAD (0), length 0, occurs 298\n```\n```\n// ip addr show\n5: eth3: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1450 qdisc pfifo_fast state UP group default qlen 1000\n link/ether 02:02:00:d4:00:32 brd ff:ff:ff:ff:ff:ff\n altname enp0s10\n altname ens10\n inet 172.29.101.245/24 brd 172.29.101.255 scope global eth3\n valid_lft forever preferred_lft forever\n inet 172.29.101.1/24 brd 172.29.101.255 scope global secondary eth3\n valid_lft forever preferred_lft forever\n```\n\n### Workaround\nAdd both primary and secondary address to `cloud.conf` make it works.\n```\ndhcp-hostsfile=/etc/dhcphosts.txt\nlisten-address=127.0.0.1,172.29.101.1,172.29.101.245\n```\nOr patch `/opt/cloud/bin/cs/CsDhcp.py` in virtual router\n```\n if self.cl.is_redundant():\n listen_address.append(gateway)\n listen_address.append(ip) # \u003c\u003c\u003c\u003c\u003c add this\n else:\n listen_address.append(ip)\n```","author":{"url":"https://github.com/hulucc","@type":"Person","name":"hulucc"},"datePublished":"2025-01-14T08:45:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/10182/cloudstack/issues/10182"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1dec044b-e591-554a-678d-ee8d53a87c74 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9818:2A256:C2E2B3:118D249:6A4E481E |
| html-safe-nonce | 5f742a1187aacbaf81a63a1b25f1e36dbecf83d26d7018173e26a8d78a85af64 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODE4OjJBMjU2OkMyRTJCMzoxMThEMjQ5OjZBNEU0ODFFIiwidmlzaXRvcl9pZCI6Ijc1Nzg4MTQ1NDQwMTA0MzA0OTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 94107268fed6e5afe21cc369027e8393aca3bd3b95fc67edc783084355143b15 |
| hovercard-subject-tag | issue:2786570329 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/cloudstack/10182/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6b7779ce408d430e9a7369aba6db5813d6e08c1a19354577d8ecf98ab7b56bc4/apache/cloudstack/issues/10182 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6b7779ce408d430e9a7369aba6db5813d6e08c1a19354577d8ecf98ab7b56bc4/apache/cloudstack/issues/10182 |
| og:image:alt | Environment cloudstack 4.19.1.2 Problem In-memory record never released before next reboot of virtual router, finally run out of ip address, new vm can not get ip from dhcp. Reproduce 1. Create vpc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hulucc |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/cloudstack git https://github.com/apache/cloudstack.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 9759448 |
| octolytics-dimension-repository_nwo | apache/cloudstack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9759448 |
| octolytics-dimension-repository_network_root_nwo | apache/cloudstack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e8506f6d0538364886e3f0153c154c410965e70d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width