Skip to content

Instantly share code, notes, and snippets.

@mahrous-amer
Created March 22, 2024 06:32
Show Gist options
  • Save mahrous-amer/f4302fdc8b8b039a248900f6b7ab3ea0 to your computer and use it in GitHub Desktop.
Save mahrous-amer/f4302fdc8b8b039a248900f6b7ab3ea0 to your computer and use it in GitHub Desktop.

Docker default address pooling

Default settings

{
 "default-address-pools" : [
 {
 "base" : "172.17.0.0/12",
 "size" : 16
 },
 {
 "base" : "192.168.0.0/16",
 "size" : 20
 }
 ]
}

Note: Only 32 bridge networks can fit in the available space. Why? Glad you asked.

Pool definition 1

{
 "base" : "172.17.0.0/12",
 "size" : 16
},

base:

  • hex: AC.11.00.00
  • /12:
    • netmask: FF.F0.00.00
    • total range: __._0.00.00 to __._F.FF.FF

size:

  • netmask for a given subnet: FF.FF.00.00
  • total range: __.__.00.00 to __.__.FF.FF

In binary nnnn nnnn.nnnn ????.hhhh hhhh.hhhh hhhh

  • n: these bits are the prefix for the whole network
  • h: For a given subnet of the whole network, these bits uniquely identify a given host
  • ?: These bits uniquely identify a given subnet under the whole network.

2^4 = 16 unique combinations of subnets

Pool definition 2

{
 "base" : "192.168.0.0/16",
 "size" : 20
}

base:

  • hex: C0.A8.00.00
  • /16:
    • netmask: FF.FF.00.00
    • total range: __.__.00.00 to __.__.FF.FF

size:

  • netmask for a given subnet: FF.FF.F0.00
  • total range: __.__._0.00 to __.__._F.FF

In binary: nnnn nnnn.nnnn nnnn.???? hhhh.hhhh hhhh

2^4 = 16 unique combinations of subnets

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment