From 7b01dd979493698f6ab7c9b8f7455cc91cabb857 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 4 Nov 2015 16:45:16 +0000 Subject: [PATCH 1/3] Drop use of interval notation --- net/address/address.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/address/address.go b/net/address/address.go index 291a3227..71e00716 100644 --- a/net/address/address.go +++ b/net/address/address.go @@ -19,7 +19,7 @@ func NewRange(start Address, size Offset) Range { return Range{Start: start, End: Add(start, size)} } func (r Range) Size() Offset { return Subtract(r.End, r.Start) } -func (r Range) String() string { return fmt.Sprintf("[%s-%s)", r.Start, r.End) } +func (r Range) String() string { return fmt.Sprintf("%s-%s", r.Start, r.End-1) } func (r Range) Overlaps(or Range) bool { return !(r.Start >= or.End || r.End <= or.Start) } func (r Range) Contains(addr Address) bool { return addr >= r.Start && addr < r.End } From e03a45f8c57fd6c10537494b5db9110e04a757e7 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 4 Nov 2015 16:55:01 +0000 Subject: [PATCH 2/3] Update docs to match loss of interval notation --- site/ipam.md | 6 +----- site/troubleshooting.md | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/site/ipam.md b/site/ipam.md index f06e4106..f63ad873 100644 --- a/site/ipam.md +++ b/site/ipam.md @@ -208,7 +208,7 @@ reports on the current status of the weave router and IP allocator: Service: ipam Consensus: waiting(quorum: 2, known: 0) - Range: [10.32.0.0-10.48.0.0) + Range: 10.32.0.0-10.47.255.255 DefaultSubnet: 10.32.0.0/12 ... @@ -219,7 +219,3 @@ guide](troubleshooting.html#weave-status) for full details. The 'Service: ipam' section displays the consensus state as well as the total allocation range and default subnet. - -Note that the 'Range' is written using interval notation - '[' means -the start of the range is included and ')' means the end of the range -is not included. diff --git a/site/troubleshooting.md b/site/troubleshooting.md index 9f691c1f..bc5bbb2b 100644 --- a/site/troubleshooting.md +++ b/site/troubleshooting.md @@ -81,7 +81,7 @@ $ weave status Service: ipam Consensus: achieved - Range: [10.32.0.0-10.48.0.0) + Range: 10.32.0.0-10.47.255.255 DefaultSubnet: 10.32.0.0/12 Service: dns From 5f4753f88100d4808aad702240f55028a6ed8f45 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 5 Nov 2015 10:13:06 +0000 Subject: [PATCH 3/3] Segregate discussion of range and subnet, and explain subnet a bit --- site/ipam.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/site/ipam.md b/site/ipam.md index f63ad873..7f19ffc5 100644 --- a/site/ipam.md +++ b/site/ipam.md @@ -109,9 +109,7 @@ The range parameter is written in [CIDR notation](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) - in this example "/16" means the first 16 bits of the address form the network address and the allocator is to allocate container addresses -that all start 10.2. The ".0" and ".-1" addresses in a subnet are not -used, as required by -[RFC 1122](https://tools.ietf.org/html/rfc1122#page-29). +that all start 10.2. Weave shares the IP address range across all peers, dynamically according to their needs. If a group of peers becomes isolated from @@ -121,11 +119,16 @@ to the rest of the network without any conflicts arising. ## Automatic allocation across multiple subnets -When -[running containers on different subnets](features.html#application-isolation), -you may wish to request the allocation of an address from a particular -subnet. This is done by specifying the subnet with `net:`, in -CIDR notation, e.g. +IP subnets are used to define or restrict routing. By default, weave +puts all containers in a subnet that spans the entire allocation +range, so every weave-attached container can talk to every other +weave-attached container. + +If you want some [isolation](features.html#application-isolation), you +can choose to run containers on different subnets. To request the +allocation of an address from a particular subnet, set the +`WEAVE_CIDR` environment variable to `net:` when creating the +container, e.g. host1$ docker run -e WEAVE_CIDR=net:10.2.7.0/24 -ti ubuntu @@ -135,6 +138,9 @@ for instance: host1$ docker run -e WEAVE_CIDR="net:10.2.7.0/24 net:10.2.8.0/24 ip:10.3.9.1/24" -ti ubuntu +(Note the ".0" and ".-1" addresses in a subnet are not used, as required by +[RFC 1122](https://tools.ietf.org/html/rfc1122#page-29)). + When working with multiple subnets in this way, it is usually desirable to constrain the default subnet - i.e. the one chosen by the allocator when no subnet is supplied - so that it does not overlap