You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/architecture.rst
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,6 @@
1
1
Polycube Architecture
2
2
=====================
3
3
4
-
**NOTE: this file is outdated**
5
-
6
-
Polycube is a framework to **create** and **deploy** arbitrary virtual network functions, such as bridges, routers, NATs, firewalls and more, and enables the creation of complex **service chains** by connecting together the above modules.
7
-
8
-
It is based on the eBPF technology available in the Linux kernel and leverages some companion tools developed in the Iovisor community, such as [BCC](https://github.com/iovisor/bcc/).
9
-
10
4
The Polycube architecture is depicted below:
11
5
12
6
.. image:: images/architecture_overview.png
@@ -32,6 +26,7 @@ Each network function is implemented as a separated module and multiple flavors
32
26
Each service implementation includes the `datapath`, namely the eBPF code to be injected in the kernel, the `control/management plane`, which defines the primitives that allow to configure the service behavior, and the `slow path`, which handles packets that cannot be fully processed in the kernel. While the former code runs in the Linux kernel, the latter components are executed in user-space.
33
27
Given the feature-rich nature of the eBPF, the slow path should be rather small; an example can be the implementation of the spanning tree for 802.1Q bridges, which does not make sense to have in the kernel and that can stay in user space.
34
28
29
+
35
30
Polycubectl
36
31
-----------
37
32
This module implements the service-agnostic command-line interface (CLI) that allows to control the entire system, such as starting/stopping services, creating service instances (e.g., bridges `br1` and `br2`), and configuring / querying the internals of each single service (e.g., enabling the spanning tree on bridge `br1`).
Copy file name to clipboardExpand all lines: Documentation/developers/index.rst
+15-18Lines changed: 15 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,21 @@ Polycube Developers Guide
3
3
4
4
This guide represents an initial starting point for developers that want to implement new services (e.g., custom NAT, router, etc) using the Polycube software infrastructure.
5
5
6
+
7
+
.. toctree::
8
+
:maxdepth:2
9
+
:caption:Contents:
10
+
11
+
datapath
12
+
controlplane
13
+
datamodel
14
+
codegen
15
+
debugging
16
+
profiler
17
+
hints
18
+
19
+
20
+
6
21
How to create a new service / update an existing one
Copy file name to clipboardExpand all lines: Documentation/installation.rst
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
1
Installing Polycube
2
2
===================
3
3
4
-
This installation guide includes instructions to install polycube on ``Ubuntu 18.04``, however with few changes those should also work on other versions and distributions.
4
+
This installation guide includes instructions to install Polycube on ``Ubuntu 18.04``.
5
+
However those should also work on other versions and distributions with a few changes.
5
6
6
7
Dependencies
7
8
------------
8
9
9
-
``polycube`` requires following dependencies:
10
-
11
-
- At least **Linux kernel v4.15** that includes a set of the eBPF features which are needed by polycube
12
-
- **pistache**: a library to build rest API servers
13
-
- **libints**: a library for crafting packets (needed only for some services)
14
-
- **Go language**: required to run ``polycubectl`` (polycube command line interface)
10
+
Polycube requires following dependencies:
11
+
- At least **Linux kernel v4.15** that includes a set of the eBPF features which are needed by polycube
12
+
- **pistache**: a library to build rest API servers
13
+
- **libints**: a library for crafting packets (needed only for some services)
14
+
- **Go language**: required to run ``polycubectl`` (polycube command line interface)
15
15
16
16
Following sections will detail the installation process for the above components.
17
17
@@ -31,8 +31,8 @@ Use ``uname -a`` to check the kernel version you are running, if this is ``<v4.1
31
31
sudo dpkg -i *.deb
32
32
sudo reboot
33
33
34
-
Automatic installation
35
-
----------------------
34
+
Automatic installation from source files
35
+
----------------------------------------
36
36
37
37
If you are running ``Ubuntu 18.04`` and you do not want to manually install polycube and its dependencies, you can use the install script available under the `scripts` folder.
38
38
This is not guaranteed that the script works on versions or distributions other than ``Ubuntu 18.04``.
@@ -62,8 +62,9 @@ In this case, remove llvm 6.0 before starting the installation script:
Copy file name to clipboardExpand all lines: Documentation/services/pcn-nat/nat.rst
+56-30Lines changed: 56 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,19 +15,19 @@ Limitations
15
15
-----------
16
16
17
17
- Unsupported IPv6
18
-
- Unsupported ARP: the ARP messages will be forwarded without processing them
18
+
- Unsupported ARP: ARP messages are forwarded without any processing
19
19
- Incremental external port choice, starting from 1024 each time 65535 is reached
20
20
21
21
How to use
22
22
----------
23
23
24
-
The nat is a transparent service, it can be attached to a cube port or to a netdev.
25
-
The nat is intended to be used with a router, it could not work when attached to different services.
24
+
The NAT is a transparent service, it can be attached to a cube port or to a netdev.
25
+
The NAT is intended to be used with a router, it may not work when attached to different services.
26
26
27
27
Attached to a router
28
28
^^^^^^^^^^^^^^^^^^^^
29
29
30
-
When a nat instance is attached to a router the external IP is automatically configured.
30
+
When a NAT instance is attached to a router, the external IP is automatically configured.
31
31
32
32
::
33
33
@@ -53,31 +53,41 @@ Attached to a netdev
53
53
# TODO: there is not an API for it!
54
54
55
55
56
-
Rules
57
-
-----
56
+
Working modes
57
+
-------------
58
58
59
-
Adding rules
60
-
^^^^^^^^^^^^
61
59
62
60
Source NAT
63
-
**********
61
+
^^^^^^^^^^
62
+
63
+
Source NAT selects a given range of hosts (i.e., the ```internal-net```) to be translated with a given public IP address (i.e., the ```external-ip```).
64
+
Each time a new session originated from the internal network is recognized, the NAT creates a new binding also for return packets.
64
65
65
-
Available and mandatory fields for SNAT rules are
66
-
- ```internal-net```: the internal network to translate (e.g 10.0.0.0/24, 10.0.0.1/32)
67
-
- ```external-ip```: the external IP address (e.g. 1.2.3.4)
66
+
Source NAT enables users to specify exactly the range of addresses belonging to the ```internal-net```, e.g., excluding some hosts from being natted. In addition, it specifies exactly the external IP that has to be used, e.g., in case multiple external IP addresses are available.
67
+
68
+
Available and mandatory fields for SNAT rules are:
69
+
- ```internal-net```: the internal network to translate (e.g 10.0.0.0/24, 10.0.0.1/32)
70
+
- ```external-ip```: the external IP address (e.g. 1.2.3.4)
NAT masquerading is a simpler form of source NAT: it automatically translates the traffic of all hosts coming from the internal network with the IP address currently present on the external interface.
83
+
Hence, it requires a simpler configuration that is usually enough for most cases.
84
+
85
+
Unlike ```iptables``` in Linux, NAT masquerading in Polycube does not add extra overhead compared to SNAT.
86
+
In fact, the ```external-ip``` address is kept in a dedicated table in the data plane and it is automatically updated each time the actual IP address configured on the external virtual interface is changed.
87
+
This avoid to check which IP address has to be used each time a new packet is received.
79
88
80
-
When enabled, the source IP address of the packet is set to the external IP of the NAT, and a new source port is assigned.
89
+
Masquerade can be either enabled or disabled.
90
+
When enabled, the source IP address of outgoing packets is set to the external IP of the NAT, and a new source port is assigned.
81
91
82
92
To enable masquerade:
83
93
@@ -91,12 +101,19 @@ To disable masquerade:
91
101
92
102
polycubectl nat1 rule masquerade disable
93
103
104
+
94
105
Destination NAT
95
-
***************
106
+
^^^^^^^^^^^^^^^
96
107
97
-
Available and mandatory fields for DNAT rules are
98
-
- ```internal-ip```: the internal IP address (e.g 10.0.0.1)
99
-
- ```external-ip```: the external IP address (e.g. 1.2.3.4)
108
+
Destination NAT adds a new translation rule for traffic coming from the external network directed to the internal network. It implements what is also called `static` NAT in other contexts.
109
+
This features allows external traffic to be forwarded to the internal network without having a corresponding session already established from inside.
110
+
111
+
The destination NAT forwards all the traffic coming to a specific ```external-ip``` to a given ```internal-ip```, without inspecting other packet fields such as TCP/UDP ports, or protocols (e.g., ICMP).
112
+
Obviously, this option requires a dedicated ```external-ip``` for each mapping.
113
+
114
+
Available and mandatory fields for DNAT rules are:
115
+
- ```internal-ip```: the internal IP address (e.g 10.0.0.1)
116
+
- ```external-ip```: the external IP address (e.g. 1.2.3.4)
100
117
101
118
Sample rule:
102
119
@@ -106,15 +123,18 @@ Sample rule:
106
123
107
124
All the packets directed to ```1.2.3.4``` will be sent to ```10.0.0.1```, so use this rule carefully.
108
125
126
+
109
127
Port Forwarding
110
-
***************
128
+
^^^^^^^^^^^^^^^
129
+
130
+
Port forwarding implements a more selective form of destination NAT, allowing to specify the exact binding by means of other parameters such as the destination TCP/UDP port. This enables the sharing of the same ```external-ip``` among many ```internal-ip``` hosts, provided that their traffic can be differentiated e.g., by means of other parameters such as the ```external-port``` in use.
111
131
112
-
Available and mandatory fields for Port Forwarding rules are
113
-
- ```internal-ip```: the internal IP address (e.g 10.0.0.1)
114
-
- ```external-ip```: the external IP address (e.g. 1.2.3.4)
115
-
- ```internal-port```: the internal port number (e.g 8080)
116
-
- ```external-port```: the external port number (e.g. 80)
117
-
- ```proto```: the upper layer protocol (e.g. tcp, udp, all). This field is optional: if not specified, all protocols are considered
132
+
Available and mandatory fields for Port Forwarding rules are:
133
+
- ```internal-ip```: the internal IP address (e.g 10.0.0.1)
134
+
- ```external-ip```: the external IP address (e.g. 1.2.3.4)
135
+
- ```internal-port```: the internal port number (e.g 8080)
136
+
- ```external-port```: the external port number (e.g. 80)
137
+
- ```proto```: the upper layer protocol (e.g. tcp, udp, all). This field is optional: if not specified, all protocols are considered
118
138
119
139
Sample rule:
120
140
@@ -127,6 +147,10 @@ Sample rule:
127
147
128
148
This type of rule is especially useful to make a server in the inside network reachable from the outside.
129
149
150
+
151
+
Other NAT operations
152
+
--------------------
153
+
130
154
Deleting rules
131
155
^^^^^^^^^^^^^^
132
156
@@ -152,6 +176,7 @@ To delete a single rule (an SNAT rule in the example):
152
176
153
177
Deleting a rule does not affect ongoing natting sessions: to prevent a deleted rule from being applied, `flush the natting table <Natting-table>`_.
154
178
179
+
155
180
Showing rules
156
181
^^^^^^^^^^^^^
157
182
@@ -169,13 +194,14 @@ To display one type of rule (SNAT in the example):
169
194
170
195
polycubectl nat1 rule snat show
171
196
197
+
172
198
Rule priority
173
199
^^^^^^^^^^^^^
174
200
175
-
It is not possible to manually set a priority for each rule, but:
176
-
- SNAT rules have higher priority than Masquerade
177
-
- Port Forwarding rules have higher priority than DNAT rules
178
-
- Port Forwarding rules with protocol have higher priority than Port Forwarding rules without protocol
201
+
Explicit rule priorities are not supported; however:
202
+
- SNAT rules have higher priority than Masquerade
203
+
- Port Forwarding rules have higher priority than DNAT rules
204
+
- Port Forwarding rules with protocol have higher priority than Port Forwarding rules without protocol
0 commit comments