Переглянути джерело

Adding additional documentation for fixed-cidr networking

Docker-DCO-1.1-Signed-off-by: Frederick F. Kautz IV <fkautz@alumni.cmu.edu> (github: fkautz)

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Frederick F. Kautz IV 11 роки тому
батько
коміт
3bb12d390a

+ 1 - 1
daemon/config.go

@@ -51,7 +51,7 @@ func (config *Config) InstallFlags() {
 	flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
 	flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
 	flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b")
 	flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b")
 	flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge\nuse 'none' to disable container networking")
 	flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge\nuse 'none' to disable container networking")
-	flag.StringVar(&config.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs (ex: 10.20.0.0/16)\nthis subnet must be nested in bridge subnet (which is defined by -b or --bip)")
+	flag.StringVar(&config.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs (ex: 10.20.0.0/16)\nthis subnet must be nested in the bridge subnet (which is defined by -b or --bip)")
 	flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
 	flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
 	flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Force the Docker runtime to use a specific storage driver")
 	flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Force the Docker runtime to use a specific storage driver")
 	flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Force the Docker runtime to use a specific exec driver")
 	flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Force the Docker runtime to use a specific exec driver")

+ 4 - 0
docs/man/docker.1.md

@@ -49,6 +49,10 @@ unix://[/path/to/socket] to use.
 **-g**=""
 **-g**=""
   Path to use as the root of the Docker runtime. Default is `/var/lib/docker`.
   Path to use as the root of the Docker runtime. Default is `/var/lib/docker`.
 
 
+
+**--fixed-cidr**=""
+  IPv4 subnet for fixed IPs (ex: 10.20.0.0/16); this subnet must be nested in the bridge subnet (which is defined by \-b or \-\-bip)
+
 **--icc**=*true*|*false*
 **--icc**=*true*|*false*
   Enable inter\-container communication. Default is true.
   Enable inter\-container communication. Default is true.
 
 

+ 17 - 6
docs/sources/articles/networking.md

@@ -54,6 +54,9 @@ server when it starts up, and cannot be changed once it is running:
  *  `--bip=CIDR` — see
  *  `--bip=CIDR` — see
     [Customizing docker0](#docker0)
     [Customizing docker0](#docker0)
 
 
+ *  `--fixed-cidr` — see
+    [Customizing docker0](#docker0)
+
  *  `-H SOCKET...` or `--host=SOCKET...` —
  *  `-H SOCKET...` or `--host=SOCKET...` —
     This might sound like it would affect container networking,
     This might sound like it would affect container networking,
     but it actually faces in the other direction:
     but it actually faces in the other direction:
@@ -365,17 +368,25 @@ By default, the Docker server creates and configures the host system's
 can pass packets back and forth between other physical or virtual
 can pass packets back and forth between other physical or virtual
 network interfaces so that they behave as a single Ethernet network.
 network interfaces so that they behave as a single Ethernet network.
 
 
-Docker configures `docker0` with an IP address and netmask so the host
-machine can both receive and send packets to containers connected to the
-bridge, and gives it an MTU — the *maximum transmission unit* or largest
-packet length that the interface will allow — of either 1,500 bytes or
-else a more specific value copied from the Docker host's interface that
-supports its default route.  Both are configurable at server startup:
+Docker configures `docker0` with an IP address, netmask and IP
+allocation range. The host machine can both receive and send packets to
+containers connected to the bridge, and gives it an MTU — the *maximum
+transmission unit* or largest packet length that the interface will
+allow — of either 1,500 bytes or else a more specific value copied from
+the Docker host's interface that supports its default route.  These
+options are configurable at server startup:
 
 
  *  `--bip=CIDR` — supply a specific IP address and netmask for the
  *  `--bip=CIDR` — supply a specific IP address and netmask for the
     `docker0` bridge, using standard CIDR notation like
     `docker0` bridge, using standard CIDR notation like
     `192.168.1.5/24`.
     `192.168.1.5/24`.
 
 
+ *  `--fixed-cidr=CIDR` — restrict the IP range from the `docker0` subnet,
+    using the standard CIDR notation like `172.167.1.0/28`. This range must
+    be and IPv4 range for fixed IPs (ex: 10.20.0.0/16) and must be a subset
+    of the bridge IP range (`docker0` or set using `--bridge`). For example
+    with `--fixed-cidr=192.168.1.0/25`, IPs for your containers will be chosen
+    from the first half of `192.168.1.0/24` subnet.
+
  *  `--mtu=BYTES` — override the maximum packet length on `docker0`.
  *  `--mtu=BYTES` — override the maximum packet length on `docker0`.
 
 
 On Ubuntu you would add these to the `DOCKER_OPTS` setting in
 On Ubuntu you would add these to the `DOCKER_OPTS` setting in

+ 1 - 0
docs/sources/reference/commandline/cli.md

@@ -55,6 +55,7 @@ expect an integer, and they can only be specified once.
                                                    use 'none' to disable container networking
                                                    use 'none' to disable container networking
       --bip=""                                   Use this CIDR notation address for the network bridge's IP, not compatible with -b
       --bip=""                                   Use this CIDR notation address for the network bridge's IP, not compatible with -b
       --fixed-cidr=""                            IPv4 subnet for fixed IPs (ex: 10.20.0.0/16)
       --fixed-cidr=""                            IPv4 subnet for fixed IPs (ex: 10.20.0.0/16)
+                                                   this subnet must be nested in the bridge subnet (which is defined by -b or --bip)
       -D, --debug=false                          Enable debug mode
       -D, --debug=false                          Enable debug mode
       -d, --daemon=false                         Enable daemon mode
       -d, --daemon=false                         Enable daemon mode
       --dns=[]                                   Force Docker to use specific DNS servers
       --dns=[]                                   Force Docker to use specific DNS servers