Skip to content

Commit e4a13aa

Browse files
committed
Documentation updates
Images: add a small section about snapshots management Images: fix the list of flavorable commands Images: fix the flavour example Installation: add POT_EXTRA_EXTIF explanation Add proper references to extra network interfaces in configuration files Quick: add a section about private-bridge network type
1 parent c13f7c3 commit e4a13aa

File tree

5 files changed

+95
-21
lines changed

5 files changed

+95
-21
lines changed

etc/pot/pot.conf.sample

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
# POT_EXTIF=em0
2626

2727
# The list of extra network interface, to make other network segments accessible
28-
# POT_EXTRA_EXTIF=vlan20
28+
# POT_EXTRA_EXTIF=vlan20 vlan50
2929
# for each extra interface, a variable is used to sepcify its network segment
30-
# POT_NETWORK_vlan20=192.168.0.0/16
30+
# POT_NETWORK_vlan20=192.168.100.0/24
31+
# POT_NETWORK_vlan50=10.50.50.0/24
3132

3233
# DNS on the Internal Virtual Network
3334

@@ -41,4 +42,4 @@
4142

4243
# name of the tunnel network interface
4344
# POT_VPN_EXTIF=tun0
44-
# POT_VPN_NETWORKS=192.168.0.0/16
45+
# POT_VPN_NETWORKS=192.168.0.0/24 192.168.10.0/24

etc/pot/pot.default.conf

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ POT_NETMASK=255.192.0.0
1919
POT_GATEWAY=10.192.0.1
2020
# The name of the network physical interface, to be used as default gateway
2121
POT_EXTIF=em0
22+
# Additional network interfaces
23+
POT_EXTRA_EXTIF=
2224

2325
# DNS on the Internal Virtual Network
2426
# name of the pot running the DNS

