Skip to content

Allow networks with /31 subnet mask (point-to-point links) #32444

@dongting

Description

@dongting

Description

A point-to-point network doesn't really need the extra 2 addresses, so a /31 should suffice. It would be desirable to allow docker networks with a size of /31. For more background see RFC 3021.

Steps to reproduce the issue:
1.

$ sudo docker network create --driver bridge --subnet 10.255.1.0/31 --ip-range 10.255.1.0/31 test-31
Error response from daemon: failed to allocate gateway (): No available addresses on this pool

Describe the results you received:
Error response from daemon: failed to allocate gateway (): No available addresses on this pool

Describe the results you expected:
A correct run would be similar to a /30:

$ sudo docker network create --driver bridge --subnet 10.255.1.0/30 --ip-range 10.255.1.0/30 test-30
<hash output>

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:
(I cannot try it on the latest version at the moment)

Client:
 Version:      1.12.6
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   7392c3b/1.12.6
 Built:        Tue Mar  7 20:34:04 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.6
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   7392c3b/1.12.6
 Built:        Tue Mar  7 20:34:04 2017
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 12
Server Version: 1.12.6
Storage Driver: devicemapper
 Pool Name: docker-202:1-263713-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 980 MB
 Data Space Total: 107.4 GB
 Data Space Available: 4.946 GB
 Metadata Space Used: 1.946 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.146 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.89-RHEL6 (2014-09-01)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge null host overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options:
Kernel Version: 3.14.35-28.38.amzn1.x86_64
Operating System: Amazon Linux AMI 2016.09
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 996.3 MiB
Name: ip-172-23-2-111
ID: CI26:N3D7:YCTA:JS44:RRO7:BO2B:4SLW:Z7BE:X2ZU:A32L:I63V:MPWN
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.):
This is on an EC2 instance in AWS.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions