Skip to content

Commit 6f7e4a7

Browse files
committed
doc: improve advanced-network
1 parent 48dbf06 commit 6f7e4a7

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

doc/src/advanced-network.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
# Advanced network setup
22

33
Renting a server in a datacenter usually gets you one IP address. You
4-
should not bridge your local VM traffic together with the physical
5-
Ethernet uplink port. Instead, setup a bridge only for the Virtual
6-
Machines, and provide them with Internet through NAT just like your
7-
plastic ADSL router at home.
8-
4+
must not bridge your local VM traffic together with the physical
5+
Ethernet uplink port. Instead, setup a host-internal bridge for the
6+
Virtual Machines, and provide them with Internet through NAT just like
7+
your plastic ADSL router at home.
98

109
## A bridge to link TAP interfaces
1110

1211
Instead of placing MicroVMs directly on a LAN, one can also use a TAP
1312
interface to get a virtual Ethernet interface on the host. Although it
14-
is possible to assign individual IP configuration to these individual
15-
interfaces, let us avoid the additional configuration effort and
16-
create a bridge instead:
13+
is possible to [assign individual IP
14+
configuration](./routed-network.md) to these individual interfaces,
15+
let us avoid the additional configuration effort and create a bridge
16+
instead:
1717

1818
```nix
19-
systemd.network = {
20-
netdevs."10-microvm".netdevConfig = {
21-
Kind = "bridge";
22-
Name = "microvm";
23-
};
24-
networks."10-microvm" = {
25-
matchConfig.Name = "microvm";
26-
networkConfig = {
27-
DHCPServer = true;
28-
IPv6SendRA = true;
29-
};
30-
addresses = [ {
31-
addressConfig.Address = "10.0.0.1/24";
32-
} {
33-
addressConfig.Address = "fd12:3456:789a::1/64";
34-
} ];
35-
ipv6Prefixes = [ {
36-
ipv6PrefixConfig.Prefix = "fd12:3456:789a::/64";
37-
} ];
19+
systemd.network.netdevs."10-microvm".netdevConfig = {
20+
Kind = "bridge";
21+
Name = "microvm";
22+
};
23+
systemd.network.networks."10-microvm" = {
24+
matchConfig.Name = "microvm";
25+
networkConfig = {
26+
DHCPServer = true;
27+
IPv6SendRA = true;
3828
};
29+
addresses = [ {
30+
addressConfig.Address = "10.0.0.1/24";
31+
} {
32+
addressConfig.Address = "fd12:3456:789a::1/64";
33+
} ];
34+
ipv6Prefixes = [ {
35+
ipv6PrefixConfig.Prefix = "fd12:3456:789a::/64";
36+
} ];
3937
};
4038
4139
# Allow inbound traffic for the DHCP server
@@ -50,12 +48,10 @@ Last, the TAP interfaces of MicroVMs shall be attached to this central
5048
bridge. Make sure your `matchConfig` matches just the interfaces you
5149
want!
5250
```nix
53-
systemd.network = {
54-
networks."11-microvm" = {
55-
matchConfig.Name = "vm-*";
56-
# Attach to the bridge that was configured above
57-
networkConfig.Bridge = "microvm";
58-
};
51+
systemd.network.networks."11-microvm" = {
52+
matchConfig.Name = "vm-*";
53+
# Attach to the bridge that was configured above
54+
networkConfig.Bridge = "microvm";
5955
};
6056
```
6157

@@ -71,9 +67,13 @@ MicroVMs. NAT works for this address family, too!
7167
```nix
7268
networking.nat = {
7369
enable = true;
70+
# NAT66 exists and works. But if you have a proper subnet in
71+
# 2000::/3 you should route that and remove this setting:
7472
enableIPv6 = true;
73+
7574
# Change this to the interface with upstream Internet access
7675
externalInterface = "eth0";
76+
# The bridge where you want to provide Internet access
7777
internalInterfaces = [ "microvm" ];
7878
};
7979
```

0 commit comments

Comments
 (0)