share/doc/pot/Images.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ test_1.0.xz.skein
6565
```
6666
The first file is the image, the second file is a hash file, used by the `import` command to verify the integrity.
6767

68+
#### Snapshots management
69+
70+
The `export` command will create an image if and only if one snapshot is available.
71+
The flag `-A` try to automatically fix the number of available snapshots:
72+
* if 0 snapshots are available, `-A` will automatically invoke `pot snapshot`
73+
* if 2+ snapshots are available, `-A` will automatically invoke `pot purge-snapshots`
74+
75+
The command `pot purge-snapshots` deletes all snapshots, except the last one.
76+
6877
### Images creation automated with flavours
6978

7079
Flavour is the way we currently provide to automate the customization of a `pot`.
@@ -92,9 +101,9 @@ Now we automate those commands in a flavour, called `nginx-test`.
92101
In the flavour folder we create one file for the `pot` configuration:
93102
```console
94103
# cat /usr/local/etc/pot/flavours/nginx-test
95-
set-cmd -p test -c "nginx -g 'daemon off;'"
96-
set-attribute -p test -A no-rc-script -V YES
97-
set-attribute -p test -A persistent -V NO
104+
set-cmd -c "nginx -g 'daemon off;'"
105+
set-attribute -A no-rc-script -V YES
106+
set-attribute -A persistent -V NO
98107
set-rss -C 1
99108
```
100109

@@ -119,11 +128,13 @@ The flavour `nginx-test` can now be used with the `create` command:
119128

120129
An important note: while the bootstrap script is a shell script, where you can do whatever you want, the `pot` command usable in a flavour are a small subset:
121130
* `add-dep`
131+
* `export-ports`
122132
* `copy-in`
123133
* `mount-in`
124134
* `set-attribute` (the abbreviated form `set-attr` is not recognized here)
135+
* `set-cmd`
136+
* `set-env`
125137
* `set-rss`
126-
* `export-ports`
127138

128139
**NOTE** the `mount-in` command has to be used carefully. If the `pot` will be migrated to a different machine, the folders or the ZFS datasets has to be manually migrated as well
129140

share/doc/pot/Installation.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ In order to use network types like `alias` or `public-bridge`, some configuratio
6565
#### `POT_EXTIF` (default `em0`)
6666
Currently, `pot` assumes that all the network traffic is going through one physical network interface.
6767
This parameter configures `pot` to use the specified network interface.
68-
It's relevant for `alias` and `public-bridge` network type.
68+
It's relevant for `alias`, `public-bridge` and `private-bridge` network type.
6969

7070
#### `POT_NETWORK` (default `10.192.0.0/10`)
7171
This parameter specifies the IPv4 address of you internal virtual network and is used by the `public-bridge` network type only.
@@ -79,6 +79,20 @@ Theoretically, the netmask can be derived by the `POT_NETWORK`. For now, this is
7979
#### `POT_GATEWAY` (default `10.192.0.1`)
8080
This parameter specifies the IP address that will be used as default gateway in your internal virtual network. It has to be part of the network specified in `POT_NETWORK` and it will be used as default gateway for all `pot`s attached to the internal virtual network (`public-bridge` network type).
8181

82+
#### `POT_EXTRA_EXTIF` (default empty)
83+
In case your host has multiple network interfaces connected to multiple network segments, this option allows your `pot`s to access those network segments.
84+
For example, let's say that you have 2 vlan interfaces, called `vlan20` and `vlan30`.
85+
`vlan20` is configured as 10.0.20.4/24
86+
`vlan30` is configured as 10.0.30.8/24
87+
To make those segments accessible, the configuration file should look like:
88+
```
89+
POT_EXTRA_EXTIF=vlan20 vlan30
90+
POT_NETWORK_vlan20=10.0.20.0/24
91+
POT_NETWORK_vlan30=10.0.30.0/24
92+
```
93+
Currently there is no way to use additional external interface for the network type `alias`.
94+
All other network types are supported
95+
8296
#### Network validation
8397
If you want to check that your network configuration is valid, you can use the utility `potnet`:
8498

share/doc/pot/QuickStart.md

+59-13
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ This command will just create the needed ZFS datasets.
4141
## Create a simple `pot`
4242
We can now create the simplest `pot`
4343
```console
44-
# pot create -p mypot -t single -b 11.2
44+
# pot create -p mypot -t single -b 11.3
4545
```
4646
**NOTE** The FreeBSD machine doesn't have to be the same version of your `pot` (jail). However, the hosting machine's version has to be greater or equal than the `pot`'s one.
47-
For instance, you can run a FreeBSD 10.4 `pot` on a FreeBSD 11.2 host. You **cannot** run a FreeBSD 12 `pot` on a FreeBSD 11.2 host.
47+
For instance, you can run a FreeBSD 10.4 `pot` on a FreeBSD 11.3 host. You **cannot** run a FreeBSD 12 `pot` on a FreeBSD 11.3 host.
4848

49-
So, we created a `pot`, named `mypot`, based on FreeBSD 11.2 consisting of one ZFS dataset.
49+
So, we created a `pot`, named `mypot`, based on FreeBSD 11.3 consisting of one ZFS dataset.
5050

5151
Now you can start it or stop it, via:
5252
```console
@@ -69,7 +69,7 @@ You can see a list of the `pot`s available on you local machine. The verbose out
6969
pot name : mypot
7070
ip4 : inherit
7171
active : true
72-
base : 11.2
72+
base : 11.3
7373
level : 0
7474
datasets:
7575
snapshot:
@@ -79,7 +79,7 @@ If you want to get some information on a specific `pot`, this command is more us
7979
# pot info -v -p mypot
8080
pot name : mypot
8181
type : single
82-
base : 11.2
82+
base : 11.3
8383
level : 0
8484
ip4 : inherit
8585
active : true
@@ -220,12 +220,13 @@ During the creation phase, it's possible to specify which type of network our `p
220220
* inherit
221221
* alias (IPv4 or IPv6) n the host network interface
222222
* IPv4 address on the public internal virtual network
223+
* IPv4 address on a private internal virtual network
223224

224225
By default, `inherit` is the chosen one.
225226
### Network configuration: inherit
226227
To use the `inherit` network type, a `pot` can be created with the following command:
227228
```console
228-
# pot create -p mypot -t single -b 11.2 -N inherit
229+
# pot create -p mypot -t single -b 11.3 -N inherit
229230
```
230231
The option `-N` can be omitted, because `inherit` is the default value.
231232
The `inherit` type means that `mypot` will reuse the same network stack of the host machine.
@@ -237,7 +238,7 @@ If your host is a network that support static IPs, you can assign one static IP
237238
For example, your system has 192.168.178.20/24 as IP address and your network administrator reserved you the additional IP address 192.168.178.200.
238239
To assing the latter IP address to your `pot` you can create it with the following command:
239240
```console
240-
# pot create -p mypot -t single -b 11.2 -N alias -i 192.168.178.200
241+
# pot create -p mypot -t single -b 11.3 -N alias -i 192.168.178.200
241242
# pot start mypot
242243
# pot info -vp mypot
243244
```
@@ -248,7 +249,7 @@ More information about alias addresses on network interfaces are available in th
248249

