From c01265047667ec60aa82983e25f3001c10947733 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 27 Apr 2016 11:36:28 +0100 Subject: [PATCH 1/3] make service export section match whats in the separate doc --- site/using-weave/service-management.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/site/using-weave/service-management.md b/site/using-weave/service-management.md index 8024a267..6a5e4745 100644 --- a/site/using-weave/service-management.md +++ b/site/using-weave/service-management.md @@ -15,29 +15,33 @@ This section contains the following topics: ### Exporting Services -Services running in containers on a Weave network can be made accessible to the outside world (and, more generally, to other networks) from any Weave host, regardless of where the service containers are located. +Services running in containers on a Weave network can be made +accessible to the outside world (and, more generally, to other networks) +from any Weave Net host, irrespective of where the service containers are +located. -Turning back to the [netcat example](/site/using-weave.md), say you want the netcat service, which is running in a container on `$HOST1`, to be accessible to the outside world via `$HOST2`. +Returning to the [netcat example service](/site/using-weave.md), +you can expose the netcat service running on `HOST1` and make it accessible to the outside world via `$HOST2`. -To do this, expose the application network to `$HOST2`, as explained in [Host Network Integration](/site/using-weave/host-network-integration.md) by running: +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): host2$ weave expose 10.2.1.132 -Then add a NAT rule to route from the outside world to the destination container service. +Then add a NAT rule that routes the traffic from the outside world to the destination container service. 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: +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. - $ echo 'Hello, world.' | nc $HOST2 2211 +With the above in place, you can connect to the 'nc' service from anywhere using: + + 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`. -Similar NAT rules to the above can used to expose services not just to the outside world but also other, internal, networks. - +Similar NAT rules to the above can be used to expose services not just to the outside world but also to other, internal, networks. ###Importing Services From 14a3898371889bbf7d6567d144ab5a2a3d62df17 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 27 Apr 2016 11:53:03 +0100 Subject: [PATCH 2/3] remove service-export doc since it duplicates content ...and update links accordingly. --- site/faq.md | 4 +-- site/using-weave/application-isolation.md | 1 - site/using-weave/service-export.md | 39 ----------------------- 3 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 site/using-weave/service-export.md diff --git a/site/faq.md b/site/faq.md index 3acc3e2f..3c8c5d9c 100644 --- a/site/faq.md +++ b/site/faq.md @@ -22,7 +22,7 @@ For more information, refer to [Manually Specifying the IP Address of a Containe **Q: How do I expose one of my containers to the outside world?** -Exposing a container to the outside world is described in [Exposing Services to the Outside](/site/using-weave/service-export.md). +Exposing a container to the outside world is described in [Exporting Services](/site/using-weave/service-management.md#exporting). **Q: Can I connect my existing 'legacy' network with a Weave container network?** @@ -33,7 +33,7 @@ For example, you have a Weave network that runs on hosts A, B, C. and you have a The simplest way to accomplish this would be to run Weave on the host and then run, `weave expose` to expose the network to any running containers. See [Integrating a Network Host](/site/using-weave/host-network-integration.md) If this is not possible, you could also expose a port on the container on host B and then connect to it. -You can read about exposing ports in [Service Exporting](/site/using-weave/service-export.md). +You can read about exposing ports in [Exporting Services](/site/using-weave/service-management.md#exporting). **Q: Why am I seeing the same IP address assigned to two different containers on different hosts?** diff --git a/site/using-weave/application-isolation.md b/site/using-weave/application-isolation.md index 49246295..4bbc3115 100644 --- a/site/using-weave/application-isolation.md +++ b/site/using-weave/application-isolation.md @@ -67,4 +67,3 @@ isolation between application containers, that feature needs to be disabled by [ * [Automatic Allocation Across Multiple Subnets](/site/ipam/allocation-multi-ipam.md) * [Managing Services in Weave Net: Exporting, Importing, Binding and Routing](/site/using-weave/service-management.md) - * [Exposing Services to the Outside World] (/site/using-weave/service-export.md) diff --git a/site/using-weave/service-export.md b/site/using-weave/service-export.md deleted file mode 100644 index 52312318..00000000 --- a/site/using-weave/service-export.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: Exposing Services to the Outside World -menu_order: 70 ---- - -Services running in containers on a Weave network can be made -accessible to the outside world (and, more generally, to other networks) -from any Weave Net host, irrespective of where the service containers are -located. - -Returning to the [netcat example service](/site/using-weave.md), -you can expose the netcat service running on `HOST1` and make it accessible to the outside world via `$HOST2`. - -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): - - 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. - - 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: - - 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`. - -Similar NAT rules to the above can be used to expose services not just to the outside world but also to other, internal, networks. - - - -**See Also** - - * [Using Weave Net](/site/using-weave.md) - * [Managing Services in Weave Net: Exporting, Importing, Binding and Routing](/site/using-weave/service-management.md) From 65ecac6f1a443d2a502e30fad41d24b81c4e6d32 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 27 Apr 2016 11:54:23 +0100 Subject: [PATCH 3/3] cosmetic: consistency --- site/using-weave/service-management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/using-weave/service-management.md b/site/using-weave/service-management.md index 6a5e4745..f4921d4c 100644 --- a/site/using-weave/service-management.md +++ b/site/using-weave/service-management.md @@ -13,7 +13,7 @@ This section contains the following topics: -### Exporting Services +###Exporting Services Services running in containers on a Weave network can be made accessible to the outside world (and, more generally, to other networks)