fixed formatting for wp and spellcheck
This commit is contained in:
1 parent
d68c1a8187
commit
b3b93b28df
37 files changed
+283
-120
No files matched your search
@@ -27,11 +27,12 @@ Where,
|
||||
* The second line configures the Weave Net environment, so that containers launched via the Docker command line are automatically attached to the Weave network, and,
|
||||
* The third line runs the application container using [Docker commands](https://docs.Docker.com/engine/reference/commandline/daemon/).
|
||||
|
||||
>>**Note:** If the first command results in an error like
|
||||
>**Note:** If the first command results in an error like
|
||||
`http:///var/run/Docker.sock/v1.19/containers/create: dial unix
|
||||
/var/run/Docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?` then you likely need to be 'root' in order to connect to the Docker daemon. If so, run the above and all subsequent commands in a *single* root shell (e.g. one created with `sudo -s`). Do *not* prefix individual commands with `sudo`, since some commands modify environment entries and hence they all need to be executed from the same shell.
|
||||
|
||||
|
||||
>>**Important!** if you are running the Weave Docker Network Plugin do not run `eval $(weave env)`. See [Using the Weave Net Docker Network Plugin](/site/pluing/weave-plugin-how-to.md) for more information.
|
||||
>**Important!** if you are running the Weave Docker Network Plugin do not run `eval $(weave env)`. See [Using the Weave Net Docker Network Plugin](/site/pluing/weave-plugin-how-to.md) for more information.
|
||||
|
||||
Weave Net must be launched once per host. The relevant container images will be pulled down from Docker Hub on demand during `weave launch`.
|
||||
|
||||
@@ -52,7 +53,7 @@ As noted above, the same steps are repeated for `$HOST2`. The only difference, b
|
||||
|
||||
You can also peer with other hosts by specifying the IP address, and a `:port` by which `$HOST2` can reach `$HOST1`.
|
||||
|
||||
>>**Note:** If there is a firewall between `$HOST1` and `$HOST2`, you must permit traffic to flow through TCP 6783 and UDP 6783/6798, which are Weave’s control nd data ports.
|
||||
>**Note:** If there is a firewall between `$HOST1` and `$HOST2`, you must permit traffic to flow through TCP 6783 and UDP 6783/6798, which are Weave’s control and data ports.
|
||||
|
||||
There are a number of different ways that you can specify peers on a Weave network. You can launch Weave Net on `$HOST1` and then peer with `$HOST2`, or you can launch on `$HOST2` and peer with `$HOST1` or you can tell both hosts about each other at launch. The order in which peers are specified is not important. Weave Net automatically (re)connects to peers when they become available.
|
||||
|
||||
@@ -61,6 +62,7 @@ There are a number of different ways that you can specify peers on a Weave netwo
|
||||
To specify multiple peers, supply a list of addresses to which you want to connect, all separated by spaces.
|
||||
|
||||
For example:
|
||||
|
||||
~~~bash
|
||||
`host2$:weave launch` <ip address> <ip address>
|
||||
~~~
|
||||
@@ -74,19 +76,24 @@ With two containers running on separate hosts, test that both containers are abl
|
||||
|
||||
From the container started on `$HOST1`...
|
||||
|
||||
|
||||
~~~bash
|
||||
root@a1:/# ping -c 1 -q a2
|
||||
PING a2.weave.local (10.40.0.2) 56(84) bytes of data.
|
||||
--- a2.weave.local ping statistics ---
|
||||
1 packets transmitted, 1 received, 0% packet loss, time 0ms
|
||||
rtt min/avg/max/mdev = 0.341/0.341/0.341/0.000 ms
|
||||
~~~
|
||||
|
||||
Similarly, in the container started on `$HOST2`...
|
||||
|
||||
~~~bash
|
||||
root@a2:/# ping -c 1 -q a1
|
||||
PING a1.weave.local (10.32.0.2) 56(84) bytes of data.
|
||||
--- a1.weave.local ping statistics ---
|
||||
1 packets transmitted, 1 received, 0% packet loss, time 0ms
|
||||
rtt min/avg/max/mdev = 0.366/0.366/0.366/0.000 ms
|
||||
~~~
|
||||
|
||||
###<a name="start-netcat"></a>Starting the Netcat Service
|
||||
|
||||
|
||||
@@ -8,9 +8,11 @@ When containers may not know the network to which they will be attached, Weave N
|
||||
|
||||
To illustrate...
|
||||
|
||||
~~~bash
|
||||
host1$ C=$(docker run -e WEAVE_CIDR=none -dti ubuntu)
|
||||
host1$ weave attach $C
|
||||
10.2.1.3
|
||||
~~~
|
||||
|
||||
where,
|
||||
|
||||
@@ -24,31 +26,39 @@ where,
|
||||
|
||||
A container can be detached from a subnet, by using the `weave detach` command:
|
||||
|
||||
~~~bash
|
||||
host1$ weave detach $C
|
||||
10.2.1.3
|
||||
~~~
|
||||
|
||||
You can also detach a container from one network and then attach it to a different one:
|
||||
|
||||
~~~bash
|
||||
host1$ weave detach net:default $C
|
||||
10.2.1.3
|
||||
host1$ weave attach net:10.2.2.0/24 $C
|
||||
10.2.2.3
|
||||
~~~
|
||||
|
||||
or, attach a container to multiple application networks, effectively sharing the same container between applications:
|
||||
|
||||
~~~bash
|
||||
host1$ weave attach net:default
|
||||
10.2.1.3
|
||||
host1$ weave attach net:10.2.2.0/24
|
||||
10.2.2.3
|
||||
~~~
|
||||
|
||||
Finally, multiple addresses can be attached or detached using a single command:
|
||||
|
||||
~~~bash
|
||||
host1$ weave attach net:default net:10.2.2.0/24 net:10.2.3.0/24 $C
|
||||
10.2.1.3 10.2.2.3 10.2.3.1
|
||||
host1$ weave detach net:default net:10.2.2.0/24 net:10.2.3.0/24 $C
|
||||
10.2.1.3 10.2.2.3 10.2.3.1
|
||||
~~~
|
||||
|
||||
>>**Important!** Any addresses that were dynamically attached will not be re-attached if the container restarts.
|
||||
>**Important!** Any addresses that were dynamically attached will not be re-attached if the container restarts.
|
||||
|
||||
**See Also**
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@ To accomplish this, launch Weave Net onto the new host
|
||||
without supplying any additional addresses. And then, from one
|
||||
of the existing hosts run:
|
||||
|
||||
~~~bash
|
||||
host# weave connect $NEW_HOST
|
||||
~~~
|
||||
|
||||
Other hosts on the Weave network will automatically attempt
|
||||
to establish connections to the new host as well.
|
||||
@@ -29,17 +31,21 @@ Alternatively, you can also instruct a peer to forget a
|
||||
particular host specified to it via `weave launch` or
|
||||
`weave connect` by running:
|
||||
|
||||
~~~bash
|
||||
host# weave forget $DECOMMISSIONED_HOST
|
||||
~~~
|
||||
|
||||
This prevents the peer from trying to reconnect to that host
|
||||
once connectivity to it is lost, and therfore can be used
|
||||
once connectivity to it is lost, and therefore can be used
|
||||
to administratively remove any decommissioned peers
|
||||
from the network.
|
||||
|
||||
Hosts may also be bulk-replaced. All existing hosts
|
||||
will be forgotten, and the new hosts will be added:
|
||||
|
||||
~~~bash
|
||||
host# weave connect --replace $NEW_HOST1 $NEW_HOST2
|
||||
~~~
|
||||
|
||||
For complete control over the peer topology, automatic
|
||||
discovery can be disabled using the `--no-discovery`
|
||||
@@ -50,9 +56,11 @@ addresses specified at launch time and with `weave connect`.
|
||||
|
||||
A list of all hosts that a peer has been asked to connect
|
||||
to with `weave launch` and `weave connect`
|
||||
can be obtained with
|
||||
can be obtained using:
|
||||
|
||||
~~~bash
|
||||
host# weave status targets
|
||||
~~~
|
||||
|
||||
**See Also**
|
||||
|
||||
|
||||
@@ -9,36 +9,44 @@ For example, returning to the [netcat example](/site/using-weave/deploying-appli
|
||||
|
||||
On `$HOST2` run:
|
||||
|
||||
~~~bash
|
||||
host2$ weave expose
|
||||
10.2.1.132
|
||||
~~~
|
||||
|
||||
This command grants the host access to all of the application containers in the default subnet. An IP address is allocated by Weave Net especially for that purpose, and is returned after running `weave expose`.
|
||||
|
||||
Now you are able to ping the host:
|
||||
|
||||
~~~bash
|
||||
host2$ ping 10.2.1.132
|
||||
~~~
|
||||
|
||||
And you can also ping the `a1` netcat application container residing on `$HOST1`:
|
||||
|
||||
~~~bash
|
||||
host2$ ping $(weave dns-lookup a1)
|
||||
|
||||
~~~
|
||||
|
||||
###Exposing Multiple Subnets
|
||||
|
||||
Multiple subnet addresses can be exposed or hidden using a single command:
|
||||
|
||||
~~~bash
|
||||
host2$ weave expose net:default net:10.2.2.0/24
|
||||
10.2.1.132 10.2.2.130
|
||||
host2$ weave hide net:default net:10.2.2.0/24
|
||||
10.2.1.132 10.2.2.130
|
||||
|
||||
~~~
|
||||
|
||||
###Adding Exposed Addresses to weavedns
|
||||
|
||||
Exposed addresses can also be added to `weavedns` by supplying fully qualified domain names:
|
||||
|
||||
~~~bash
|
||||
host2$ weave expose -h exposed.weave.local
|
||||
10.2.1.132
|
||||
~~~
|
||||
|
||||
|
||||
**See Also**
|
||||
|
||||
@@ -66,9 +66,9 @@ Where,
|
||||
|
||||
*`net:default` is used to request the allocation of an address from the default subnet in addition to one from an explicitly specified range.
|
||||
|
||||
>>Note: By default Docker permits communication between containers on the same host, via their Docker-assigned IP addresses. For complete isolation between application containers, that feature _must_ to be disabled by [setting `--icc=false`](https://docs.Docker.com/engine/userguide/networking/default_network/container-communication/#communication-between-containers) in the Docker daemon configuration.
|
||||
>Note: By default Docker permits communication between containers on the same host, via their Docker-assigned IP addresses. For complete isolation between application containers, that feature _must_ to be disabled by [setting `--icc=false`](https://docs.Docker.com/engine/userguide/networking/default_network/container-communication/#communication-between-containers) in the Docker daemon configuration.
|
||||
|
||||
>>**Important:!** Containers must not be allowed to capture and inject raw network packets. This can be prevented by starting the containers with the `--cap-drop net_raw` option.
|
||||
>**Important:!** Containers must not be allowed to capture and inject raw network packets. This can be prevented by starting the containers with the `--cap-drop net_raw` option.
|
||||
|
||||
**See Also**
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@ layout: default
|
||||
|
||||
Containers are automatically allocated an IP address that is unique across the Weave network. You can see which address was allocated by running, [`weave ps`](/site/troubleshooting.md#weave-status):
|
||||
|
||||
~~~bash
|
||||
host1$ weave ps a1
|
||||
a7aee7233393 7a:44:d3:11:10:70 10.32.0.2/12
|
||||
~~~
|
||||
|
||||
Weave Net detects when a container has exited and releases its allocated addresses so they can be re-used by the network.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ the `WEAVE_PORT` setting. For example, if WEAVE_PORT is
|
||||
set to `9000`, then Weave uses TCP 9000 for its control
|
||||
port and UDP 9000/9001 for its data port.
|
||||
|
||||
>>**Important!** It is recommended that all peers be given
|
||||
>**Important!** It is recommended that all peers be given
|
||||
the same setting.
|
||||
|
||||
|
||||
|
||||
@@ -8,12 +8,16 @@ To connect containers across untrusted networks, Weave Net peers can be instruct
|
||||
|
||||
For example:
|
||||
|
||||
~~~bash
|
||||
host1$ weave launch --password wfvAwt7sj
|
||||
~~~
|
||||
|
||||
or
|
||||
|
||||
~~~bash
|
||||
host1$ export WEAVE_PASSWORD=wfvAwt7sj
|
||||
host1$ weave launch
|
||||
~~~
|
||||
|
||||
>NOTE: The command line option takes precedence over the environment variable._
|
||||
|
||||
@@ -24,7 +28,9 @@ or
|
||||
|
||||
To guard against dictionary attacks, the password needs to be reasonably strong with at least 50 bits of entropy is recommended. An easy way to generate a random password that satisfies this requirement is:
|
||||
|
||||
~~~bash
|
||||
< /dev/urandom tr -dc A-Za-z0-9 | head -c9 ; echo
|
||||
~~~
|
||||
|
||||
The same password must be specified for all Weave Net peers, by default both control and data plane traffic will then use authenticated encryption.
|
||||
|
||||
@@ -32,9 +38,9 @@ Fast datapath does not support encryption. If you supply a
|
||||
password at `weave launch` the router falls back to a slower
|
||||
`sleeve` mode that does support encryption.
|
||||
|
||||
If some of your peers are co-located in a trusted network (for example within the boundary of your own datacenter) you can use the `--trusted-subnets` argument to `weave launch` to selectively disable data plane encryption as an optimization.
|
||||
If some of your peers are co-located in a trusted network (for example within the boundary of your own data center) you can use the `--trusted-subnets` argument to `weave launch` to selectively disable data plane encryption as an optimization.
|
||||
|
||||
>>**Note:** Both peers must consider the other to be in a trusted subnet for this to take place - if they do not agree, Weave Net [falls back to a slower method](/site/fastdp/using-fastdp.md) for transporting data between peers, since fast datapath does not support encryption.
|
||||
>**Note:** Both peers must consider the other to be in a trusted subnet for this to take place - if they do not agree, Weave Net [falls back to a slower method](/site/fastdp/using-fastdp.md) for transporting data between peers, since fast datapath does not support encryption.
|
||||
|
||||
Be aware that:
|
||||
|
||||
|
||||
@@ -13,21 +13,27 @@ you can expose the netcat service running on `HOST1` and make it accessible to t
|
||||
|
||||
First, expose the application network to `$HOST2`, as explained in [Integrating a Host Network with a Weave Net](/site/using-weave/host-network-integration.md):
|
||||
|
||||
~~~bash
|
||||
host2$ weave expose
|
||||
10.2.1.132
|
||||
~~~
|
||||
|
||||
Then add a NAT rule that routes the traffic from the outside world to the destination container service.
|
||||
|
||||
~~~bash
|
||||
host2$ iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 2211 \
|
||||
-j DNAT --to-destination $(weave dns-lookup a1):4422
|
||||
~~~
|
||||
|
||||
In this example, it is assumed that the "outside world" is connecting to `$HOST2` via 'eth0'. The TCP traffic to port 2211 on the external IPs will be routed to the 'nc' service running on port 4422 in the container a1.
|
||||
|
||||
With the above in place, you can connect to the 'nc' service from anywhere using:
|
||||
|
||||
~~~bash
|
||||
echo 'Hello, world.' | nc $HOST2 2211
|
||||
~~~
|
||||
|
||||
>>**Note:** Due to the way routing is handled in the Linux kernel, this won't work when run *on* `$HOST2`.
|
||||
>**Note:** Due to the way routing is handled in the Linux kernel, this won't work when run *on* `$HOST2`.
|
||||
|
||||
Similar NAT rules to the above can be used to expose services not just to the outside world but also to other, internal, networks.
|
||||
|
||||
|
||||
@@ -21,25 +21,30 @@ Turning back to the [netcat example](/site/using-weave/deploying-applications.md
|
||||
|
||||
To do this, expose the application network to `$HOST2`, as explained in [Host Network Integration](/site/using-weave/host-network-integration.md) by running:
|
||||
|
||||
~~~bash
|
||||
host2$ weave expose
|
||||
10.2.1.132
|
||||
~~~
|
||||
|
||||
Then add a NAT rule to route from the outside world to the destination container service.
|
||||
|
||||
~~~bash
|
||||
host2$ iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 2211 \
|
||||
-j DNAT --to-destination $(weave dns-lookup a1):4422
|
||||
~~~
|
||||
|
||||
Here it is assumed that the "outside world" is connecting to `$HOST2` via 'eth0'. The TCP traffic to port 2211 on the external IPs will be routed to the 'nc' service, running in the a1 container and listening on port 4422.
|
||||
With the above in place, you are ready to connect to the 'nc' service from anywhere using:
|
||||
|
||||
~~~bash
|
||||
echo 'Hello, world.' | nc $HOST2 2211
|
||||
~~~
|
||||
|
||||
>>**Note:** Due to the way routing is handled in the Linux kernel, this won't work when run *on* `$HOST2`.
|
||||
>**Note:** Due to the way routing is handled in the Linux kernel, this won't work when run *on* `$HOST2`.
|
||||
|
||||
Similar NAT rules to the above can used to expose services not just to the outside world but also other, internal, networks.
|
||||
|
||||
|
||||
|
||||
###<a name="importing"></a>Importing Services
|
||||
|
||||
Applications running in containers on a Weave network can be given access to services, which are only reachable from certain
|
||||
@@ -51,22 +56,30 @@ An additional caveat is that `$HOST3` can only be reached from `$HOST1`, which i
|
||||
|
||||
To satisfy this scenario, first [expose the application network to the host](/site/using-weave/host-network-integration.md) by running the following on `$HOST1`:
|
||||
|
||||
~~~bash
|
||||
host1$ weave expose -h host1.weave.local
|
||||
10.2.1.3
|
||||
~~~
|
||||
|
||||
Then add a NAT rule, which routes from the above IP to the destination service.
|
||||
|
||||
~~~bash
|
||||
host1$ iptables -t nat -A PREROUTING -p tcp -d 10.2.1.3 --dport 3322 \
|
||||
-j DNAT --to-destination $HOST3:2211
|
||||
~~~
|
||||
|
||||
This allows any application container to reach the service by connecting to 10.2.1.3:3322. So if `$HOST3` is running a
|
||||
netcat service on port 2211:
|
||||
|
||||
~~~bash
|
||||
host3$ nc -lk -p 2211
|
||||
~~~
|
||||
|
||||
You can now connect to it from the application container running on `$HOST2` using:
|
||||
|
||||
~~~bash
|
||||
root@a2:/# echo 'Hello, world.' | nc host1 3322
|
||||
~~~
|
||||
|
||||
Note that you should be able to run this command from any application container.
|
||||
|
||||
@@ -88,18 +101,23 @@ Expanding on the [netcat example](/site/using-weave/deploying-applications.md),
|
||||
|
||||
Begin importing the service onto `$HOST2` by first exposing the application network:
|
||||
|
||||
~~~bash
|
||||
host2$ weave expose
|
||||
10.2.1.3
|
||||
~~~
|
||||
|
||||
Then add a NAT rule which routes traffic from the `$HOST2` network (for example, anything that can connect to `$HOST2`) to the service endpoint on the Weave network:
|
||||
|
||||
~~~bash
|
||||
host2$ iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 4433 \
|
||||
-j DNAT --to-destination 10.2.1.3:3322
|
||||
~~~
|
||||
|
||||
Now any host on the same network as `$HOST2` is able to access the service:
|
||||
|
||||
~~~bash
|
||||
echo 'Hello, world.' | nc $HOST2 4433
|
||||
|
||||
~~~
|
||||
|
||||
###<a name="change-location"></a>Dynamically Changing Service Locations
|
||||
|
||||
|
||||
Reference in new issue
Block a user