Skip to content

Commit 6ec8212

Browse files
committed
Reserve first 10 IPs (.0-.9) per subnet for system use
IPAM tunnel cursor starts at offset 10. Addresses .0-.9 are reserved: .0 = network, .1 = server gateway, .2-.9 = future system services (DNS, relay, monitoring, etc). First client gets .10.
1 parent 69fd120 commit 6ec8212

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

projects/LemonadeNexus/include/LemonadeNexus/IPAM/IPAMService.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class IPAMService : public core::IService<IPAMService>,
7575
std::unordered_map<std::string, AllocationSet> allocations_;
7676

7777
/// Cursor trackers for sequential allocation within each block.
78-
/// Tunnel starts at offset 2: .0 = network, .1 = server gateway.
79-
uint32_t next_tunnel_ip_{2}; // next offset within 10.64.0.0/10
78+
/// First 10 IPs (.0-.9) reserved for system: .0=network, .1=gateway, .2-.9=future.
79+
uint32_t next_tunnel_ip_{10}; // next offset within 10.64.0.0/10
8080
uint32_t next_private_ip_{0}; // next offset within 10.128.0.0/9
8181
uint32_t next_shared_ip_{0}; // next offset within 172.20.0.0/14
8282
};

projects/LemonadeNexus/src/IPAM/IPAMService.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ void IPAMService::load_allocations() {
337337
if (aset.tunnel) {
338338
auto [ip, prefix] = parse_cidr(aset.tunnel->base_network);
339339
uint32_t offset = ip - kTunnelBase + 1;
340-
// Never go below 2 — .0 is network, .1 is server gateway
341-
if (offset > next_tunnel_ip_) next_tunnel_ip_ = std::max(offset, uint32_t{2});
340+
// Never go below 10 — .0-.9 reserved for system use
341+
if (offset > next_tunnel_ip_) next_tunnel_ip_ = std::max(offset, uint32_t{10});
342342
}
343343
if (aset.private_subnet) {
344344
auto [ip, prefix] = parse_cidr(aset.private_subnet->base_network);

0 commit comments

Comments
 (0)