]> git.proxmox.com Git - pve-docs.git/blob - pvesdn.adoc
fix #5429: network: override device names: include Type=ether
[pve-docs.git] / pvesdn.adoc
1 [[chapter_pvesdn]]
2 Software-Defined Network
3 ========================
4 ifndef::manvolnum[]
5 :pve-toplevel:
6 endif::manvolnum[]
7
8 The **S**oftware-**D**efined **N**etwork (SDN) feature in {pve} enables the
9 creation of virtual zones and networks (VNets). This functionality simplifies
10 advanced networking configurations and multitenancy setup.
11
12 [[pvesdn_overview]]
13 Introduction
14 ------------
15
16 The {pve} SDN allows for separation and fine-grained control of virtual guest
17 networks, using flexible, software-controlled configurations.
18
19 Separation is managed through *zones*, virtual networks (*VNets*), and
20 *subnets*. A zone is its own virtually separated network area. A VNet is a
21 virtual network that belongs to a zone. A subnet is an IP range inside a VNet.
22
23 Depending on the type of the zone, the network behaves differently and offers
24 specific features, advantages, and limitations.
25
26 Use cases for SDN range from an isolated private network on each individual node
27 to complex overlay networks across multiple PVE clusters on different locations.
28
29 After configuring an VNet in the cluster-wide datacenter SDN administration
30 interface, it is available as a common Linux bridge, locally on each node, to be
31 assigned to VMs and Containers.
32
33
34 [[pvesdn_support_status]]
35 Support Status
36 --------------
37
38 History
39 ~~~~~~~
40
41 The {pve} SDN stack has been available as an experimental feature since 2019 and
42 has been continuously improved and tested by many developers and users.
43 With its integration into the web interface in {pve} 6.2, a significant
44 milestone towards broader integration was achieved.
45 During the {pve} 7 release cycle, numerous improvements and features were added.
46 Based on user feedback, it became apparent that the fundamental design choices
47 and their implementation were quite sound and stable. Consequently, labeling it
48 as `experimental' did not do justice to the state of the SDN stack.
49 For {pve} 8, a decision was made to lay the groundwork for full integration of
50 the SDN feature by elevating the management of networks and interfaces to a core
51 component in the {pve} access control stack.
52 In {pve} 8.1, two major milestones were achieved: firstly, DHCP integration was
53 added to the IP address management (IPAM) feature, and secondly, the SDN
54 integration is now installed by default.
55
56 Current Status
57 ~~~~~~~~~~~~~~
58
59 The current support status for the various layers of our SDN installation is as
60 follows:
61
62 - Core SDN, which includes VNet management and its integration with the {pve}
63 stack, is fully supported.
64 - IPAM, including DHCP management for virtual guests, is in tech preview.
65 - Complex routing via FRRouting and controller integration are in tech preview.
66
67 [[pvesdn_installation]]
68 Installation
69 ------------
70
71 SDN Core
72 ~~~~~~~~
73
74 Since {pve} 8.1 the core Software-Defined Network (SDN) packages are installed
75 by default.
76
77 If you upgrade from an older version, you need to install the
78 `libpve-network-perl` package on every node:
79
80 ----
81 apt update
82 apt install libpve-network-perl
83 ----
84
85 NOTE: {pve} version 7.0 and above have the `ifupdown2` package installed by
86 default. If you originally installed your system with an older version, you need
87 to explicitly install the `ifupdown2` package.
88
89 After installation, you need to ensure that the following line is present at the
90 end of the `/etc/network/interfaces` configuration file on all nodes, so that
91 the SDN configuration gets included and activated.
92
93 ----
94 source /etc/network/interfaces.d/*
95 ----
96
97 [[pvesdn_install_dhcp_ipam]]
98 DHCP IPAM
99 ~~~~~~~~~
100
101 The DHCP integration into the built-in 'PVE' IP Address Management stack
102 currently uses `dnsmasq` for giving out DHCP leases. This is currently opt-in.
103
104 To use that feature you need to install the `dnsmasq` package on every node:
105
106 ----
107 apt update
108 apt install dnsmasq
109 # disable default instance
110 systemctl disable --now dnsmasq
111 ----
112
113 [[pvesdn_install_frrouting]]
114 FRRouting
115 ~~~~~~~~~
116
117 The {pve} SDN stack uses the https://frrouting.org/[FRRouting] project for
118 advanced setups. This is currently opt-in.
119
120 To use the SDN routing integration you need to install the `frr-pythontools`
121 package on all nodes:
122
123 ----
124 apt update
125 apt install frr-pythontools
126 ----
127
128 [[pvesdn_main_configuration]]
129 Configuration Overview
130 ----------------------
131
132 Configuration is done at the web UI at datacenter level, separated into the
133 following sections:
134
135 * SDN:: Here you get an overview of the current active SDN state, and you can
136 apply all pending changes to the whole cluster.
137
138 * xref:pvesdn_config_zone[Zones]: Create and manage the virtually separated
139 network zones
140
141 * xref:pvesdn_config_vnet[VNets] VNets: Create virtual network bridges and
142 manage subnets
143
144 The Options category allows adding and managing additional services to be used
145 in your SDN setup.
146
147 * xref:pvesdn_config_controllers[Controllers]: For controlling layer 3 routing
148 in complex setups
149
150 * DHCP: Define a DHCP server for a zone that automatically allocates IPs for
151 guests in the IPAM and leases them to the guests via DHCP.
152
153 * xref:pvesdn_config_ipam[IPAM]: Enables external for IP address management for
154 guests
155
156 * xref:pvesdn_config_dns[DNS]: Define a DNS server integration for registering
157 virtual guests' hostname and IP addresses
158
159 [[pvesdn_tech_and_config_overview]]
160 Technology & Configuration
161 --------------------------
162
163 The {pve} Software-Defined Network implementation uses standard Linux networking
164 as much as possible. The reason for this is that modern Linux networking
165 provides almost all needs for a feature full SDN implementation and avoids adding
166 external dependencies and reduces the overall amount of components that can
167 break.
168
169 The {pve} SDN configurations are located in `/etc/pve/sdn`, which is shared with
170 all other cluster nodes through the {pve} xref:chapter_pmxcfs[configuration file system].
171 Those configurations get translated to the respective configuration formats of
172 the tools that manage the underlying network stack (for example `ifupdown2` or
173 `frr`).
174
175 New changes are not immediately applied but recorded as pending first. You can
176 then apply a set of different changes all at once in the main 'SDN' overview
177 panel on the web interface. This system allows to roll-out various changes as
178 single atomic one.
179
180 The SDN tracks the rolled-out state through the '.running-config' and '.version'
181 files located in '/etc/pve/sdn'.
182
183 // TODO: extend implementation and technology details.
184
185 [[pvesdn_config_zone]]
186 Zones
187 -----
188
189 A zone defines a virtually separated network. Zones are restricted to
190 specific nodes and assigned permissions, in order to restrict users to a certain
191 zone and its contained VNets.
192
193 Different technologies can be used for separation:
194
195 * Simple: Isolated Bridge. A simple layer 3 routing bridge (NAT)
196
197 * VLAN: Virtual LANs are the classic method of subdividing a LAN
198
199 * QinQ: Stacked VLAN (formally known as `IEEE 802.1ad`)
200
201 * VXLAN: Layer 2 VXLAN network via a UDP tunnel
202
203 * EVPN (BGP EVPN): VXLAN with BGP to establish Layer 3 routing
204
205
206 [[pvesdn_config_common_options]]
207 Common Options
208 ~~~~~~~~~~~~~~
209
210 The following options are available for all zone types:
211
212 Nodes:: The nodes which the zone and associated VNets should be deployed on.
213
214 IPAM:: Use an IP Address Management (IPAM) tool to manage IPs in the
215 zone. Optional, defaults to `pve`.
216
217 DNS:: DNS API server. Optional.
218
219 ReverseDNS:: Reverse DNS API server. Optional.
220
221 DNSZone:: DNS domain name. Used to register hostnames, such as
222 `<hostname>.<domain>`. The DNS zone must already exist on the DNS server. Optional.
223
224
225 [[pvesdn_zone_plugin_simple]]
226 Simple Zones
227 ~~~~~~~~~~~~
228
229 This is the simplest plugin. It will create an isolated VNet bridge. This
230 bridge is not linked to a physical interface, and VM traffic is only local on
231 each the node.
232 It can be used in NAT or routed setups.
233
234
235 [[pvesdn_zone_plugin_vlan]]
236 VLAN Zones
237 ~~~~~~~~~~
238
239 The VLAN plugin uses an existing local Linux or OVS bridge to connect to the
240 node's physical interface. It uses VLAN tagging defined in the VNet to isolate
241 the network segments. This allows connectivity of VMs between different nodes.
242
243 VLAN zone configuration options:
244
245 Bridge:: The local bridge or OVS switch, already configured on *each* node that
246 allows node-to-node connection.
247
248
249 [[pvesdn_zone_plugin_qinq]]
250 QinQ Zones
251 ~~~~~~~~~~
252
253 QinQ also known as VLAN stacking, that uses multiple layers of VLAN tags for
254 isolation. The QinQ zone defines the outer VLAN tag (the 'Service VLAN')
255 whereas the inner VLAN tag is defined by the VNet.
256
257 NOTE: Your physical network switches must support stacked VLANs for this
258 configuration.
259
260 QinQ zone configuration options:
261
262 Bridge:: A local, VLAN-aware bridge that is already configured on each local
263 node
264
265 Service VLAN:: The main VLAN tag of this zone
266
267 Service VLAN Protocol:: Allows you to choose between an 802.1q (default) or
268 802.1ad service VLAN type.
269
270 MTU:: Due to the double stacking of tags, you need 4 more bytes for QinQ VLANs.
271 For example, you must reduce the MTU to `1496` if you physical interface MTU is
272 `1500`.
273
274
275 [[pvesdn_zone_plugin_vxlan]]
276 VXLAN Zones
277 ~~~~~~~~~~~
278
279 The VXLAN plugin establishes a tunnel (overlay) on top of an existing network
280 (underlay). This encapsulates layer 2 Ethernet frames within layer 4 UDP
281 datagrams using the default destination port `4789`.
282
283 You have to configure the underlay network yourself to enable UDP connectivity
284 between all peers.
285
286 You can, for example, create a VXLAN overlay network on top of public internet,
287 appearing to the VMs as if they share the same local Layer 2 network.
288
289 WARNING: VXLAN on its own does does not provide any encryption. When joining
290 multiple sites via VXLAN, make sure to establish a secure connection between
291 the site, for example by using a site-to-site VPN.
292
293 VXLAN zone configuration options:
294
295 Peers Address List:: A list of IP addresses of each node in the VXLAN zone. This
296 can be external nodes reachable at this IP address.
297 All nodes in the cluster need to be mentioned here.
298
299 MTU:: Because VXLAN encapsulation uses 50 bytes, the MTU needs to be 50 bytes
300 lower than the outgoing physical interface.
301
302
303 [[pvesdn_zone_plugin_evpn]]
304 EVPN Zones
305 ~~~~~~~~~~
306
307 The EVPN zone creates a routable Layer 3 network, capable of spanning across
308 multiple clusters. This is achieved by establishing a VPN and utilizing BGP as
309 the routing protocol.
310
311 The VNet of EVPN can have an anycast IP address and/or MAC address. The bridge
312 IP is the same on each node, meaning a virtual guest can use this address as
313 gateway.
314
315 Routing can work across VNets from different zones through a VRF (Virtual
316 Routing and Forwarding) interface.
317
318 EVPN zone configuration options:
319
320 VRF VXLAN ID:: A VXLAN-ID used for dedicated routing interconnect between VNets.
321 It must be different than the VXLAN-ID of the VNets.
322
323 Controller:: The EVPN-controller to use for this zone. (See controller plugins
324 section).
325
326 VNet MAC Address:: Anycast MAC address that gets assigned to all VNets in this
327 zone. Will be auto-generated if not defined.
328
329 Exit Nodes:: Nodes that shall be configured as exit gateways from the EVPN
330 network, through the real network. The configured nodes will announce a
331 default route in the EVPN network. Optional.
332
333 Primary Exit Node:: If you use multiple exit nodes, force traffic through this
334 primary exit node, instead of load-balancing on all nodes. Optional but
335 necessary if you want to use SNAT or if your upstream router doesn't support
336 ECMP.
337
338 Exit Nodes Local Routing:: This is a special option if you need to reach a VM/CT
339 service from an exit node. (By default, the exit nodes only allow forwarding
340 traffic between real network and EVPN network). Optional.
341
342 Advertise Subnets:: Announce the full subnet in the EVPN network.
343 If you have silent VMs/CTs (for example, if you have multiple IPs and the
344 anycast gateway doesn't see traffic from theses IPs, the IP addresses won't be
345 able to be reached inside the EVPN network). Optional.
346
347 Disable ARP ND Suppression:: Don't suppress ARP or ND (Neighbor Discovery)
348 packets. This is required if you use floating IPs in your VMs (IP and MAC
349 addresses are being moved between systems). Optional.
350
351 Route-target Import:: Allows you to import a list of external EVPN route
352 targets. Used for cross-DC or different EVPN network interconnects. Optional.
353
354 MTU:: Because VXLAN encapsulation uses 50 bytes, the MTU needs to be 50 bytes
355 less than the maximal MTU of the outgoing physical interface. Optional,
356 defaults to 1450.
357
358
359 [[pvesdn_config_vnet]]
360 VNets
361 -----
362
363 After creating a virtual network (VNet) through the SDN GUI, a local network
364 interface with the same name is available on each node. To connect a guest to the
365 VNet, assign the interface to the guest and set the IP address accordingly.
366
367 Depending on the zone, these options have different meanings and are explained
368 in the respective zone section in this document.
369
370 WARNING: In the current state, some options may have no effect or won't work in
371 certain zones.
372
373 VNet configuration options:
374
375 ID:: An up to 8 character ID to identify a VNet
376
377 Comment:: More descriptive identifier. Assigned as an alias on the interface. Optional
378
379 Zone:: The associated zone for this VNet
380
381 Tag:: The unique VLAN or VXLAN ID
382
383 VLAN Aware:: Enables vlan-aware option on the interface, enabling configuration
384 in the guest.
385
386
387 [[pvesdn_config_subnet]]
388 Subnets
389 -------
390
391 A subnet define a specific IP range, described by the CIDR network address.
392 Each VNet, can have one or more subnets.
393
394 A subnet can be used to:
395
396 * Restrict the IP addresses you can define on a specific VNet
397 * Assign routes/gateways on a VNet in layer 3 zones
398 * Enable SNAT on a VNet in layer 3 zones
399 * Auto assign IPs on virtual guests (VM or CT) through IPAM plugins
400 * DNS registration through DNS plugins
401
402 If an IPAM server is associated with the subnet zone, the subnet prefix will be
403 automatically registered in the IPAM.
404
405 Subnet configuration options:
406
407 ID:: A CIDR network address, for example 10.0.0.0/8
408
409 Gateway:: The IP address of the network's default gateway. On layer 3 zones
410 (Simple/EVPN plugins), it will be deployed on the VNet.
411
412 SNAT:: Enable Source NAT which allows VMs from inside a
413 VNet to connect to the outside network by forwarding the packets to the nodes
414 outgoing interface. On EVPN zones, forwarding is done on EVPN gateway-nodes.
415 Optional.
416
417 DNS Zone Prefix:: Add a prefix to the domain registration, like
418 <hostname>.prefix.<domain> Optional.
419
420
421 [[pvesdn_config_controllers]]
422 Controllers
423 -----------
424
425 Some zones implement a separated control and data plane that require an external
426 controller to manage the VNet's control plane.
427
428 Currently, only the `EVPN` zone requires an external controller.
429
430
431 [[pvesdn_controller_plugin_evpn]]
432 EVPN Controller
433 ~~~~~~~~~~~~~~~
434
435 The `EVPN`, zone requires an external controller to manage the control plane.
436 The EVPN controller plugin configures the Free Range Routing (frr) router.
437
438 To enable the EVPN controller, you need to install frr on every node that shall
439 participate in the EVPN zone.
440
441 ----
442 apt install frr frr-pythontools
443 ----
444
445 EVPN controller configuration options:
446
447 ASN #:: A unique BGP ASN number. It's highly recommended to use a private ASN
448 number (64512 – 65534, 4200000000 – 4294967294), as otherwise you could end up
449 breaking global routing by mistake.
450
451 Peers:: An IP list of all nodes that are part of the EVPN zone. (could also be
452 external nodes or route reflector servers)
453
454
455 [[pvesdn_controller_plugin_BGP]]
456 BGP Controller
457 ~~~~~~~~~~~~~~
458
459 The BGP controller is not used directly by a zone.
460 You can use it to configure FRR to manage BGP peers.
461
462 For BGP-EVPN, it can be used to define a different ASN by node, so doing EBGP.
463 It can also be used to export EVPN routes to an external BGP peer.
464
465 NOTE: By default, for a simple full mesh EVPN, you don't need to define a BGP
466 controller.
467
468 BGP controller configuration options:
469
470 Node:: The node of this BGP controller
471
472 ASN #:: A unique BGP ASN number. It's highly recommended to use a private ASN
473 number in the range (64512 - 65534) or (4200000000 - 4294967294), as otherwise
474 you could break global routing by mistake.
475
476 Peer:: A list of peer IP addresses you want to communicate with using the
477 underlying BGP network.
478
479 EBGP:: If your peer's remote-AS is different, this enables EBGP.
480
481 Loopback Interface:: Use a loopback or dummy interface as the source of the EVPN network
482 (for multipath).
483
484 ebgp-mutltihop:: Increase the number of hops to reach peers, in case they are
485 not directly connected or they use loopback.
486
487 bgp-multipath-as-path-relax:: Allow ECMP if your peers have different ASN.
488
489
490 [[pvesdn_controller_plugin_ISIS]]
491 ISIS Controller
492 ~~~~~~~~~~~~~~~
493
494 The ISIS controller is not used directly by a zone.
495 You can use it to configure FRR to export EVPN routes to an ISIS domain.
496
497 ISIS controller configuration options:
498
499 Node:: The node of this ISIS controller.
500
501 Domain:: A unique ISIS domain.
502
503 Network Entity Title:: A Unique ISIS network address that identifies this node.
504
505 Interfaces:: A list of physical interface(s) used by ISIS.
506
507 Loopback:: Use a loopback or dummy interface as the source of the EVPN network
508 (for multipath).
509
510
511 [[pvesdn_config_ipam]]
512 IPAM
513 ----
514
515 IP Address Management (IPAM) tools manage the IP addresses of clients on the
516 network. SDN in {pve} uses IPAM for example to find free IP addresses for new
517 guests.
518
519 A single IPAM instance can be associated with one or more zones.
520
521
522 [[pvesdn_ipam_plugin_pveipam]]
523 PVE IPAM Plugin
524 ~~~~~~~~~~~~~~~
525
526 The default built-in IPAM for your {pve} cluster.
527
528 You can inspect the current status of the PVE IPAM Plugin via the IPAM panel in
529 the SDN section of the datacenter configuration. This UI can be used to create,
530 update and delete IP mappings. This is particularly convenient in conjunction
531 with the xref:pvesdn_config_dhcp[DHCP feature].
532
533 If you are using DHCP, you can use the IPAM panel to create or edit leases for
534 specific VMs, which enables you to change the IPs allocated via DHCP. When
535 editing an IP of a VM that is using DHCP you must make sure to force the guest
536 to acquire a new DHCP leases. This can usually be done by reloading the network
537 stack of the guest or rebooting it.
538
539 [[pvesdn_ipam_plugin_netbox]]
540 NetBox IPAM Plugin
541 ~~~~~~~~~~~~~~~~~~
542
543 link:https://github.com/netbox-community/netbox[NetBox] is an open-source IP
544 Address Management (IPAM) and datacenter infrastructure management (DCIM) tool.
545
546 To integrate NetBox with {pve} SDN, create an API token in NetBox as described
547 here: https://docs.netbox.dev/en/stable/integrations/rest-api/#tokens
548
549 The NetBox configuration properties are:
550
551 URL:: The NetBox REST API endpoint: `http://yournetbox.domain.com/api`
552
553 Token:: An API access token
554
555
556 [[pvesdn_ipam_plugin_phpipam]]
557 phpIPAM Plugin
558 ~~~~~~~~~~~~~~
559
560 In link:https://phpipam.net/[phpIPAM] you need to create an "application" and add
561 an API token with admin privileges to the application.
562
563 The phpIPAM configuration properties are:
564
565 URL:: The REST-API endpoint: `http://phpipam.domain.com/api/<appname>/`
566
567 Token:: An API access token
568
569 Section:: An integer ID. Sections are a group of subnets in phpIPAM. Default
570 installations use `sectionid=1` for customers.
571
572
573 [[pvesdn_config_dns]]
574 DNS
575 ---
576
577 The DNS plugin in {pve} SDN is used to define a DNS API server for registration
578 of your hostname and IP address. A DNS configuration is associated with one or
579 more zones, to provide DNS registration for all the subnet IPs configured for
580 a zone.
581
582 [[pvesdn_dns_plugin_powerdns]]
583 PowerDNS Plugin
584 ~~~~~~~~~~~~~~~
585 https://doc.powerdns.com/authoritative/http-api/index.html
586
587 You need to enable the web server and the API in your PowerDNS config:
588
589 ----
590 api=yes
591 api-key=arandomgeneratedstring
592 webserver=yes
593 webserver-port=8081
594 ----
595
596 The PowerDNS configuration options are:
597
598 url:: The REST API endpoint: http://yourpowerdnserver.domain.com:8081/api/v1/servers/localhost
599
600 key:: An API access key
601
602 ttl:: The default TTL for records
603
604
605 [[pvesdn_config_dhcp]]
606 DHCP
607 ------
608
609 The DHCP plugin in {pve} SDN can be used to automatically deploy a DHCP server
610 for a Zone. It provides DHCP for all Subnets in a Zone that have a DHCP range
611 configured. Currently the only available backend plugin for DHCP is the dnsmasq
612 plugin.
613
614 The DHCP plugin works by allocating an IP in the IPAM plugin configured in the
615 Zone when adding a new network interface to a VM/CT. You can find more
616 information on how to configure an IPAM in the
617 xref:pvesdn_config_ipam[respective section of our documentation].
618
619 When the VM starts, a mapping for the MAC address and IP gets created in the DHCP
620 plugin of the zone. When the network interfaces is removed or the VM/CT are
621 destroyed, then the entry in the IPAM and the DHCP server are deleted as well.
622
623 NOTE: Some features (adding/editing/removing IP mappings) are currently only
624 available when using the xref:pvesdn_ipam_plugin_pveipam[PVE IPAM plugin].
625
626
627 Configuration
628 ~~~~~~~~~~~~~
629
630 You can enable automatic DHCP for a zone in the Web UI via the Zones panel and
631 enabling DHCP in the advanced options of a zone.
632
633 NOTE: Currently only Simple Zones have support for automatic DHCP
634
635 After automatic DHCP has been enabled for a Zone, DHCP Ranges need to be
636 configured for the subnets in a Zone. In order to that, go to the Vnets panel and
637 select the Subnet for which you want to configure DHCP ranges. In the edit
638 dialogue you can configure DHCP ranges in the respective Tab. Alternatively you
639 can set DHCP ranges for a Subnet via the following CLI command:
640
641 ----
642 pvesh set /cluster/sdn/vnets/<vnet>/subnets/<subnet>
643 -dhcp-range start-address=10.0.1.100,end-address=10.0.1.200
644 -dhcp-range start-address=10.0.2.100,end-address=10.0.2.200
645 ----
646
647 You also need to have a gateway configured for the subnet - otherwise
648 automatic DHCP will not work.
649
650 The DHCP plugin will then allocate IPs in the IPAM only in the configured
651 ranges.
652
653 Do not forget to follow the installation steps for the
654 xref:pvesdn_install_dhcp_ipam[dnsmasq DHCP plugin] as well.
655
656 Plugins
657 ~~~~~~~
658
659 Dnsmasq Plugin
660 ^^^^^^^^^^^^^^
661 Currently this is the only DHCP plugin and therefore the plugin that gets used
662 when you enable DHCP for a zone.
663
664 .Installation
665 For installation see the xref:pvesdn_install_dhcp_ipam[DHCP IPAM] section.
666
667 .Configuration
668 The plugin will create a new systemd service for each zone that dnsmasq gets
669 deployed to. The name for the service is `dnsmasq@<zone>`. The lifecycle of this
670 service is managed by the DHCP plugin.
671
672 The plugin automatically generates the following configuration files in the
673 folder `/etc/dnsmasq.d/<zone>`:
674
675 `00-default.conf`::
676 This contains the default global configuration for a dnsmasq instance.
677
678 `10-<zone>-<subnet_cidr>.conf`::
679 This file configures specific options for a subnet, such as the DNS server that
680 should get configured via DHCP.
681
682 `10-<zone>-<subnet_cidr>.ranges.conf`::
683 This file configures the DHCP ranges for the dnsmasq instance.
684
685 `ethers`::
686 This file contains the MAC-address and IP mappings from the IPAM plugin. In
687 order to override those mappings, please use the respective IPAM plugin rather
688 than editing this file, as it will get overwritten by the dnsmasq plugin.
689
690 You must not edit any of the above files, since they are managed by the DHCP
691 plugin. In order to customize the dnsmasq configuration you can create
692 additional files (e.g. `90-custom.conf`) in the configuration folder - they will
693 not get changed by the dnsmasq DHCP plugin.
694
695 Configuration files are read in order, so you can control the order of the
696 configuration directives by naming your custom configuration files appropriately.
697
698 DHCP leases are stored in the file `/var/lib/misc/dnsmasq.<zone>.leases`.
699
700 When using the PVE IPAM plugin, you can update, create and delete DHCP leases.
701 For more information please consult the documentation of
702 xref:pvesdn_ipam_plugin_pveipam[the PVE IPAM plugin]. Changing DHCP leases is
703 currently not supported for the other IPAM plugins.
704
705 [[pvesdn_setup_examples]]
706 Examples
707 --------
708
709 This section presents multiple configuration examples tailored for common SDN
710 use cases. It aims to offer tangible implementations, providing additional
711 details to enhance comprehension of the available configuration options.
712
713
714 [[pvesdn_setup_example_simple]]
715 Simple Zone Example
716 ~~~~~~~~~~~~~~~~~~~
717
718 Simple zone networks create an isolated network for guests on a single host to
719 connect to each other.
720
721 TIP: connection between guests are possible if all guests reside on a same host
722 but cannot be reached on other nodes.
723
724 * Create a simple zone named `simple`.
725 * Add a VNet names `vnet1`.
726 * Create a Subnet with a gateway and the SNAT option enabled.
727 * This creates a network bridge `vnet1` on the node. Assign this bridge to the
728 guests that shall join the network and configure an IP address.
729
730 The network interface configuration in two VMs may look like this which allows
731 them to communicate via the 10.0.1.0/24 network.
732
733 ----
734 allow-hotplug ens19
735 iface ens19 inet static
736 address 10.0.1.14/24
737 ----
738
739 ----
740 allow-hotplug ens19
741 iface ens19 inet static
742 address 10.0.1.15/24
743 ----
744
745
746 [[pvesdn_setup_example_nat]]
747 Source NAT Example
748 ~~~~~~~~~~~~~~~~~~
749
750 If you want to allow outgoing connections for guests in the simple network zone
751 the simple zone offers a Source NAT (SNAT) option.
752
753 Starting from the configuration xref:pvesdn_setup_example_simple[above], Add a
754 Subnet to the VNet `vnet1`, set a gateway IP and enable the SNAT option.
755
756 ----
757 Subnet: 172.16.0.0/24
758 Gateway: 172.16.0.1
759 SNAT: checked
760 ----
761
762 In the guests configure the static IP address inside the subnet's IP range.
763
764 The node itself will join this network with the Gateway IP '172.16.0.1' and
765 function as the NAT gateway for guests within the subnet range.
766
767
768 [[pvesdn_setup_example_vlan]]
769 VLAN Setup Example
770 ~~~~~~~~~~~~~~~~~~
771
772 When VMs on different nodes need to communicate through an isolated network, the
773 VLAN zone allows network level isolation using VLAN tags.
774
775 Create a VLAN zone named `myvlanzone`:
776
777 ----
778 ID: myvlanzone
779 Bridge: vmbr0
780 ----
781
782 Create a VNet named `myvnet1` with VLAN tag 10 and the previously created
783 `myvlanzone`.
784
785 ----
786 ID: myvnet1
787 Zone: myvlanzone
788 Tag: 10
789 ----
790
791 Apply the configuration through the main SDN panel, to create VNets locally on
792 each node.
793
794 Create a Debian-based virtual machine ('vm1') on node1, with a vNIC on `myvnet1`.
795
796 Use the following network configuration for this VM:
797
798 ----
799 auto eth0
800 iface eth0 inet static
801 address 10.0.3.100/24
802 ----
803
804 Create a second virtual machine ('vm2') on node2, with a vNIC on the same VNet
805 `myvnet1` as vm1.
806
807 Use the following network configuration for this VM:
808
809 ----
810 auto eth0
811 iface eth0 inet static
812 address 10.0.3.101/24
813 ----
814
815 Following this, you should be able to ping between both VMs using that network.
816
817
818 [[pvesdn_setup_example_qinq]]
819 QinQ Setup Example
820 ~~~~~~~~~~~~~~~~~~
821
822
823 This example configures two QinQ zones and adds two VMs to each zone to
824 demonstrate the additional layer of VLAN tags which allows the configuration of
825 more isolated VLANs.
826
827 A typical use case for this configuration is a hosting provider that provides an
828 isolated network to customers for VM communication but isolates the VMs from
829 other customers.
830
831 Create a QinQ zone named `qinqzone1` with service VLAN 20
832
833 ----
834 ID: qinqzone1
835 Bridge: vmbr0
836 Service VLAN: 20
837 ----
838
839 Create another QinQ zone named `qinqzone2` with service VLAN 30
840 ----
841 ID: qinqzone2
842 Bridge: vmbr0
843 Service VLAN: 30
844 ----
845
846 Create a VNet named `myvnet1` with VLAN-ID 100 on the previously created
847 `qinqzone1` zone.
848
849 ----
850 ID: qinqvnet1
851 Zone: qinqzone1
852 Tag: 100
853 ----
854
855 Create a `myvnet2` with VLAN-ID 100 on the `qinqzone2` zone.
856
857 ----
858 ID: qinqvnet2
859 Zone: qinqzone2
860 Tag: 100
861 ----
862
863 Apply the configuration on the main SDN web interface panel to create VNets
864 locally on each node.
865
866 Create four Debian-bases virtual machines (vm1, vm2, vm3, vm4) and add network
867 interfaces to vm1 and vm2 with bridge `qinqvnet1` and vm3 and vm4 with bridge
868 `qinqvnet2`.
869
870 Inside the VM, configure the IP addresses of the interfaces, for example via
871 `/etc/network/interfaces`:
872
873 ----
874 auto eth0
875 iface eth0 inet static
876 address 10.0.3.101/24
877 ----
878 // TODO: systemd-network example
879 Configure all four VMs to have IP addresses from the '10.0.3.101' to
880 '10.0.3.104' range.
881
882 Now you should be able to ping between the VMs 'vm1' and 'vm2', as well as
883 between 'vm3' and 'vm4'. However, neither of VMs 'vm1' or 'vm2' can ping VMs
884 'vm3' or 'vm4', as they are on a different zone with a different service-VLAN.
885
886
887 [[pvesdn_setup_example_vxlan]]
888 VXLAN Setup Example
889 ~~~~~~~~~~~~~~~~~~~
890
891 The example assumes a cluster with three nodes, with the node IP addresses
892 192.168.0.1, 192.168.0.2 and 192.168.0.3.
893
894 Create a VXLAN zone named `myvxlanzone` and add all IPs from the nodes to the
895 peer address list. Use the default MTU of 1450 or configure accordingly.
896
897 ----
898 ID: myvxlanzone
899 Peers Address List: 192.168.0.1,192.168.0.2,192.168.0.3
900 ----
901
902 Create a VNet named `vxvnet1` using the VXLAN zone `myvxlanzone` created
903 previously.
904
905 ----
906 ID: vxvnet1
907 Zone: myvxlanzone
908 Tag: 100000
909 ----
910
911 Apply the configuration on the main SDN web interface panel to create VNets
912 locally on each nodes.
913
914 Create a Debian-based virtual machine ('vm1') on node1, with a vNIC on `vxvnet1`.
915
916 Use the following network configuration for this VM (note the lower MTU).
917
918 ----
919 auto eth0
920 iface eth0 inet static
921 address 10.0.3.100/24
922 mtu 1450
923 ----
924
925 Create a second virtual machine ('vm2') on node3, with a vNIC on the same VNet
926 `vxvnet1` as vm1.
927
928 Use the following network configuration for this VM:
929
930 ----
931 auto eth0
932 iface eth0 inet static
933 address 10.0.3.101/24
934 mtu 1450
935 ----
936
937 Then, you should be able to ping between between 'vm1' and 'vm2'.
938
939
940 [[pvesdn_setup_example_evpn]]
941 EVPN Setup Example
942 ~~~~~~~~~~~~~~~~~~
943
944 The example assumes a cluster with three nodes (node1, node2, node3) with IP
945 addresses 192.168.0.1, 192.168.0.2 and 192.168.0.3.
946
947 Create an EVPN controller, using a private ASN number and the above node
948 addresses as peers.
949
950 ----
951 ID: myevpnctl
952 ASN#: 65000
953 Peers: 192.168.0.1,192.168.0.2,192.168.0.3
954 ----
955
956 Create an EVPN zone named `myevpnzone`, assign the previously created
957 EVPN-controller and define 'node1' and 'node2' as exit nodes.
958
959 ----
960 ID: myevpnzone
961 VRF VXLAN Tag: 10000
962 Controller: myevpnctl
963 MTU: 1450
964 VNet MAC Address: 32:F4:05:FE:6C:0A
965 Exit Nodes: node1,node2
966 ----
967
968 Create the first VNet named `myvnet1` using the EVPN zone `myevpnzone`.
969
970 ----
971 ID: myvnet1
972 Zone: myevpnzone
973 Tag: 11000
974 ----
975
976 Create a subnet on `myvnet1`:
977
978 ----
979 Subnet: 10.0.1.0/24
980 Gateway: 10.0.1.1
981 ----
982
983 Create the second VNet named `myvnet2` using the same EVPN zone `myevpnzone`.
984
985 ----
986 ID: myvnet2
987 Zone: myevpnzone
988 Tag: 12000
989 ----
990
991 Create a different subnet on `myvnet2``:
992
993 ----
994 Subnet: 10.0.2.0/24
995 Gateway: 10.0.2.1
996 ----
997
998 Apply the configuration from the main SDN web interface panel to create VNets
999 locally on each node and generate the FRR configuration.
1000
1001 Create a Debian-based virtual machine ('vm1') on node1, with a vNIC on `myvnet1`.
1002
1003 Use the following network configuration for 'vm1':
1004
1005 ----
1006 auto eth0
1007 iface eth0 inet static
1008 address 10.0.1.100/24
1009 gateway 10.0.1.1
1010 mtu 1450
1011 ----
1012
1013 Create a second virtual machine ('vm2') on node2, with a vNIC on the other VNet
1014 `myvnet2`.
1015
1016 Use the following network configuration for 'vm2':
1017
1018 ----
1019 auto eth0
1020 iface eth0 inet static
1021 address 10.0.2.100/24
1022 gateway 10.0.2.1
1023 mtu 1450
1024 ----
1025
1026
1027 Now you should be able to ping vm2 from vm1, and vm1 from vm2.
1028
1029 If you ping an external IP from 'vm2' on the non-gateway node3, the packet
1030 will go to the configured 'myvnet2' gateway, then will be routed to the exit
1031 nodes ('node1' or 'node2') and from there it will leave those nodes over the
1032 default gateway configured on node1 or node2.
1033
1034 NOTE: You need to add reverse routes for the '10.0.1.0/24' and '10.0.2.0/24'
1035 networks to node1 and node2 on your external gateway, so that the public network
1036 can reply back.
1037
1038 If you have configured an external BGP router, the BGP-EVPN routes (10.0.1.0/24
1039 and 10.0.2.0/24 in this example), will be announced dynamically.
1040
1041
1042 [[pvesdn_notes]]
1043 Notes
1044 -----
1045
1046 Multiple EVPN Exit Nodes
1047 ~~~~~~~~~~~~~~~~~~~~~~~~
1048
1049 If you have multiple gateway nodes, you should disable the `rp_filter` (Strict
1050 Reverse Path Filter) option, because packets can arrive at one node but go out
1051 from another node.
1052
1053 Add the following to `/etc/sysctl.conf`:
1054
1055 -----
1056 net.ipv4.conf.default.rp_filter=0
1057 net.ipv4.conf.all.rp_filter=0
1058 -----
1059
1060 VXLAN IPSEC Encryption
1061 ~~~~~~~~~~~~~~~~~~~~~~
1062
1063 To add IPSEC encryption on top of a VXLAN, this example shows how to use
1064 `strongswan`.
1065
1066 You`ll need to reduce the 'MTU' by additional 60 bytes for IPv4 or 80 bytes for
1067 IPv6 to handle encryption.
1068
1069 So with default real 1500 MTU, you need to use a MTU of 1370 (1370 + 80 (IPSEC)
1070 + 50 (VXLAN) == 1500).
1071
1072 Install strongswan on the host.
1073
1074 ----
1075 apt install strongswan
1076 ----
1077
1078 Add configuration to `/etc/ipsec.conf`. We only need to encrypt traffic from
1079 the VXLAN UDP port '4789'.
1080
1081 ----
1082 conn %default
1083 ike=aes256-sha1-modp1024! # the fastest, but reasonably secure cipher on modern HW
1084 esp=aes256-sha1!
1085 leftfirewall=yes # this is necessary when using Proxmox VE firewall rules
1086
1087 conn output
1088 rightsubnet=%dynamic[udp/4789]
1089 right=%any
1090 type=transport
1091 authby=psk
1092 auto=route
1093
1094 conn input
1095 leftsubnet=%dynamic[udp/4789]
1096 type=transport
1097 authby=psk
1098 auto=route
1099 ----
1100
1101 Generate a pre-shared key with:
1102
1103 ----
1104 openssl rand -base64 128
1105 ----
1106
1107 and add the key to `/etc/ipsec.secrets`, so that the file contents looks like:
1108
1109 ----
1110 : PSK <generatedbase64key>
1111 ----
1112
1113 Copy the PSK and the configuration to all nodes participating in the VXLAN network.