hashicorp / hashicorp/consul

Transparent proxy ip range is not configurable

Open
#22,595 0 comments 0 reactions 1 assignee Claimed by @sujay-hashicorp View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Feature Description

**No Configuration Parameters**: A review of Consul's service definition schema and configuration options shows no parameters for customizing the virtual IP range.

**Hardcoded Implementation in Source Code**: The virtual IP range is hardcoded in Consul's source code at:

**File**: `agent/consul/state/catalog.go` (lines 43-45)

```go
var (
// startingVirtualIP is the start of the virtual IP range we assign to services.
// The effective CIDR range is startingVirtualIP to (startingVirtualIP + virtualIPMaxOffset).
startingVirtualIP = net.IP{240, 0, 0, 0}

virtualIPMaxOffset = net.IP{15, 255, 255, 254}
)
```

This shows that:

- **Starting IP**: `240.0.0.0` (hardcoded as `net.IP{240, 0, 0, 0}`)
- **Maximum offset**: `15.255.255.254` (defining the upper bound)
- **Effective range**: `240.0.0.0` to `255.255.255.254` (the entire `240.0.0.0/4` block)

**File**: `agent/consul/state/catalog.go` (functions using these constants)

- `assignServiceVirtualIP()` - Assigns virtual IPs to services
- `addIPOffset()` - Performs IP arithmetic within the range
- `ServiceVirtualIP.IPWithOffset()` - Calculates final IP addresses

#### Use Case(s)

This ip range can be in use by other services which can cause possible ip duplication and network instabilities.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.