egress-gateway.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. =====================================
  2. Egress Gateway
  3. =====================================
  4. Introduction
  5. ===============
  6. .. image:: images/egress1.png
  7. :width: 80%
  8. :alt: Gateway
  9. :align: center
  10. Netmaker allows your clients to reach external networks via an Egress Gateway. The Egress Gateway is a netclient which has been deployed to a server or router with access to a given subnet.
  11. In the netmaker UI, that node is set as an "egress gateway." Range(s) are specified which this node has access to. Once created, all clients (and all new ext clients) in the network will be able to reach those ranges via the gateway.
  12. Configuring an Egress Gateway
  13. ==================================
  14. Configuring an Egress Gateway is very straight forward. As a prerequisite, you must know what you are trying to access remotely. For instance:
  15. - a VPC
  16. - a Kubernetes network
  17. - a home network
  18. - an office network
  19. - a data center
  20. After you have determined this, you must next deploy a netclient in a compatible location where the network is accessible. For instance, a Linux server or router in the office, or a Kubernetes worker node. This machine should be stable and relatively static (not expected to change its IP frequently or shut down unexpectedly).
  21. Next, you must determine which interface to use in order to reach the internal network. As an example, lets say there is a machine in the network at 10.10.10.2, and you have deployed the netclient on a different machine. You can run
  22. .. code-block::
  23. ip route get 10.10.10.2
  24. This should return the interface used to reach that address (e.x. "eth2")
  25. Finally, once you have determined the interface, the subnet, and deployed your netclient, you can go to your Netmaker UI and set the node as a gateway.
  26. .. image:: images/egress7.png
  27. :width: 80%
  28. :alt: Gateway
  29. :align: center
  30. At this point simply insert the range(s) into the first field, and the interface name into the second field, and click "create".
  31. .. image:: images/ui-6.jpg
  32. :width: 80%
  33. :alt: Gateway
  34. :align: center
  35. Netmaker will set iptables rules on the node, which will then implement these rules, allowing it to route traffic from the network to the specified range(s).
  36. Use Cases
  37. ============
  38. 1) Remote Access
  39. -------------------
  40. A common scenario would be to combine this with an "Ingress Gateway" to create a simple method for accessing a home or office network. Such a setup would typically have only two nodes: the ingress and egress gateways. The Ingress Gateway should usually be globally accessible, which makes the Netmaker server itself a good candidate. This means you need only the netmaker server as the Ingress, and one additional machine (in the private network you wish to reach), as the Egress.
  41. .. image:: images/egress2.png
  42. :width: 80%
  43. :alt: Gateway
  44. :align: center
  45. In some scenarios, a single node will act as both ingress and egress! For instance, you can enable acess to a VPC using your Netmaker server, deployed with a public IP. Traffic comes in over the public IP (encrypted of course) and then routes to the VPC subnet via the egress gateway.
  46. .. image:: images/egress3.png
  47. :width: 50%
  48. :alt: Gateway
  49. :align: center
  50. 2) VPN / NAT Gateway
  51. -----------------------
  52. Most people think of a VPN as a remote server that keeps your internet traffic secure while you browse the web, or as a tool for accessing internet services in another country,using a VPN server based in that country.
  53. These are not typical use cases for Netmaker, but can be easily enabled.
  54. **The most important note is this: Do not use 0.0.0.0/0 as your egress gateway.** This is how you typically set up a "standard" VPN with WireGuard, however, it will not work with Netmaker. The Netclient specifically ignores gateways that overlap with local ranges (for efficiency ranges). 0.0.0.0 overlaps with everything, so it is always ignored.
  55. Instead, use the following list of ranges:
  56. .. code-block::
  57. 0.0.0.0/5,8.0.0.0/7,11.0.0.0/8,12.0.0.0/6,16.0.0.0/4,32.0.0.0/3,64.0.0.0/2,128.0.0.0/3,160.0.0.0/5,168.0.0.0/6,172.0.0.0/12,172.32.0.0/11,172.64.0.0/10,172.128.0.0/9,173.0.0.0/8,174.0.0.0/7,176.0.0.0/4,192.0.0.0/9,192.128.0.0/11,192.160.0.0/13,192.169.0.0/16,192.170.0.0/15,192.172.0.0/14,192.176.0.0/12,192.192.0.0/10,193.0.0.0/8,194.0.0.0/7,196.0.0.0/6,200.0.0.0/5,208.0.0.0/4
  58. This list encompasses the standard "public" network ranges, and ignores the standard "private" network ranges.
  59. Simply paste this list into your "egress gateway ranges" and your clients should begin routing public-facing traffic over the gateway.
  60. .. image:: images/egress5.png
  61. :width: 50%
  62. :alt: Gateway
  63. :align: center