249250
### Network configuration: public virtual network bridge
250251
Thanks to `VNET(9)`, `pot` supports an IPv4 virtual network. This network is configured in configuration file (`/usr/local/etc/pot/pot.conf`), so be sure you have it properly configured.
251-
At the moment, `pot` supports only one big public virtual network, represented by a shared network bridge, so all `pot`s will share it.
252+
This network type refers to a shared bridge where the public virtual network lives. All `pot`s with this network type will share it. The virtual internal network is connected with the ouside via NAT.
252253

253254
To help the `pot` framework and all users to manage the public virtual network, an additional package is required, normally automatically installed as dependency of the package `pot`. It's also manually installable via:
254255
```console
@@ -279,22 +280,67 @@ This command will create and configure the network interfaces properly and will
279280

280281
The following command will create a `pot` running on the internal network:
281282
```console
282-
# pot create -p mypot -t single -b 11.2 -N public-bridge -i auto
283+
# pot create -p mypot -t single -b 11.3 -N public-bridge -i auto
283284
# pot run mypot
284285
root@mypot:~ # ping 1.1.1.1
285286
[..]
286287
root@mypot:~ # exit
287288
# pot stop mypot
288289
```
289-
The `auto` keyword will automatically select an available address in the internal virtual network.
290+
The `auto` keyword will automatically select an available address in the internal virtual network and it's the default value, hence the `-i` option can be omitted.
290291
Commands like `pot info -p mypot` and `potnet show` will show you exactly which address has been assigned to your `pot`
291292

292-
If you prefer to assign a specific IP address of your virtual network, you can just do:
293+
If you prefer to assign a specific IP address of your virtual network to your `pot`, you can just do:
293294
```console
294-
# pot create -p mypot -t single -b 11.2 -N public-bridge -i 10.192.0.10
295+
# pot create -p mypot2 -t single -b 11.3 -N public-bridge -i 10.192.0.10
295296
```
296297
`pot` will verify if the IP address is available and free to be used.
297-
#### Export network services with the internal network
298+
299+
### Network configuration: private virtual network bridge
300+
The public virtual network has the downside that all `pot`s share the same bridge, affecting isolation.
301+
To mitigate this issue, private virtual network has been introduced.
302+
A private virtual network is just a different bridge, that can be used to connect multiple `pot`s, but it's not automatically shared with all `pot`s.
303+
304+
First of all, to use a private virtual network a private bridge has to be created:
305+
```console
306+
# pot create-private-bridge -B mybridge -S 4
307+
```
308+
This command will create a new private bridge, called `mybridge`, with a network segment big enough to connect 4 `pot`s.
309+
Using `potnet` it's possible to check the details of the private bridge via the command:
310+
```console
311+
# potnet show -b mybridge
312+
10.192.0.16 mybridge bridge - network
313+
10.192.0.17 mybridge bridge - gateway
314+
10.192.0.23 mybridge bridge - broadcast
315+
```
316+
The output is from my configuration, however your address' range can differ, depending on the configuration values you have adopted and the network segment available when the bridge is created.
317+
318+
To activate a specific bridge, you can use the command:
319+
```console
320+
# pot vnet-start -B mybridge
321+
```
322+
This command will create and configure the network interfaces properly and will activate `pf` to perform NAT on the virtual network.
323+
324+
**NOTE** This command is automatically executed when a `pot` is configured to use the public virtual network. There is no need to run it manually.
325+
326+
The following command will create a `pot` running on the private internal network:
327+
```console
328+
# pot create -p mypot -t single -b 11.3 -N private-bridge -B mybridge -i auto
329+
# pot run mypot
330+
root@mypot:~ # ping 1.1.1.1
331+
[..]
332+
root@mypot:~ # exit
333+
# pot stop mypot
334+
```
335+
The `auto` keyword will automatically select an available address in the internal virtual network and it's the default value, hence the `-i` option can be omitted.
336+
Commands like `pot info -p mypot` and `potnet show -b mybridge` will show you exactly which address has been assigned to your `pot`
337+
338+
If you prefer to assign a specific IP address of your virtual network to your `pot`, you can just do:
339+
```console
340+
# pot create -p mypot2 -t single -b 11.3 -N private-bridge -B mybridge -i 10.192.0.19
341+
```
342+
`pot` will verify if the IP address is available and free to be used.
343+
### Export network services with the internal network
298344
The virtual network is not visible outside the host machine, becuase it's based on NAT of the pf's NAT.
299345
To make your network services running in your `pot` visible outside the TCP/UDP, desired ports have to be exported/redirected.
300346
`pot` provides a command to tell which port has to be exported.

0 commit comments

Comments
 (0)