Custom Networking

Configuring an IP address for a container

By default, a container will have an IP address assigned automatically out of the pool of available IP addresses: 10.40.0.1 - 10.47.255.254. Once a container is recreated, it may receive different IP address. A container does not change an IP address if it is restarted.

It is possible to configure a static IP address for a container using WEAVE_CIDR environment variable. Static IP addresses should be picked from the reserved pool of static IP addresses: 10.32.0.1 - 10.39.255.254. For example:

version: "3.7"
services:
echo:
network_mode: bridge
restart: unless-stopped
image: ealen/echo-server
environment:
WEAVE_CIDR: 10.32.1.1/12
important

To guarantee uniqueness of assigned static IP addresses, it is recommended to use OVERNODE_CONFIG__STACK_ID and OVERNODE_ID variables in a value for WEAVE_CIDR.

Assuming, overnode.yml has got a stack with name echo, the recommended static IP address configuration would look like the following:

version: "3.7"
services:
echo:
network_mode: bridge
restart: unless-stopped
image: ealen/echo-server
environment:
WEAVE_CIDR: 10.32.${OVERNODE_CONFIG_ECHO_ID}.${OVERNODE_ID}/12

Configuring network isolation for a container

By default, all containers can send / receive IP traffic within a cluster in the 10.32.0.0/12 subnet. It is possible to reduce a subnet for a container using WEAVE_CIDR environment variable with network mask higher than 12. For example, 24 below:

version: "3.7"
services:
echo:
network_mode: bridge
restart: unless-stopped
image: ealen/echo-server
environment:
WEAVE_CIDR: 10.32.${OVERNODE_CONFIG_ECHO_ID}.${OVERNODE_ID}/24

Inspecting IPAM status

To inspect the status of IPAM and a number of assigned / available IP addresses, use status command:

> sudo overnode status --ipam