Red Hat Enterprise Linux-9-Configuring and Managing Networking-En-US
Red Hat Enterprise Linux-9-Configuring and Managing Networking-En-US
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift,
Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States
and other countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the
official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other
countries and are used with the OpenStack Foundation's permission. We are not affiliated with,
endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
Using the networking capabilities of Red Hat Enterprise Linux (RHEL), you can configure your host
to meet your organization's network and security requirements. For example: You can configure
bonds, VLANs, bridges, tunnels and other network types to connect the host to the network. IPSec
and WireGuard provide secure VPNs between hosts and networks. RHEL also supports advanced
networking features, such as policy-based routing and Multipath TCP (MPTCP).
Table of Contents
Table of Contents
. . . . . . . . . . . . . FEEDBACK
PROVIDING . . . . . . . . . . . . ON
. . . .RED
. . . . .HAT
. . . . .DOCUMENTATION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9. . . . . . . . . . . . .
.CHAPTER
. . . . . . . . . . 1.. .IMPLEMENTING
. . . . . . . . . . . . . . . . . CONSISTENT
. . . . . . . . . . . . . . .NETWORK
. . . . . . . . . . .INTERFACE
. . . . . . . . . . . . .NAMING
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
..............
1.1. HOW THE UDEV DEVICE MANAGER RENAMES NETWORK INTERFACES 10
1.2. NETWORK INTERFACE NAMING POLICIES 11
1.3. NETWORK INTERFACE NAMING SCHEMES 12
1.4. SWITCHING TO A DIFFERENT NETWORK INTERFACE NAMING SCHEME 12
1.5. CUSTOMIZING THE PREFIX FOR ETHERNET INTERFACES DURING INSTALLATION 14
1.6. CONFIGURING USER-DEFINED NETWORK INTERFACE NAMES BY USING UDEV RULES 15
1.7. CONFIGURING USER-DEFINED NETWORK INTERFACE NAMES BY USING SYSTEMD LINK FILES 17
1.8. ASSIGNING ALTERNATIVE NAMES TO A NETWORK INTERFACE BY USING SYSTEMD LINK FILES 19
.CHAPTER
. . . . . . . . . . 2.
. . CONFIGURING
. . . . . . . . . . . . . . . . AN
. . . .ETHERNET
. . . . . . . . . . . .CONNECTION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
..............
2.1. CONFIGURING AN ETHERNET CONNECTION BY USING NMCLI 21
2.2. CONFIGURING AN ETHERNET CONNECTION BY USING THE NMCLI INTERACTIVE EDITOR 24
2.3. CONFIGURING AN ETHERNET CONNECTION BY USING NMTUI 27
2.4. CONFIGURING AN ETHERNET CONNECTION BY USING CONTROL-CENTER 30
2.5. CONFIGURING AN ETHERNET CONNECTION BY USING NM-CONNECTION-EDITOR 32
2.6. CONFIGURING AN ETHERNET CONNECTION WITH A STATIC IP ADDRESS BY USING NMSTATECTL 35
2.7. CONFIGURING AN ETHERNET CONNECTION WITH A STATIC IP ADDRESS BY USING THE NETWORK
RHEL SYSTEM ROLE WITH AN INTERFACE NAME 37
2.8. CONFIGURING AN ETHERNET CONNECTION WITH A STATIC IP ADDRESS BY USING THE NETWORK
RHEL SYSTEM ROLE WITH A DEVICE PATH 39
2.9. CONFIGURING AN ETHERNET CONNECTION WITH A DYNAMIC IP ADDRESS BY USING NMSTATECTL
40
2.10. CONFIGURING AN ETHERNET CONNECTION WITH A DYNAMIC IP ADDRESS BY USING THE NETWORK
RHEL SYSTEM ROLE WITH AN INTERFACE NAME 42
2.11. CONFIGURING AN ETHERNET CONNECTION WITH A DYNAMIC IP ADDRESS BY USING THE NETWORK
RHEL SYSTEM ROLE WITH A DEVICE PATH 43
2.12. CONFIGURING MULTIPLE ETHERNET INTERFACES BY USING A SINGLE CONNECTION PROFILE BY
INTERFACE NAME 45
2.13. CONFIGURING A SINGLE CONNECTION PROFILE FOR MULTIPLE ETHERNET INTERFACES USING PCI
IDS 46
.CHAPTER
. . . . . . . . . . 3.
. . CONFIGURING
................A
. . NETWORK
. . . . . . . . . . . .BOND
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
..............
3.1. UNDERSTANDING THE DEFAULT BEHAVIOR OF CONTROLLER AND PORT INTERFACES 48
3.2. UPSTREAM SWITCH CONFIGURATION DEPENDING ON THE BONDING MODES 48
3.3. CONFIGURING A NETWORK BOND BY USING NMCLI 49
3.4. CONFIGURING A NETWORK BOND BY USING THE RHEL WEB CONSOLE 52
3.5. CONFIGURING A NETWORK BOND BY USING NMTUI 55
3.6. CONFIGURING A NETWORK BOND BY USING NM-CONNECTION-EDITOR 58
3.7. CONFIGURING A NETWORK BOND BY USING NMSTATECTL 60
3.8. CONFIGURING A NETWORK BOND BY USING THE NETWORK RHEL SYSTEM ROLE 62
3.9. CREATING A NETWORK BOND TO ENABLE SWITCHING BETWEEN AN ETHERNET AND WIRELESS
CONNECTION WITHOUT INTERRUPTING THE VPN 64
3.10. THE DIFFERENT NETWORK BONDING MODES 67
3.11. THE XMIT_HASH_POLICY BONDING PARAMETER 68
. . . . . . . . . . . 4.
CHAPTER . . .CONFIGURING
. . . . . . . . . . . . . . . .NETWORK
. . . . . . . . . . .TEAMING
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
..............
4.1. MIGRATING A NETWORK TEAM CONFIGURATION TO NETWORK BOND 71
4.2. UNDERSTANDING THE DEFAULT BEHAVIOR OF CONTROLLER AND PORT INTERFACES 74
4.3. UNDERSTANDING THE TEAMD SERVICE, RUNNERS, AND LINK-WATCHERS 74
4.4. CONFIGURING A NETWORK TEAM BY USING NMCLI 75
1
Red Hat Enterprise Linux 9 Configuring and managing networking
.CHAPTER
. . . . . . . . . . 5.
. . CONFIGURING
. . . . . . . . . . . . . . . . VLAN
. . . . . . .TAGGING
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
..............
5.1. CONFIGURING VLAN TAGGING BY USING NMCLI 85
5.2. CONFIGURING NESTED VLANS BY USING NMCLI 87
5.3. CONFIGURING VLAN TAGGING BY USING THE RHEL WEB CONSOLE 89
5.4. CONFIGURING VLAN TAGGING BY USING NMTUI 91
5.5. CONFIGURING VLAN TAGGING BY USING NM-CONNECTION-EDITOR 95
5.6. CONFIGURING VLAN TAGGING BY USING NMSTATECTL 97
5.7. CONFIGURING VLAN TAGGING BY USING THE NETWORK RHEL SYSTEM ROLE 99
.CHAPTER
. . . . . . . . . . 6.
. . .CONFIGURING
...............A
. . NETWORK
. . . . . . . . . . . .BRIDGE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
...............
6.1. CONFIGURING A NETWORK BRIDGE BY USING NMCLI 101
6.2. CONFIGURING A NETWORK BRIDGE BY USING THE RHEL WEB CONSOLE 104
6.3. CONFIGURING A NETWORK BRIDGE BY USING NMTUI 106
6.4. CONFIGURING A NETWORK BRIDGE BY USING NM-CONNECTION-EDITOR 110
6.5. CONFIGURING A NETWORK BRIDGE BY USING NMSTATECTL 112
6.6. CONFIGURING A NETWORK BRIDGE BY USING THE NETWORK RHEL SYSTEM ROLE 114
. . . . . . . . . . . 7.
CHAPTER . . SETTING
. . . . . . . . . . UP
. . . .AN
. . . IPSEC
. . . . . . . VPN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
..............
7.1. CONFIGURING A VPN CONNECTION WITH CONTROL-CENTER 117
7.2. CONFIGURING A VPN CONNECTION USING NM-CONNECTION-EDITOR 121
7.3. CONFIGURING AUTOMATIC DETECTION AND USAGE OF ESP HARDWARE OFFLOAD TO ACCELERATE
AN IPSEC CONNECTION 124
7.4. CONFIGURING ESP HARDWARE OFFLOAD ON A BOND TO ACCELERATE AN IPSEC CONNECTION 125
7.5. CONFIGURING AN IPSEC BASED VPN CONNECTION BY USING NMSTATECTL 126
7.5.1. Configuring a host-to-subnet IPSec VPN with PKI authentication and tunnel mode by using nmstatectl
126
7.5.2. Configuring a host-to-subnet IPSec VPN with RSA authentication and tunnel mode by using nmstatectl
129
7.5.3. Configuring a host-to-subnet IPSec VPN with PSK authentication and tunnel mode by using nmstatectl
131
7.5.4. Configuring a host-to-host IPsec VPN with PKI authentication and tunnel mode by using nmstatectl 133
7.5.5. Configuring a host-to-host IPsec VPN with PSK authentication and transport mode by using nmstatectl
135
. . . . . . . . . . . 8.
CHAPTER . . .SETTING
. . . . . . . . . UP
. . . .A. .WIREGUARD
. . . . . . . . . . . . . VPN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138
...............
8.1. PROTOCOLS AND PRIMITIVES USED BY WIREGUARD 138
8.2. HOW WIREGUARD USES TUNNEL IP ADDRESSES, PUBLIC KEYS, AND REMOTE ENDPOINTS 139
8.3. USING A WIREGUARD CLIENT BEHIND NAT AND FIREWALLS 139
8.4. CREATING PRIVATE AND PUBLIC KEYS TO BE USED IN WIREGUARD CONNECTIONS 139
8.5. CONFIGURING A WIREGUARD SERVER BY USING NMCLI 140
8.6. CONFIGURING A WIREGUARD SERVER BY USING NMTUI 143
8.7. CONFIGURING A WIREGUARD SERVER BY USING THE RHEL WEB CONSOLE 146
8.8. CONFIGURING A WIREGUARD SERVER BY USING NM-CONNECTION-EDITOR 149
8.9. CONFIGURING A WIREGUARD SERVER BY USING THE WG-QUICK SERVICE 151
8.10. CONFIGURING FIREWALLD ON A WIREGUARD SERVER BY USING THE COMMAND LINE 153
8.11. CONFIGURING FIREWALLD ON A WIREGUARD SERVER BY USING THE RHEL WEB CONSOLE 154
8.12. CONFIGURING FIREWALLD ON A WIREGUARD SERVER BY USING THE GRAPHICAL INTERFACE 155
8.13. CONFIGURING A WIREGUARD CLIENT BY USING NMCLI 156
8.14. CONFIGURING A WIREGUARD CLIENT BY USING NMTUI 159
8.15. CONFIGURING A WIREGUARD CLIENT BY USING THE RHEL WEB CONSOLE 162
8.16. CONFIGURING A WIREGUARD CLIENT BY USING NM-CONNECTION-EDITOR 165
8.17. CONFIGURING A WIREGUARD CLIENT BY USING THE WG-QUICK SERVICE 167
2
Table of Contents
. . . . . . . . . . . 9.
CHAPTER . . .CONFIGURING
. . . . . . . . . . . . . . . IP
. . .TUNNELS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171
..............
9.1. CONFIGURING AN IPIP TUNNEL USING NMCLI TO ENCAPSULATE IPV4 TRAFFIC IN IPV4 PACKETS 171
9.2. CONFIGURING A GRE TUNNEL BY USING NMCLI TO ENCAPSULATE LAYER-3 TRAFFIC IN IPV4
PACKETS 174
9.3. CONFIGURING A GRETAP TUNNEL TO TRANSFER ETHERNET FRAMES OVER IPV4 176
9.4. ADDITIONAL RESOURCES 179
.CHAPTER
. . . . . . . . . . 10.
. . . USING
. . . . . . . .A. .VXLAN
. . . . . . . .TO
. . . CREATE
. . . . . . . . .A
. . VIRTUAL
. . . . . . . . . .LAYER-2
. . . . . . . . . .DOMAIN
. . . . . . . . .FOR
. . . . .VMS
. . . . . . . . . . . . . . . . . . . . . . . . . . .180
...............
10.1. BENEFITS OF VXLANS 180
10.2. CONFIGURING THE ETHERNET INTERFACE ON THE HOSTS 181
10.3. CREATING A NETWORK BRIDGE WITH A VXLAN ATTACHED 182
10.4. CREATING A VIRTUAL NETWORK IN LIBVIRT WITH AN EXISTING BRIDGE 183
10.5. CONFIGURING VIRTUAL MACHINES TO USE VXLAN 184
. . . . . . . . . . . 11.
CHAPTER . . .MANAGING
. . . . . . . . . . . . WIFI
. . . . . CONNECTIONS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186
...............
11.1. SUPPORTED WIFI SECURITY TYPES 186
11.2. CONNECTING TO A WIFI NETWORK BY USING NMCLI 186
11.3. CONNECTING TO A WIFI NETWORK BY USING THE GNOME SYSTEM MENU 188
11.4. CONNECTING TO A WIFI NETWORK BY USING THE GNOME SETTINGS APPLICATION 189
11.5. CONFIGURING A WIFI CONNECTION BY USING NMTUI 190
11.6. CONFIGURING A WIFI CONNECTION BY USING NM-CONNECTION-EDITOR 192
11.7. CONFIGURING A WIFI CONNECTION WITH 802.1X NETWORK AUTHENTICATION BY USING THE
NETWORK RHEL SYSTEM ROLE 194
11.8. CONFIGURING A WIFI CONNECTION WITH 802.1X NETWORK AUTHENTICATION IN AN EXISTING
PROFILE BY USING NMCLI 195
11.9. MANUALLY SETTING THE WIRELESS REGULATORY DOMAIN 197
. . . . . . . . . . . 12.
CHAPTER . . . CONFIGURING
. . . . . . . . . . . . . . . .RHEL
. . . . . . AS
. . . .A. .WPA2
. . . . . . OR
. . . .WPA3
. . . . . . .PERSONAL
. . . . . . . . . . . .ACCESS
. . . . . . . . .POINT
. . . . . . . . . . . . . . . . . . . . . . . . . . .199
...............
. . . . . . . . . . . 13.
CHAPTER . . . USING
. . . . . . . .MACSEC
. . . . . . . . . TO
. . . .ENCRYPT
. . . . . . . . . . LAYER-2
. . . . . . . . . . TRAFFIC
. . . . . . . . . .IN
. . .THE
. . . . SAME
. . . . . . .PHYSICAL
. . . . . . . . . . . NETWORK
. . . . . . . . . . . . . . . . .202
...............
13.1. CONFIGURING A MACSEC CONNECTION BY USING NMCLI 202
13.2. CONFIGURING A MACSEC CONNECTION USING NMSTATECTL 204
13.3. ADDITIONAL RESOURCES 206
. . . . . . . . . . . 14.
CHAPTER . . . GETTING
. . . . . . . . . . .STARTED
. . . . . . . . . .WITH
. . . . . .IPVLAN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207
...............
14.1. IPVLAN MODES 207
14.2. COMPARISON OF IPVLAN AND MACVLAN 207
14.3. CREATING AND CONFIGURING THE IPVLAN DEVICE USING IPROUTE2 208
. . . . . . . . . . . 15.
CHAPTER . . . CONFIGURING
. . . . . . . . . . . . . . . . NETWORKMANAGER
. . . . . . . . . . . . . . . . . . . . . . .TO
. . . IGNORE
. . . . . . . . .CERTAIN
. . . . . . . . . .DEVICES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210
...............
15.1. CONFIGURING THE LOOPBACK INTERFACE BY USING NMCLI 210
15.2. PERMANENTLY CONFIGURING A DEVICE AS UNMANAGED IN NETWORKMANAGER 211
15.3. TEMPORARILY CONFIGURING A DEVICE AS UNMANAGED IN NETWORKMANAGER 212
. . . . . . . . . . . 16.
CHAPTER . . . CREATING
. . . . . . . . . . . .A. .DUMMY
. . . . . . . . .INTERFACE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214
...............
16.1. CREATING A DUMMY INTERFACE WITH BOTH AN IPV4 AND IPV6 ADDRESS BY USING NMCLI 214
. . . . . . . . . . . 17.
CHAPTER . . . USING
. . . . . . . NETWORKMANAGER
. . . . . . . . . . . . . . . . . . . . . . .TO
. . . DISABLE
. . . . . . . . . . IPV6
. . . . . .FOR
....A
. . SPECIFIC
. . . . . . . . . . .CONNECTION
. . . . . . . . . . . . . . . . . . . . . . . . . . . 215
...............
17.1. DISABLING IPV6 ON A CONNECTION USING NMCLI 215
. . . . . . . . . . . 18.
CHAPTER . . . CHANGING
. . . . . . . . . . . . .A. .HOSTNAME
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
...............
18.1. CHANGING A HOSTNAME BY USING NMCLI 217
18.2. CHANGING A HOSTNAME USING HOSTNAMECTL 217
. . . . . . . . . . . 19.
CHAPTER . . . CONFIGURING
. . . . . . . . . . . . . . . . NETWORKMANAGER
. . . . . . . . . . . . . . . . . . . . . . .DHCP
. . . . . . SETTINGS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
...............
19.1. CHANGING THE DHCP CLIENT OF NETWORKMANAGER 219
3
Red Hat Enterprise Linux 9 Configuring and managing networking
.CHAPTER
. . . . . . . . . . 20.
. . . .RUNNING
. . . . . . . . . . DHCLIENT
. . . . . . . . . . . .EXIT
. . . . . HOOKS
. . . . . . . . .USING
. . . . . . .NETWORKMANAGER
. . . . . . . . . . . . . . . . . . . . . .A
. . DISPATCHER
. . . . . . . . . . . . . . SCRIPT
. . . . . . . . . . . 221
...............
20.1. THE CONCEPT OF NETWORKMANAGER DISPATCHER SCRIPTS 221
20.2. CREATING A NETWORKMANAGER DISPATCHER SCRIPT THAT RUNS DHCLIENT EXIT HOOKS 221
. . . . . . . . . . . 21.
CHAPTER . . . MANUALLY
. . . . . . . . . . . . .CONFIGURING
. . . . . . . . . . . . . . . .THE
. . . . ./ETC/RESOLV.CONF
. . . . . . . . . . . . . . . . . . . . . .FILE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223
...............
21.1. DISABLING DNS PROCESSING IN THE NETWORKMANAGER CONFIGURATION 223
21.2. REPLACING /ETC/RESOLV.CONF WITH A SYMBOLIC LINK TO MANUALLY CONFIGURE DNS SETTINGS
224
. . . . . . . . . . . 22.
CHAPTER . . . .CONFIGURING
. . . . . . . . . . . . . . . .THE
. . . . ORDER
. . . . . . . . OF
. . . .DNS
. . . . .SERVERS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225
...............
22.1. HOW NETWORKMANAGER ORDERS DNS SERVERS IN /ETC/RESOLV.CONF 225
Default values of DNS priority parameters 225
Valid DNS priority values: 225
22.2. SETTING A NETWORKMANAGER-WIDE DEFAULT DNS SERVER PRIORITY VALUE 226
22.3. SETTING THE DNS PRIORITY OF A NETWORKMANAGER CONNECTION 227
. . . . . . . . . . . 23.
CHAPTER . . . .USING
. . . . . . .DIFFERENT
. . . . . . . . . . . . .DNS
. . . . .SERVERS
. . . . . . . . . .FOR
. . . . .DIFFERENT
. . . . . . . . . . . . DOMAINS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228
...............
23.1. USING DNSMASQ IN NETWORKMANAGER TO SEND DNS REQUESTS FOR A SPECIFIC DOMAIN TO A
SELECTED DNS SERVER 228
23.2. USING SYSTEMD-RESOLVED IN NETWORKMANAGER TO SEND DNS REQUESTS FOR A SPECIFIC
DOMAIN TO A SELECTED DNS SERVER 230
. . . . . . . . . . . 24.
CHAPTER . . . .MANAGING
. . . . . . . . . . . . THE
. . . . . DEFAULT
. . . . . . . . . . .GATEWAY
. . . . . . . . . . .SETTING
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233
...............
24.1. SETTING THE DEFAULT GATEWAY ON AN EXISTING CONNECTION BY USING NMCLI 233
24.2. SETTING THE DEFAULT GATEWAY ON AN EXISTING CONNECTION BY USING THE NMCLI
INTERACTIVE MODE 234
24.3. SETTING THE DEFAULT GATEWAY ON AN EXISTING CONNECTION BY USING NM-CONNECTION-
EDITOR 235
24.4. SETTING THE DEFAULT GATEWAY ON AN EXISTING CONNECTION BY USING CONTROL-CENTER
237
24.5. SETTING THE DEFAULT GATEWAY ON AN EXISTING CONNECTION BY USING NMSTATECTL 238
24.6. SETTING THE DEFAULT GATEWAY ON AN EXISTING CONNECTION BY USING THE NETWORK RHEL
SYSTEM ROLE 239
24.7. HOW NETWORKMANAGER MANAGES MULTIPLE DEFAULT GATEWAYS 240
24.8. CONFIGURING NETWORKMANAGER TO AVOID USING A SPECIFIC PROFILE TO PROVIDE A DEFAULT
GATEWAY 242
24.9. FIXING UNEXPECTED ROUTING BEHAVIOR DUE TO MULTIPLE DEFAULT GATEWAYS 242
. . . . . . . . . . . 25.
CHAPTER . . . .CONFIGURING
. . . . . . . . . . . . . . . .A. .STATIC
. . . . . . . .ROUTE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
...............
25.1. EXAMPLE OF A NETWORK THAT REQUIRES STATIC ROUTES 245
25.2. HOW TO USE THE NMCLI UTILITY TO CONFIGURE A STATIC ROUTE 247
25.3. CONFIGURING A STATIC ROUTE BY USING NMCLI 248
25.4. CONFIGURING A STATIC ROUTE BY USING NMTUI 249
25.5. CONFIGURING A STATIC ROUTE BY USING CONTROL-CENTER 251
25.6. CONFIGURING A STATIC ROUTE BY USING NM-CONNECTION-EDITOR 253
25.7. CONFIGURING A STATIC ROUTE BY USING THE NMCLI INTERACTIVE MODE 254
25.8. CONFIGURING A STATIC ROUTE BY USING NMSTATECTL 256
25.9. CONFIGURING A STATIC ROUTE BY USING THE NETWORK RHEL SYSTEM ROLE 257
. . . . . . . . . . . 26.
CHAPTER . . . .CONFIGURING
. . . . . . . . . . . . . . . .POLICY-BASED
. . . . . . . . . . . . . . . . .ROUTING
. . . . . . . . . .TO
. . . .DEFINE
. . . . . . . .ALTERNATIVE
. . . . . . . . . . . . . . . ROUTES
. . . . . . . . . . . . . . . . . . . . . 260
................
26.1. ROUTING TRAFFIC FROM A SPECIFIC SUBNET TO A DIFFERENT DEFAULT GATEWAY BY USING
NMCLI 260
26.2. ROUTING TRAFFIC FROM A SPECIFIC SUBNET TO A DIFFERENT DEFAULT GATEWAY BY USING THE
NETWORK RHEL SYSTEM ROLE 263
4
Table of Contents
. . . . . . . . . . . 27.
CHAPTER . . . .REUSING
. . . . . . . . . .THE
. . . . .SAME
. . . . . . IP
. . .ADDRESS
. . . . . . . . . . ON
. . . . DIFFERENT
. . . . . . . . . . . . .INTERFACES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .268
...............
27.1. PERMANENTLY REUSING THE SAME IP ADDRESS ON DIFFERENT INTERFACES 268
27.2. TEMPORARILY REUSING THE SAME IP ADDRESS ON DIFFERENT INTERFACES 269
27.3. ADDITIONAL RESOURCES 271
. . . . . . . . . . . 28.
CHAPTER . . . .STARTING
. . . . . . . . . . .A
. . SERVICE
. . . . . . . . . .WITHIN
. . . . . . . .AN
. . . .ISOLATED
. . . . . . . . . . .VRF
. . . . .NETWORK
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272
...............
28.1. CONFIGURING A VRF DEVICE 272
28.2. STARTING A SERVICE WITHIN AN ISOLATED VRF NETWORK 273
. . . . . . . . . . . 29.
CHAPTER . . . .CONFIGURING
. . . . . . . . . . . . . . . .ETHTOOL
. . . . . . . . . . .SETTINGS
. . . . . . . . . . .IN
. . .NETWORKMANAGER
. . . . . . . . . . . . . . . . . . . . . .CONNECTION
. . . . . . . . . . . . . . . PROFILES
. . . . . . . . . . . . . .276
...............
29.1. CONFIGURING AN ETHTOOL OFFLOAD FEATURE BY USING NMCLI 276
29.2. CONFIGURING AN ETHTOOL OFFLOAD FEATURE BY USING THE NETWORK RHEL SYSTEM ROLE
277
29.3. CONFIGURING AN ETHTOOL COALESCE SETTINGS BY USING NMCLI 279
29.4. CONFIGURING AN ETHTOOL COALESCE SETTINGS BY USING THE NETWORK RHEL SYSTEM ROLE
279
29.5. INCREASING THE RING BUFFER SIZE TO REDUCE A HIGH PACKET DROP RATE BY USING NMCLI 281
29.6. INCREASING THE RING BUFFER SIZE TO REDUCE A HIGH PACKET DROP RATE BY USING THE
NETWORK RHEL SYSTEM ROLE 283
29.7. CONFIGURING AN ETHTOOL CHANNELS SETTINGS BY USING NMCLI 285
. . . . . . . . . . . 30.
CHAPTER . . . .INTRODUCTION
. . . . . . . . . . . . . . . . . TO
. . . .NETWORKMANAGER
. . . . . . . . . . . . . . . . . . . . . . DEBUGGING
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287
...............
30.1. INTRODUCTION TO NETWORKMANAGER REAPPLY METHOD 287
30.2. SETTING THE NETWORKMANAGER LOG LEVEL 289
30.3. TEMPORARILY SETTING LOG LEVELS AT RUN TIME USING NMCLI 290
30.4. VIEWING NETWORKMANAGER LOGS 291
30.5. DEBUGGING LEVELS AND DOMAINS 291
. . . . . . . . . . . 31.
CHAPTER . . . USING
. . . . . . . .LLDP
. . . . . .TO
. . . DEBUG
. . . . . . . . NETWORK
. . . . . . . . . . . .CONFIGURATION
. . . . . . . . . . . . . . . . . . .PROBLEMS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .293
...............
31.1. DEBUGGING AN INCORRECT VLAN CONFIGURATION USING LLDP INFORMATION 293
. . . . . . . . . . . 32.
CHAPTER . . . .LINUX
. . . . . . .TRAFFIC
. . . . . . . . . CONTROL
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296
...............
32.1. OVERVIEW OF QUEUING DISCIPLINES 296
32.2. INTRODUCTION TO CONNECTION TRACKING 296
32.3. INSPECTING QDISCS OF A NETWORK INTERFACE USING THE TC UTILITY 297
32.4. UPDATING THE DEFAULT QDISC 298
32.5. TEMPORARILY SETTING THE CURRENT QDISC OF A NETWORK INTERFACE USING THE TC UTILITY
298
32.6. PERMANENTLY SETTING THE CURRENT QDISC OF A NETWORK INTERFACE USING
NETWORKMANAGER 299
32.7. CONFIGURING THE RATE LIMITING OF PACKETS BY USING THE TC-CTINFO UTILITY 300
32.8. AVAILABLE QDISCS IN RHEL 304
CHAPTER 33. AUTHENTICATING A RHEL CLIENT TO THE NETWORK BY USING THE 802.1X STANDARD
. . . . . . .A. CERTIFICATE
WITH . . . . . . . . . . . . . . .STORED
. . . . . . . . . ON
. . . . THE
. . . . .FILE
. . . . .SYSTEM
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
................
33.1. CONFIGURING 802.1X NETWORK AUTHENTICATION ON AN EXISTING ETHERNET CONNECTION BY
USING NMCLI 306
33.2. CONFIGURING A STATIC ETHERNET CONNECTION WITH 802.1X NETWORK AUTHENTICATION BY
USING NMSTATECTL 307
33.3. CONFIGURING A STATIC ETHERNET CONNECTION WITH 802.1X NETWORK AUTHENTICATION BY
USING THE NETWORK RHEL SYSTEM ROLE 309
33.4. CONFIGURING A WIFI CONNECTION WITH 802.1X NETWORK AUTHENTICATION BY USING THE
NETWORK RHEL SYSTEM ROLE 311
CHAPTER 34. SETTING UP AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING
. . . . . . . . . . . .WITH
HOSTAPD . . . . . .FREERADIUS
. . . . . . . . . . . . . .BACKEND
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
...............
5
Red Hat Enterprise Linux 9 Configuring and managing networking
.CHAPTER
. . . . . . . . . . 35.
. . . .GETTING
. . . . . . . . . .STARTED
. . . . . . . . . . WITH
. . . . . . MULTIPATH
. . . . . . . . . . . . . TCP
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
................
35.1. UNDERSTANDING MPTCP 330
35.2. PREPARING RHEL TO ENABLE MPTCP SUPPORT 330
35.3. USING IPROUTE2 TO TEMPORARILY CONFIGURE AND ENABLE MULTIPLE PATHS FOR MPTCP
APPLICATIONS 331
35.4. PERMANENTLY CONFIGURING MULTIPLE PATHS FOR MPTCP APPLICATIONS 333
35.5. MONITORING MPTCP SUB-FLOWS 335
35.6. DISABLING MULTIPATH TCP IN THE KERNEL 338
. . . . . . . . . . . 36.
CHAPTER . . . .MANAGING
. . . . . . . . . . . . THE
. . . . . MPTCPD
. . . . . . . . . .SERVICE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .339
...............
36.1. CONFIGURING MPTCPD 339
36.2. MANAGING APPLICATIONS WITH MPTCPIZE TOOL 339
36.3. ENABLING MPTCP SOCKETS FOR A SERVICES USING THE MPTCPIZE UTILITY 340
.CHAPTER
. . . . . . . . . . 37.
. . . .NETWORKMANAGER
. . . . . . . . . . . . . . . . . . . . . . CONNECTION
. . . . . . . . . . . . . . . PROFILES
. . . . . . . . . . . IN
. . . KEYFILE
. . . . . . . . . .FORMAT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .341
...............
37.1. THE KEYFILE FORMAT OF NETWORKMANAGER PROFILES 341
37.2. USING NMCLI TO CREATE KEYFILE CONNECTION PROFILES IN OFFLINE MODE 342
37.3. MANUALLY CREATING A NETWORKMANAGER PROFILE IN KEYFILE FORMAT 344
37.4. THE DIFFERENCES IN INTERFACE RENAMING WITH PROFILES IN IFCFG AND KEYFILE FORMAT 346
37.5. MIGRATING NETWORKMANAGER PROFILES FROM IFCFG TO KEYFILE FORMAT 346
.CHAPTER
. . . . . . . . . . 38.
. . . .SYSTEMD
. . . . . . . . . . .NETWORK
. . . . . . . . . . . TARGETS
. . . . . . . . . . .AND
. . . . .SERVICES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
................
38.1. DIFFERENCES BETWEEN THE NETWORK AND NETWORK-ONLINE SYSTEMD TARGET 348
38.2. OVERVIEW OF NETWORKMANAGER-WAIT-ONLINE 348
38.3. CONFIGURING A SYSTEMD SERVICE TO START AFTER THE NETWORK HAS BEEN STARTED 349
. . . . . . . . . . . 39.
CHAPTER . . . .INTRODUCTION
. . . . . . . . . . . . . . . . .TO
. . . .NMSTATE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
................
39.1. USING THE LIBNMSTATE LIBRARY IN A PYTHON APPLICATION 350
39.2. UPDATING THE CURRENT NETWORK CONFIGURATION USING NMSTATECTL 350
39.3. THE NMSTATE SYSTEMD SERVICE 351
39.4. NETWORK STATES FOR THE NETWORK RHEL SYSTEM ROLE 351
39.5. ADDITIONAL RESOURCES 353
. . . . . . . . . . . 40.
CHAPTER . . . .CAPTURING
. . . . . . . . . . . . . NETWORK
. . . . . . . . . . . .PACKETS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .354
...............
40.1. USING XDPDUMP TO CAPTURE NETWORK PACKETS INCLUDING PACKETS DROPPED BY XDP
PROGRAMS 354
40.2. ADDITIONAL RESOURCES 355
. . . . . . . . . . . 41.
CHAPTER . . . UNDERSTANDING
. . . . . . . . . . . . . . . . . . . .THE
. . . . EBPF
. . . . . . .NETWORKING
. . . . . . . . . . . . . . .FEATURES
. . . . . . . . . . . .IN
. . RHEL
. . . . . . .9. . . . . . . . . . . . . . . . . . . . . . . . . .356
...............
41.1. OVERVIEW OF NETWORKING EBPF FEATURES IN RHEL 9 356
XDP 356
AF_XDP 357
Traffic Control 357
Socket filter 357
Control Groups 358
6
Table of Contents
. . . . . . . . . . . 42.
CHAPTER . . . .NETWORK
. . . . . . . . . . . TRACING
. . . . . . . . . . USING
. . . . . . . .THE
. . . . .BPF
. . . . COMPILER
. . . . . . . . . . . . COLLECTION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .362
...............
42.1. INSTALLING THE BCC-TOOLS PACKAGE 362
42.2. DISPLAYING TCP CONNECTIONS ADDED TO THE KERNEL’S ACCEPT QUEUE 362
42.3. TRACING OUTGOING TCP CONNECTION ATTEMPTS 363
42.4. MEASURING THE LATENCY OF OUTGOING TCP CONNECTIONS 364
42.5. DISPLAYING DETAILS ABOUT TCP PACKETS AND SEGMENTS THAT WERE DROPPED BY THE KERNEL
364
42.6. TRACING TCP SESSIONS 365
42.7. TRACING TCP RETRANSMISSIONS 366
42.8. DISPLAYING TCP STATE CHANGE INFORMATION 366
42.9. SUMMARIZING AND AGGREGATING TCP TRAFFIC SENT TO SPECIFIC SUBNETS 367
42.10. DISPLAYING THE NETWORK THROUGHPUT BY IP ADDRESS AND PORT 368
42.11. TRACING ESTABLISHED TCP CONNECTIONS 368
42.12. TRACING IPV4 AND IPV6 LISTEN ATTEMPTS 369
42.13. SUMMARIZING THE SERVICE TIME OF SOFT INTERRUPTS 369
42.14. SUMMARIZING PACKETS SIZE AND COUNT ON A NETWORK INTERFACE 370
42.15. ADDITIONAL RESOURCES 371
.CHAPTER
. . . . . . . . . . 43.
. . . .CONFIGURING
. . . . . . . . . . . . . . . .NETWORK
. . . . . . . . . . . DEVICES
. . . . . . . . . .TO
. . . .ACCEPT
. . . . . . . . .TRAFFIC
. . . . . . . . . FROM
. . . . . . . ALL
. . . . .MAC
. . . . . ADDRESSES
. . . . . . . . . . . . . . . .372
...............
43.1. TEMPORARILY CONFIGURING A DEVICE TO ACCEPT ALL TRAFFIC 372
43.2. PERMANENTLY CONFIGURING A NETWORK DEVICE TO ACCEPT ALL TRAFFIC USING NMCLI 373
43.3. PERMANENTLY CONFIGURING A NETWORK DEVICE TO ACCEPT ALL TRAFFIC USING NMSTATECTL
373
. . . . . . . . . . . 44.
CHAPTER . . . .MIRRORING
. . . . . . . . . . . . .A. .NETWORK
. . . . . . . . . . . INTERFACE
. . . . . . . . . . . . .BY
. . . USING
. . . . . . . .NMCLI
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .375
...............
.CHAPTER
. . . . . . . . . . 46.
. . . .CONFIGURING
. . . . . . . . . . . . . . . .802.3
. . . . . . LINK
. . . . . .SETTINGS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
................
46.1. CONFIGURING 802.3 LINK SETTINGS USING THE NMCLI UTILITY 380
.CHAPTER
. . . . . . . . . . 47.
. . . .GETTING
. . . . . . . . . .STARTED
. . . . . . . . . . WITH
. . . . . . DPDK
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382
...............
47.1. INSTALLING THE DPDK PACKAGE 382
47.2. ADDITIONAL RESOURCES 382
.CHAPTER
. . . . . . . . . . 48.
. . . .GETTING
. . . . . . . . . . STARTED
. . . . . . . . . . .WITH
. . . . . .TIPC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383
...............
48.1. THE ARCHITECTURE OF TIPC 383
48.2. LOADING THE TIPC MODULE WHEN THE SYSTEM BOOTS 383
48.3. CREATING A TIPC NETWORK 384
48.4. ADDITIONAL RESOURCES 385
CHAPTER 49. AUTOMATICALLY CONFIGURING NETWORK INTERFACES IN PUBLIC CLOUDS USING NM-
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
CLOUD-SETUP ................
49.1. CONFIGURING AND PRE-DEPLOYING NM-CLOUD-SETUP 386
49.2. UNDERSTANDING THE ROLE OF IMDSV2 AND NM-CLOUD-SETUP IN THE RHEL EC2 INSTANCE 387
7
Red Hat Enterprise Linux 9 Configuring and managing networking
8
PROVIDING FEEDBACK ON RED HAT DOCUMENTATION
4. Enter your suggestion for improvement in the Description field. Include links to the relevant
parts of the documentation.
9
Red Hat Enterprise Linux 9 Configuring and managing networking
Without consistent device naming, the Linux kernel assigns names to network interfaces by combining a
fixed prefix and an index. The index increases as the kernel initializes the network devices. For example,
eth0 represents the first Ethernet device being probed on start-up. If you add another network interface
controller to the system, the assignment of the kernel device names is no longer fixed because, after a
reboot, the devices can initialize in a different order. In that case, the kernel can name the devices
differently.
To solve this problem, udev assigns consistent device names. This has the following advantages:
The network naming is stateless and does not require explicit configuration files.
WARNING
Generally, Red Hat does not support systems where consistent device naming is
disabled. For exceptions, see the Is it safe to set net.ifnames=0 solution.
1. Optional: /usr/lib/udev/rules.d/60-net.rules
This file exists only if you install the initscripts-rename-device package. The
/usr/lib/udev/rules.d/60-net.rules file defines that the deprecated
/usr/lib/udev/rename_device helper utility searches for the HWADDR parameter in
/etc/sysconfig/network-scripts/ifcfg-* files. If the value set in the variable matches the MAC
address of an interface, the helper utility renames the interface to the name set in the DEVICE
parameter of the ifcfg file.
If the system uses only NetworkManager connection profiles in keyfile format, udev skips this
step.
10
CHAPTER 1. IMPLEMENTING CONSISTENT NETWORK INTERFACE NAMING
NOTE
3. /usr/lib/udev/rules.d/75-net-description.rules
This file defines how udev examines the network interface and sets the properties in udev-
internal variables. These variables are then processed in the next step by the
/usr/lib/udev/rules.d/80-net-setup-link.rules file. Some of the properties can be undefined.
4. /usr/lib/udev/rules.d/80-net-setup-link.rules
This file calls the net_setup_link builtin of the udev service, and udev renames the interface
based on the order of the policies in the NamePolicy parameter in the
/usr/lib/systemd/network/99-default.link file. For further details, see Network interface
naming policies.
If none of the policies applies, udev does not rename the interface.
Additional resources
Why are systemd network interface names different between major RHEL versions solution
The following table describes the different actions of udev based on which policy matches first as
specified by the NamePolicy parameter:
keep If the device already has a name that was assigned in the user
space, udev does not rename this device. For example, this is
the case if the name was assigned during device creation or by a
rename operation.
database This policy assigns names based on mappings in the udev idrac
hardware database. For details, see the hwdb(7) man page.
11
Red Hat Enterprise Linux 9 Configuring and managing networking
path Device names incorporate the physical location of the connector enp1s0
of the hardware.
mac Device names incorporate the MAC address. By default, Red Hat enx525400d5e0f
Enterprise Linux does not use this policy, but administrators can b
enable it.
Additional resources
If a new udev version changes how the service creates names for certain interfaces, Red Hat adds a new
scheme version and documents the details in the systemd.net-naming-scheme(7) man page. By
default, Red Hat Enterprise Linux (RHEL) 9 uses the rhel-9.0 naming scheme, even if you install or
update to a later minor version of RHEL.
To prevent new drivers from providing more or other attributes for a network interface, the rhel-net-
naming-sysattrs package provides the /usr/lib/udev/hwdb.d/50-net-naming-sysattr-allowlist.hwdb
database. This database defines which sysfs values the udev service can use to create network
interface names. The entries in the database are also versioned and influenced by the scheme version.
NOTE
On RHEL 9.4 and later, you can also use all rhel-8.* naming schemes.
If you want to use a scheme other than the default, you can switch the network interface naming
scheme.
For further details about the naming schemes for different device types and platforms, see the
systemd.net-naming-scheme(7) man page.
A new scheme can help to better identify a device if it adds additional attributes, such as a slot
number, to an interface name.
An new scheme can prevent udev from falling back to the kernel-assigned device names ( eth*).
12
CHAPTER 1. IMPLEMENTING CONSISTENT NETWORK INTERFACE NAMING
An new scheme can prevent udev from falling back to the kernel-assigned device names ( eth*).
This happens if the driver does not provide enough unique attributes for two or more interfaces
to generate unique names for them.
Prerequisites
Procedure
# ip link show
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP
mode DEFAULT group default qlen 1000
link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff
...
# reboot
5. Based on the MAC addresses you recorded, identify the new names of network interfaces that
have changed due to the different naming scheme:
# ip link show
2: eno1np0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state
UP mode DEFAULT group default qlen 1000
link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff
...
After switching the scheme, udev names in this example the device with MAC address
00:00:5e:00:53:1a eno1np0, whereas it was named eno1 before.
6. Identify which NetworkManager connection profile uses an interface with the previous name:
13
Red Hat Enterprise Linux 9 Configuring and managing networking
eno1 example_profile
...
7. Set the connection.interface-name property in the connection profile to the new interface
name:
Verification
Identify the naming scheme that RHEL now uses by displaying the ID_NET_NAMING_SCHEME
property of a network interface:
Additional resources
IMPORTANT
Red Hat supports systems with customized Ethernet prefixes only if you set the prefix
during the RHEL installation. Using the prefixdevname utility on already deployed
systems is not supported.
If you set a device prefix during the installation, the udev service uses the <prefix><index> format for
Ethernet interfaces after the installation. For example, if you set the prefix net, the service assigns the
names net0, net1, and so on to the Ethernet interfaces.
The udev service appends the index to the custom prefix, and preserves the index values of known
Ethernet interfaces. If you add an interface, udev assigns an index value that is one greater than the
previously-assigned index value to the new interface.
Prerequisites
14
CHAPTER 1. IMPLEMENTING CONSISTENT NETWORK INTERFACE NAMING
The prefix does not conflict with any other well-known network interface prefix, such as eth,
eno, ens, and em.
Procedure
Verification
# ip link show
...
2: net0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP
mode DEFAULT group default qlen 1000
link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff
...
Additional resources
Procedure
# ip link show
...
enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP
mode DEFAULT group default qlen 1000
link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff
...
15
Red Hat Enterprise Linux 9 Configuring and managing networking
# cat /sys/class/net/enp1s0/type
1
3. Create the /etc/udev/rules.d/70-persistent-net.rules file, and add a rule for each interface that
you want to rename:
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="<MAC_address>",ATTR{type}=="<
device_type_id>",NAME="<new_interface_name>"
IMPORTANT
For example, use the following rule to rename the interface with MAC address
00:00:5e:00:53:1a to provider0:
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="00:00:5e:00:53:1a",ATTR{type}=="
1",NAME="provider0"
# dracut -f
You require this step only if you need networking capabilities in the RAM disk. For example, this
is the case if the root file system is stored on a network device, such as iSCSI.
5. Identify which NetworkManager connection profile uses the interface that you want to rename:
7. Temporarily, configure the connection profile to match both the new and the previous interface
name:
# reboot
9. Verify that the device with the MAC address that you specified in the link file has been renamed
to provider0:
# ip link show
16
CHAPTER 1. IMPLEMENTING CONSISTENT NETWORK INTERFACE NAMING
10. Configure the connection profile to match only the new interface name:
You have now removed the old interface name from the connection profile.
Additional resources
Prerequisites
You must meet one of these conditions: NetworkManager does not manage this interface, or
the corresponding connection profile uses the keyfile format.
Procedure
# ip link show
...
enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP
mode DEFAULT group default qlen 1000
link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff
...
# mkdir -p /etc/systemd/network/
3. For each interface that you want to rename, create a 70-*.link file in the /etc/systemd/network/
directory with the following content:
[Match]
MACAddress=<MAC_address>
17
Red Hat Enterprise Linux 9 Configuring and managing networking
[Link]
Name=<new_interface_name>
IMPORTANT
Use a file name with a 70- prefix to keep the file names consistent with the udev
rules-based solution.
[Match]
MACAddress=00:00:5e:00:53:1a
[Link]
Name=provider0
# dracut -f
You require this step only if you need networking capabilities in the RAM disk. For example, this
is the case if the root file system is stored on a network device, such as iSCSI.
5. Identify which NetworkManager connection profile uses the interface that you want to rename:
7. Temporarily, configure the connection profile to match both the new and the previous interface
name:
# reboot
9. Verify that the device with the MAC address that you specified in the link file has been renamed
to provider0:
# ip link show
provider0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode
DEFAULT group default qlen 1000
link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff
...
18
CHAPTER 1. IMPLEMENTING CONSISTENT NETWORK INTERFACE NAMING
10. Configure the connection profile to match only the new interface name:
You have now removed the old interface name from the connection profile.
Additional resources
Prerequisites
Procedure
# ip link show
...
enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP
mode DEFAULT group default qlen 1000
link/ether 00:00:5e:00:53:1a brd ff:ff:ff:ff:ff:ff
...
Record the MAC address of the interface to which you want to assign an alternative name.
# mkdir -p /etc/systemd/network/
3. For each interface that must have an alternative name, create a *.link file in the
/etc/systemd/network/ directory with the following content:
[Match]
MACAddress=<MAC_address>
[Link]
19
Red Hat Enterprise Linux 9 Configuring and managing networking
AlternativeName=<alternative_interface_name_1>
AlternativeName=<alternative_interface_name_2>
AlternativeName=<alternative_interface_name_n>
For example, create the /etc/systemd/network/70-altname.link file with the following content
to assign provider as an alternative name to the interface with MAC address
00:00:5e:00:53:1a:
[Match]
MACAddress=00:00:5e:00:53:1a
[Link]
AlternativeName=provider
# dracut -f
# reboot
Verification
Use the alternative interface name. For example, display the IP address settings of the device
with the alternative name provider:
Additional resources
20
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
You require multiple profiles because the host roams among different networks.
Red Hat Enterprise Linux provides administrators different options to configure Ethernet connections.
For example:
Use RHEL system roles to automate the configuration of connections on one or multiple hosts.
NOTE
If you want to manually configure Ethernet connections on hosts running in the Microsoft
Azure cloud, disable the cloud-init service or configure it to ignore the network settings
retrieved from the cloud environment. Otherwise, cloud-init will override on the next
reboot the network settings that you have manually configured.
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
Procedure
By default, NetworkManager creates a profile for each NIC in the host. If you plan to connect
this NIC only to a specific network, adapt the automatically-created profile. If you plan to
connect this NIC to networks with different settings, create individual profiles for each network.
21
Red Hat Enterprise Linux 9 Configuring and managing networking
On hosts with multiple profiles, a meaningful name makes it easier to identify the purpose of a
profile.
To set a static IPv4 address, network mask, default gateway, DNS servers, and search
domain, enter:
To set a static IPv6 address, network mask, default gateway, DNS servers, and search
domain, enter:
22
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
Verification
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
5. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Troubleshooting
Verify that the network cable is plugged-in to the host and a switch.
Check whether the link failure exists only on this host or also on other hosts connected to the
same switch.
Verify that the network cable and the network interface are working as expected. Perform
23
Red Hat Enterprise Linux 9 Configuring and managing networking
Verify that the network cable and the network interface are working as expected. Perform
hardware diagnosis steps and replace defect cables and network interface cards.
If the configuration on the disk does not match the configuration on the device, starting or
restarting NetworkManager creates an in-memory connection that reflects the configuration of
the device. For further details and how to avoid this problem, see the NetworkManager
duplicates a connection after restart of NetworkManager service solution.
Additional resources
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
Procedure
By default, NetworkManager creates a profile for each NIC in the host. If you plan to connect
this NIC only to a specific network, adapt the automatically-created profile. If you plan to
connect this NIC to networks with different settings, create individual profiles for each network.
On hosts with multiple profiles, a meaningful name makes it easier to identify the purpose of a
profile.
Do not use quotes to set an ID that contains spaces to avoid that nmcli makes the quotes part
24
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
Do not use quotes to set an ID that contains spaces to avoid that nmcli makes the quotes part
of the name. For example, to set Example Connection as ID, enter set connection.id Example
Connection.
nmcli> print
...
connection.interface-name: enp1s0
connection.autoconnect: yes
ipv4.method: auto
ipv6.method: auto
...
To set a static IPv4 address, network mask, default gateway, DNS servers, and search
domain, enter:
To set a static IPv6 address, network mask, default gateway, DNS servers, and search
domain, enter:
25
Red Hat Enterprise Linux 9 Configuring and managing networking
nmcli> quit
Verification
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
5. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Troubleshooting
Verify that the network cable is plugged-in to the host and a switch.
Check whether the link failure exists only on this host or also on other hosts connected to the
same switch.
Verify that the network cable and the network interface are working as expected. Perform
hardware diagnosis steps and replace defect cables and network interface cards.
If the configuration on the disk does not match the configuration on the device, starting or
26
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
Additional resources
NOTE
In nmtui:
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
Procedure
1. If you do not know the network device name you want to use in the connection, display the
available devices:
2. Start nmtui:
# nmtui
i. Press Add.
ii. Select Ethernet from the list of network types, and press Enter.
27
Red Hat Enterprise Linux 9 Configuring and managing networking
To modify an existing profile, select the profile from the list, and press Enter.
6. If you create a new connection profile, enter the network device name into the Device field.
7. Depending on your environment, configure the IP address settings in the IPv4 configuration
and IPv6 configuration areas accordingly. For this, press the button next to these areas, and
select:
Manual, if the network requires static IP address settings. In this case, you must fill further
fields:
i. Press Show next to the protocol you want to configure to display additional fields.
ii. Press Add next to Addresses, and enter the IP address and the subnet mask in
Classless Inter-Domain Routing (CIDR) format.
If you do not specify a subnet mask, NetworkManager sets a /32 subnet mask for IPv4
addresses and /64 for IPv6 addresses.
iv. Press Add next to DNS servers, and enter the DNS server address.
v. Press Add next to Search domains, and enter the DNS search domain.
10. Select Quit, and press Enter to close the nmtui application.
Verification
29
Red Hat Enterprise Linux 9 Configuring and managing networking
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
5. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Troubleshooting
Verify that the network cable is plugged-in to the host and a switch.
Check whether the link failure exists only on this host or also on other hosts connected to the
same switch.
Verify that the network cable and the network interface are working as expected. Perform
hardware diagnosis steps and replace defect cables and network interface cards.
If the configuration on the disk does not match the configuration on the device, starting or
restarting NetworkManager creates an in-memory connection that reflects the configuration of
the device. For further details and how to avoid this problem, see the NetworkManager
duplicates a connection after restart of NetworkManager service solution.
Additional resources
If you connect a host to the network over Ethernet, you can manage the connection’s settings with a
30
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
If you connect a host to the network over Ethernet, you can manage the connection’s settings with a
graphical interface by using the GNOME Settings menu.
Note that control-center does not support as many configuration options as the nm-connection-editor
application or the nmcli utility.
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
GNOME is installed.
Procedure
To create a new profile, click the + button next to the Ethernet entry.
To modify an existing profile, click the gear icon next to the profile entry.
4. Optional: On the Identity tab, update the name of the connection profile.
On hosts with multiple profiles, a meaningful name makes it easier to identify the purpose of a
profile.
5. Depending on your environment, configure the IP address settings on the IPv4 and IPv6 tabs
accordingly:
To set a static IP address, network mask, default gateway, DNS servers, and search domain,
select Manual as method, and fill the fields on the tabs:
6. Depending on whether you add or modify a connection profile, click the Add or Apply button to
save the connection.
The GNOME control-center automatically activates the connection.
Verification
31
Red Hat Enterprise Linux 9 Configuring and managing networking
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
5. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Troubleshooting steps
Verify that the network cable is plugged-in to the host and a switch.
Check whether the link failure exists only on this host or also on other hosts connected to the
same switch.
Verify that the network cable and the network interface are working as expected. Perform
hardware diagnosis steps and replace defect cables and network interface cards.
If the configuration on the disk does not match the configuration on the device, starting or
restarting NetworkManager creates an in-memory connection that reflects the configuration of
the device. For further details and how to avoid this problem, see the NetworkManager
duplicates a connection after restart of NetworkManager service solution.
32
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
GNOME is installed.
Procedure
$ nm-connection-editor
3. Optional: Update the name of the profile in the Connection Name field.
On hosts with multiple profiles, a meaningful name makes it easier to identify the purpose of a
profile.
4. If you create a new profile, select the device on the Ethernet tab:
5. Depending on your environment, configure the IP address settings on the IPv4 Settings and
IPv6 Settings tabs accordingly:
To set a static IP address, network mask, default gateway, DNS servers, and search domain,
select Manual as method, and fill the fields on the tabs:
6. Click Save.
7. Close nm-connection-editor.
33
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
5. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Troubleshooting steps
Verify that the network cable is plugged-in to the host and a switch.
Check whether the link failure exists only on this host or also on other hosts connected to the
same switch.
Verify that the network cable and the network interface are working as expected. Perform
hardware diagnosis steps and replace defect cables and network interface cards.
If the configuration on the disk does not match the configuration on the device, starting or
restarting NetworkManager creates an in-memory connection that reflects the configuration of
the device. For further details and how to avoid this problem, see the NetworkManager
duplicates a connection after restart of NetworkManager service solution.
Additional Resources
34
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
Procedure
1. Create a YAML file, for example ~/create-ethernet-profile.yml, with the following content:
---
interfaces:
- name: enp1s0
type: ethernet
state: up
ipv4:
enabled: true
address:
- ip: 192.0.2.1
prefix-length: 24
dhcp: false
ipv6:
enabled: true
address:
- ip: 2001:db8:1::1
prefix-length: 64
autoconf: false
dhcp: false
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.254
next-hop-interface: enp1s0
- destination: ::/0
next-hop-address: 2001:db8:1::fffe
next-hop-interface: enp1s0
dns-resolver:
config:
search:
- example.com
server:
- 192.0.2.200
- 2001:db8:1::ffbb
35
Red Hat Enterprise Linux 9 Configuring and managing networking
These settings define an Ethernet connection profile for the enp1s0 device with the following
settings:
2. Optional: You can define the identifier: mac-address and mac-address: <mac_address>
properties in the interfaces property to identify the network interface card by its MAC address
instead of its name, for example:
---
interfaces:
- name: <profile_name>
type: ethernet
identifier: mac-address
mac-address: <mac_address>
...
Verification
36
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
6. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Additional resources
/usr/share/doc/nmstate/examples/ directory
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with static IP
37
Red Hat Enterprise Linux 9 Configuring and managing networking
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: enp1s0
interface_name: enp1s0
type: ethernet
autoconnect: yes
ip:
address:
- 192.0.2.1/24
- 2001:db8:1::1/64
gateway4: 192.0.2.254
gateway6: 2001:db8:1::fffe
dns:
- 192.0.2.200
- 2001:db8:1::ffbb
dns_search:
- example.com
state: up
These settings define an Ethernet connection profile for the enp1s0 device with the following
settings:
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
You can identify the device path with the following command:
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with static IP
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: example
match:
path:
- pci-0000:00:0[1-3].0
- &!pci-0000:00:02.0
type: ethernet
autoconnect: yes
ip:
address:
- 192.0.2.1/24
- 2001:db8:1::1/64
gateway4: 192.0.2.254
gateway6: 2001:db8:1::fffe
dns:
- 192.0.2.200
- 2001:db8:1::ffbb
dns_search:
- example.com
state: up
39
Red Hat Enterprise Linux 9 Configuring and managing networking
These settings define an Ethernet connection profile with the following settings:
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
Procedure
40
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
1. Create a YAML file, for example ~/create-ethernet-profile.yml, with the following content:
---
interfaces:
- name: enp1s0
type: ethernet
state: up
ipv4:
enabled: true
auto-dns: true
auto-gateway: true
auto-routes: true
dhcp: true
ipv6:
enabled: true
auto-dns: true
auto-gateway: true
auto-routes: true
autoconf: true
dhcp: true
These settings define an Ethernet connection profile for the enp1s0 device. The connection
retrieves IPv4 addresses, IPv6 addresses, default gateway, routes, DNS servers, and search
domains from a DHCP server and IPv6 stateless address autoconfiguration (SLAAC).
2. Optional: You can define the identifier: mac-address and mac-address: <mac_address>
properties in the interfaces property to identify the network interface card by its MAC address
instead of its name, for example:
---
interfaces:
- name: <profile_name>
type: ethernet
identifier: mac-address
mac-address: <mac_address>
...
Verification
41
Red Hat Enterprise Linux 9 Configuring and managing networking
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
6. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Additional resources
/usr/share/doc/nmstate/examples/ directory
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
42
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with dynamic IP
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: enp1s0
interface_name: enp1s0
type: ethernet
autoconnect: yes
ip:
dhcp4: yes
auto6: yes
state: up
These settings define an Ethernet connection profile for the enp1s0 device. The connection
retrieves IPv4 addresses, IPv6 addresses, default gateway, routes, DNS servers, and search
domains from a DHCP server and IPv6 stateless address autoconfiguration (SLAAC).
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
43
Red Hat Enterprise Linux 9 Configuring and managing networking
You can identify the device path with the following command:
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with dynamic IP
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: example
match:
path:
- pci-0000:00:0[1-3].0
- &!pci-0000:00:02.0
type: ethernet
autoconnect: yes
ip:
dhcp4: yes
auto6: yes
state: up
These settings define an Ethernet connection profile. The connection retrieves IPv4 addresses,
IPv6 addresses, default gateway, routes, DNS servers, and search domains from a DHCP server
and IPv6 stateless address autoconfiguration (SLAAC).
The match parameter defines that Ansible applies the play to devices that match PCI ID
0000:00:0[1-3].0, but not 0000:00:02.0.
Note that this command only validates the syntax and does not protect against a wrong but valid
44
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
Prerequisites
Procedure
1. Add a connection profile that applies to all interface names starting with enp:
Verification
3 indicates the number of interfaces active on the connection profile at the same time, and not
the number of network interfaces in the connection profile. The connection profile uses all
devices that match the pattern in the match.interface-name parameter and, therefore, the
connection profiles have the same Universally Unique Identifier (UUID).
45
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
Prerequisites
Procedure
1. Identify the device path. For example, to display the device paths of all interfaces starting with
enp, enter :
2. Add a connection profile that applies to all PCI IDs matching the 0000:00:0[7-8].0 expression:
Verification
46
CHAPTER 2. CONFIGURING AN ETHERNET CONNECTION
This connection profile uses all devices with a PCI ID which match the pattern in the match.path
parameter and, therefore, the connection profiles have the same Universally Unique Identifier
(UUID).
Additional resources
47
Red Hat Enterprise Linux 9 Configuring and managing networking
Red Hat Enterprise Linux provides administrators different options to configure team devices. For
example:
Use the RHEL web console to configure bond connections using a web browser.
Use RHEL system roles to automate the bond configuration on one or multiple hosts.
Starting the controller interface does not automatically start the port interfaces.
A controller without ports waits for ports when starting DHCP connections.
A controller with a DHCP connection waiting for ports completes when you add a port with a
carrier.
A controller with a DHCP connection waiting for ports continues waiting when you add a port
without carrier.
48
CHAPTER 3. CONFIGURING A NETWORK BOND
For details how to configure your switch, see the documentation of the switch.
IMPORTANT
Certain network bonding features, such as the fail-over mechanism, do not support direct
cable connections without a network switch. For further details, see the Is bonding
supported with direct connection using crossover cables? KCS solution.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the bond, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bridge, or VLAN devices as ports of the bond, you can either create these devices
while you create the bond or you can create them in advance as described in:
Procedure
# nmcli connection add type bond con-name bond0 ifname bond0 bond.options
"mode=active-backup"
This command creates a bond named bond0 that uses the active-backup mode.
49
Red Hat Enterprise Linux 9 Configuring and managing networking
To additionally set a Media Independent Interface (MII) monitoring interval, add the
miimon=interval option to the bond.options property, for example:
# nmcli connection add type bond con-name bond0 ifname bond0 bond.options
"mode=active-backup,miimon=1000"
2. Display the network interfaces, and note names of interfaces you plan to add to the bond:
In this example:
enp7s0 and enp8s0 are not configured. To use these devices as ports, add connection
profiles in the next step.
bridge0 and bridge1 have existing connection profiles. To use these devices as ports,
modify their profiles in the next step.
a. If the interfaces you want to assign to the bond are not configured, create new connection
profiles for them:
These commands create profiles for enp7s0 and enp8s0, and add them to the bond0
connection.
These commands assign the existing connection profiles named bridge0 and bridge1
to the bond0 connection.
50
CHAPTER 3. CONFIGURING A NETWORK BOND
To set a static IPv4 address, network mask, default gateway, and DNS server to the bond0
connection, enter:
To set a static IPv6 address, network mask, default gateway, and DNS server to the bond0
connection, enter:
6. Optional: If you want to set any parameters on the bond ports, use the following command:
8. Verify that the ports are connected, and the CONNECTION column displays the port’s
connection name:
# nmcli device
DEVICE TYPE STATE CONNECTION
...
enp7s0 ethernet connected bond0-port1
enp8s0 ethernet connected bond0-port2
When you activate any port of the connection, NetworkManager also activates the bond, but not
the other ports of it. You can configure that Red Hat Enterprise Linux enables all ports
automatically when the bond is enabled:
51
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
1. Temporarily remove the network cable from one of the network devices and check if the other
device in the bond handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools
that deactivate connections, such as nmcli, show only the bonding driver’s ability to handle port
configuration changes and not actual link failure events.
# cat /proc/net/bonding/bond0
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as members of the bond, the physical or virtual Ethernet devices must
be installed on the server.
To use team, bridge, or VLAN devices as members of the bond, create them in advance as
described in:
Procedure
1. Select the Networking tab in the navigation on the left side of the screen.
6. Set the link monitoring mode. For example, when you use the Adaptive load balancing mode,
set it to ARP.
52
CHAPTER 3. CONFIGURING A NETWORK BOND
7. Optional: Adjust the monitoring interval, link up delay, and link down delay settings. Typically,
you only change the defaults for troubleshooting purposes.
8. Click Apply.
9. By default, the bond uses a dynamic IP address. If you want to set a static IP address:
c. Select Manual next to Addresses, and enter the IP address, prefix, and default gateway.
d. In the DNS section, click the + button, and enter the IP address of the DNS server. Repeat
this step to set multiple DNS servers.
53
Red Hat Enterprise Linux 9 Configuring and managing networking
e. In the DNS search domains section, click the + button, and enter the search domain.
f. If the interface requires static routes, configure them in the Routes section.
g. Click Apply
Verification
1. Select the Networking tab in the navigation on the left side of the screen, and check if there is
incoming and outgoing traffic on the interface:
2. Temporarily remove the network cable from one of the network devices and check if the other
device in the bond handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools
that deactivate connections, such as the web console, show only the bonding driver’s ability to
handle member configuration changes and not actual link failure events.
54
CHAPTER 3. CONFIGURING A NETWORK BOND
# cat /proc/net/bonding/bond0
NOTE
In nmtui:
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the bond, the physical or virtual Ethernet devices must be
installed on the server.
Procedure
1. If you do not know the network device names on which you want configure a network bond,
display the available devices:
2. Start nmtui:
# nmtui
4. Press Add.
5. Select Bond from the list of network types, and press Enter.
7. Enter the bond device name to be created into the Device field.
55
Red Hat Enterprise Linux 9 Configuring and managing networking
b. Select the type of the interface you want to add as port to the bond, for example, Ethernet.
c. Optional: Enter a name for the NetworkManager profile to be created for this bond port.
9. Set the bond mode. Depending on the value you set, nmtui displays additional fields for settings
that are related to the selected mode.
10. Depending on your environment, configure the IP address settings in the IPv4 configuration
and IPv6 configuration areas accordingly. For this, press the button next to these areas, and
select:
Manual, if the network requires static IP address settings. In this case, you must fill further
fields:
i. Press Show next to the protocol you want to configure to display additional fields.
ii. Press Add next to Addresses, and enter the IP address and the subnet mask in
Classless Inter-Domain Routing (CIDR) format.
If you do not specify a subnet mask, NetworkManager sets a /32 subnet mask for IPv4
addresses and /64 for IPv6 addresses.
iv. Press Add next to DNS servers, and enter the DNS server address.
v. Press Add next to Search domains, and enter the DNS search domain.
57
Red Hat Enterprise Linux 9 Configuring and managing networking
13. Select Quit, and press Enter to close the nmtui application.
Verification
1. Temporarily remove the network cable from one of the network devices and check if the other
device in the bond handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools
that deactivate connections, such as nmcli, show only the bonding driver’s ability to handle port
configuration changes and not actual link failure events.
# cat /proc/net/bonding/bond0
Note that nm-connection-editor can add only new ports to a bond. To use an existing connection
profile as a port, create the bond by using the nmcli utility as described in Configuring a network bond
by using nmcli.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the bond, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bond, or VLAN devices as ports of the bond, ensure that these devices are not
already configured.
Procedure
$ nm-connection-editor
a. Optional: Set the name of the bond interface in the Interface name field.
b. Click the Add button to add a network interface as a port to the bond.
i. Select the connection type of the interface. For example, select Ethernet for a wired
connection.
58
CHAPTER 3. CONFIGURING A NETWORK BOND
iii. If you create a connection profile for an Ethernet device, open the Ethernet tab, and
select in the Device field the network interface you want to add as a port to the bond. If
you selected a different device type, configure it accordingly. Note that you can only
use Ethernet interfaces in a bond that are not configured.
c. Repeat the previous step for each interface you want to add to the bond:
d. Optional: Set other options, such as the Media Independent Interface (MII) monitoring
interval.
5. Configure the IP address settings on both the IPv4 Settings and IPv6 Settings tabs:
To use this bridge device as a port of other devices, set the Method field to Disabled.
To use DHCP, leave the Method field at its default, Automatic (DHCP).
To use static IP settings, set the Method field to Manual and fill the fields accordingly:
6. Click Save.
7. Close nm-connection-editor.
Verification
1. Temporarily remove the network cable from one of the network devices and check if the other
59
Red Hat Enterprise Linux 9 Configuring and managing networking
1. Temporarily remove the network cable from one of the network devices and check if the other
device in the bond handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools
that deactivate connections, such as nmcli, show only the bonding driver’s ability to handle port
configuration changes and not actual link failure events.
# cat /proc/net/bonding/bond0
Additional resources
Depending on your environment, adjust the YAML file accordingly. For example, to use different devices
than Ethernet adapters in the bond, adapt the base-iface attribute and type attributes of the ports you
use in the bond.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports in the bond, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bridge, or VLAN devices as ports in the bond, set the interface name in the port
list, and define the corresponding interfaces.
Procedure
1. Create a YAML file, for example ~/create-bond.yml, with the following content:
---
interfaces:
- name: bond0
type: bond
state: up
ipv4:
enabled: true
address:
- ip: 192.0.2.1
60
CHAPTER 3. CONFIGURING A NETWORK BOND
prefix-length: 24
dhcp: false
ipv6:
enabled: true
address:
- ip: 2001:db8:1::1
prefix-length: 64
autoconf: false
dhcp: false
link-aggregation:
mode: active-backup
port:
- enp1s0
- enp7s0
- name: enp1s0
type: ethernet
state: up
- name: enp7s0
type: ethernet
state: up
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.254
next-hop-interface: bond0
- destination: ::/0
next-hop-address: 2001:db8:1::fffe
next-hop-interface: bond0
dns-resolver:
config:
search:
- example.com
server:
- 192.0.2.200
- 2001:db8:1::ffbb
Mode: active-backup
61
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
Additional resources
/usr/share/doc/nmstate/examples/ directory
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Two or more physical or virtual network devices are installed on the server.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
62
CHAPTER 3. CONFIGURING A NETWORK BOND
63
Red Hat Enterprise Linux 9 Configuring and managing networking
NOTE
Set the IP configuration on the bond and not on the ports of the Linux bond.
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
Prerequisites
An Ethernet and Wi-Fi NetworkManager connection profile has been created and both
connections work independently.
This procedure uses the following connection profiles to create a network bond named bond0:
Procedure
# nmcli connection add type bond con-name bond0 ifname bond0 bond.options
"mode=active-backup"
64
CHAPTER 3. CONFIGURING A NETWORK BOND
This command names both the interface and connection profile bond0.
If a DHCP server in your network assigns IPv4 addresses to hosts, no action is required.
If your local network requires static IPv4 addresses, set the address, network mask, default
gateway, DNS server, and DNS search domain to the bond0 connection:
If your router or a DHCP server in your network assigns IPv6 addresses to hosts, no action is
required.
If your local network requires static IPv6 addresses, set the address, network mask, default
gateway, DNS server, and DNS search domain to the bond0 connection:
You require the names of the connection profiles and the Ethernet device name in the next
steps.
7. If your Wi-Fi network uses MAC filtering to allow only MAC addresses on a allow list to access
the network, configure that NetworkManager dynamically assigns the MAC address of the
active port to the bond:
With this setting, you must set only the MAC address of the Wi-Fi device to the allow list instead
65
Red Hat Enterprise Linux 9 Configuring and managing networking
With this setting, you must set only the MAC address of the Wi-Fi device to the allow list instead
of the MAC address of both the Ethernet and Wi-Fi device.
8. Set the device associated with the Ethernet connection as primary device of the bond:
With this setting, the bond always uses the Ethernet connection if it is available.
9. Configure that NetworkManager automatically activates ports when the bond0 device is
activated:
Verification
Display the currently active device, the status of the bond and its ports:
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Additional resources
66
CHAPTER 3. CONFIGURING A NETWORK BOND
Balance-rr (Mode 0)
Balance-rr uses the round-robin algorithm that sequentially transmits packets from the first
available port to the last one. This mode provides load balancing and fault tolerance.
This mode requires switch configuration of a port aggregation group, also called EtherChannel or
similar port grouping. An EtherChannel is a port link aggregation technology to group multiple
physical Ethernet links to one logical Ethernet link.
The drawback of this mode is that it is not suitable for heavy workloads and if TCP throughput or
ordered packet delivery is essential.
Active-backup (Mode 1)
Active-backup uses the policy that determines that only one port is active in the bond. This mode
provides fault tolerance and does not require any switch configuration.
If the active port fails, an alternate port becomes active. The bond sends a gratuitous address
resolution protocol (ARP) response to the network. The gratuitous ARP forces the receiver of the
ARP frame to update their forwarding table. The Active-backup mode transmits a gratuitous ARP to
announce the new path to maintain connectivity for the host.
The primary option defines the preferred port of the bonding interface.
Balance-xor (Mode 2)
Balance-xor uses the selected transmit hash policy to send the packets. This mode provides load
balancing, fault tolerance, and requires switch configuration to set up an Etherchannel or similar port
grouping.
To alter packet transmission and balance transmit, this mode uses the xmit_hash_policy option.
Depending on the source or destination of traffic on the interface, the interface requires an
additional load-balancing configuration. See description xmit_hash_policy bonding parameter.
Broadcast (Mode 3)
Broadcast uses a policy that transmits every packet on all interfaces. This mode provides fault
tolerance and requires a switch configuration to set up an EtherChannel or similar port grouping.
The drawback of this mode is that it is not suitable for heavy workloads and if TCP throughput or
ordered packet delivery is essential.
802.3ad (Mode 4)
802.3ad uses the same-named IEEE standard dynamic link aggregation policy. This mode provides
fault tolerance. This mode requires switch configuration to set up a Link Aggregation Control
Protocol (LACP) port grouping.
This mode creates aggregation groups that share the same speed and duplex settings and utilizes all
67
Red Hat Enterprise Linux 9 Configuring and managing networking
This mode creates aggregation groups that share the same speed and duplex settings and utilizes all
ports in the active aggregator. Depending on the source or destination of traffic on the interface,
this mode requires an additional load-balancing configuration.
By default, the port selection for outgoing traffic depends on the transmit hash policy. Use the
xmit_hash_policy option of the transmit hash policy to change the port selection and balance
transmit.
The difference between the 802.3ad and the Balance-xor is compliance. The 802.3ad policy
negotiates LACP between the port aggregation groups. See description xmit_hash_policy bonding
parameter
Balance-tlb (Mode 5)
Balance-tlb uses the transmit load balancing policy. This mode provides fault tolerance, load
balancing, and establishes channel bonding that does not require any switch support.
The active port receives the incoming traffic. In case of failure of the active port, another one takes
over the MAC address of the failed port. To decide which interface processes the outgoing traffic,
use one of the following modes:
Value 0: Uses the hash distribution policy to distribute traffic without load balancing
Balance-alb (Mode 6)
Balance-alb uses an adaptive load balancing policy. This mode provides fault tolerance, load
balancing, and does not require any special switch support.
This mode Includes balance-transmit load balancing (balance-tlb) and receive-load balancing for
IPv4 and IPv6 traffic. The bonding intercepts ARP replies sent by the local system and overwrites the
source hardware address of one of the ports in the bond. ARP negotiation manages the receive-load
balancing. Therefore, different ports use different hardware addresses for the server.
The primary option defines the preferred port of the bonding interface. With the bonding option
tlb_dynamic_lb=0, this bonding mode uses the xmit_hash_policy bonding option to balance
transmit. See description xmit_hash_policy bonding parameter.
Additional resources
/usr/share/doc/kernel-doc-<version>/Documentation/networking/bonding.rst provided by
the kernel-doc package
/usr/share/doc/kernel-doc-<version>/Documentation/networking/bonding.txt provided by
the kernel-doc package
Which bonding modes work when used with a bridge that virtual machine guests or containers
connect to?
How are the values for different policies in "xmit_hash_policy" bonding parameter calculated?
68
CHAPTER 3. CONFIGURING A NETWORK BOND
The xmit_hash_policy load balancing parameter selects the transmit hash policy for a node selection in
the balance-xor, 802.3ad, balance-alb, and balance-tlb modes. It is only applicable to mode 5 and 6 if
the tlb_dynamic_lb parameter is 0. The possible values of this parameter are layer2, layer2+3,
layer3+4, encap2+3, encap3+4, and vlan+srcmac.
69
Red Hat Enterprise Linux 9 Configuring and managing networking
70
CHAPTER 4. CONFIGURING NETWORK TEAMING
Red Hat Enterprise Linux provides administrators different options to configure team devices. For
example:
Use the RHEL web console to configure team connections using a web browser.
IMPORTANT
Network teaming is deprecated in Red Hat Enterprise Linux 9. Consider using the
network bonding driver as an alternative. For details, see Configuring network bonding.
IMPORTANT
The team2bond utility only converts the network team configuration to a bond.
Afterwards, you must manually configure further settings of the bond, such as IP
addresses and DNS configuration.
Prerequisites
The team-team0 NetworkManager connection profile is configured and manages the team0
device.
Procedure
71
Red Hat Enterprise Linux 9 Configuring and managing networking
ipv6.method: manual
ipv6.dns: 2001:db8:1::fffd
ipv6.dns-search: example.com
ipv6.addresses: 2001:db8:1::1/64
ipv6.gateway: 2001:db8:1::fffe
...
3. Remove the network team. For example, if you configured the team in NetworkManager,
remove the team-team0 connection profile and the profiles of associated ports:
4. Run the team2bond utility in dry-run mode to display nmcli commands that set up a network
bond with similar settings as the team device:
The first command contains two miimon options because the team configuration file contained
two link_watch entries. Note that this does not affect the creation of the bond.
If you bound services to the device name of the team and want to avoid updating or breaking
these services, omit the --rename=bond0 option. In this case, team2bond uses the same
interface name for the bond as for the team.
5. Verify that the options for the bond the team2bond utility suggested are correct.
6. Create the bond. You can execute the suggested nmcli commands or re-run the team2bond
command with the --exec-cmd option:
You require the name of the bond connection profile (bond-bond0) in the next steps.
7. Set the IPv4 settings that were previously configured on team-team0 to the bond-bond0
connection:
72
CHAPTER 4. CONFIGURING NETWORK TEAMING
8. Set the IPv6 settings that were previously configured on team-team0 to the bond-bond0
connection:
Verification
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.13.0-0.rc7.51.el9.x86_64
73
Red Hat Enterprise Linux 9 Configuring and managing networking
a. Temporarily remove the network cable from the host. Note that there is no method to
properly test link failure events using the command line.
# cat /proc/net/bonding/bond0
Starting the controller interface does not automatically start the port interfaces.
A controller without ports waits for ports when starting DHCP connections.
A controller with a DHCP connection waiting for ports completes when you add a port with a
carrier.
A controller with a DHCP connection waiting for ports continues waiting when you add a port
without carrier.
The teamd service implements the common logic to all methods of teaming. Those functions are unique
to the different load sharing and backup methods, such as round-robin, and implemented by separate
units of code referred to as runners. Administrators specify runners in JavaScript Object Notation
74
CHAPTER 4. CONFIGURING NETWORK TEAMING
(JSON) format, and the JSON code is compiled into an instance of teamd when the instance is created.
Alternatively, when using NetworkManager, you can set the runner in the team.runner parameter, and
NetworkManager auto-creates the corresponding JSON code.
activebackup: Transmits data over one port while the others are kept as a backup.
loadbalance: Transmits data over all ports with active Tx load balancing and Berkeley Packet
Filter (BPF)-based Tx port selectors.
The teamd services uses a link watcher to monitor the state of subordinate devices. The following link-
watchers are available:
ethtool: The libteam library uses the ethtool utility to watch for link state changes. This is the
default link-watcher.
arp_ping: The libteam library uses the arp_ping utility to monitor the presence of a far-end
hardware address using Address Resolution Protocol (ARP).
nsna_ping: On IPv6 connections, the libteam library uses the Neighbor Advertisement and
Neighbor Solicitation features from the IPv6 Neighbor Discovery protocol to monitor the
presence of a neighbor’s interface.
Each runner can use any link watcher, with the exception of lacp. This runner can only use the ethtool
link watcher.
IMPORTANT
Network teaming is deprecated in Red Hat Enterprise Linux 9. Consider using the
network bonding driver as an alternative. For details, see Configuring network bonding.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the team, the physical or virtual Ethernet devices must be
installed on the server and connected to a switch.
To use bond, bridge, or VLAN devices as ports of the team, you can either create these devices
while you create the team or you can create them in advance as described in:
75
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
# nmcli connection add type team con-name team0 ifname team0 team.runner
activebackup
This command creates a network team named team0 that uses the activebackup runner.
2. Optionally, set a link watcher. For example, to set the ethtool link watcher in the team0
connection profile:
Link watchers support different parameters. To set parameters for a link watcher, specify them
space-separated in the name property. Note that the name property must be surrounded by
quotation marks. For example, to use the ethtool link watcher and set its delay-up parameter to
2500 milliseconds (2.5 seconds):
To set multiple link watchers and each of them with specific parameters, the link watchers must
be separated by a comma. The following example sets the ethtool link watcher with the delay-
up parameter and the arp_ping link watcher with the source-host and target-host parameter:
3. Display the network interfaces, and note the names of the interfaces you want to add to the
team:
In this example:
enp7s0 and enp8s0 are not configured. To use these devices as ports, add connection
profiles in the next step. Note that you can only use Ethernet interfaces in a team that are
not assigned to any connection.
bond0 and bond1 have existing connection profiles. To use these devices as ports, modify
their profiles in the next step.
76
CHAPTER 4. CONFIGURING NETWORK TEAMING
a. If the interfaces you want to assign to the team are not configured, create new connection
profiles for them:
# nmcli connection add type ethernet port-type team con-name team0-port1 ifname
enp7s0 controller team0
# nmcli connection add type ethernet port--type team con-name team0-port2
ifname enp8s0 controller team0
These commands create profiles for enp7s0 and enp8s0, and add them to the team0
connection.
These commands assign the existing connection profiles named bond0 and bond1 to
the team0 connection.
To set a static IPv4 address, network mask, default gateway, and DNS server to the team0
connection, enter:
To set a static IPv6 address, network mask, default gateway, and DNS server to the team0
connection, enter:
77
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
Additional resources
IMPORTANT
78
CHAPTER 4. CONFIGURING NETWORK TEAMING
IMPORTANT
Network teaming is deprecated in Red Hat Enterprise Linux 9. Consider using the
network bonding driver as an alternative. For details, see Configuring network bonding.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the team, the physical or virtual Ethernet devices must be
installed on the server and connected to a switch.
To use bond, bridge, or VLAN devices as ports of the team, create them in advance as described
in:
Procedure
1. Select the Networking tab in the navigation on the left side of the screen.
If you select Ethtool, additionally, set a link up and link down delay.
If you set ARP ping or NSNA ping, additionally, set a ping interval and ping target.
79
Red Hat Enterprise Linux 9 Configuring and managing networking
7. Click Apply.
8. By default, the team uses a dynamic IP address. If you want to set a static IP address:
c. Select Manual next to Addresses, and enter the IP address, prefix, and default gateway.
d. In the DNS section, click the + button, and enter the IP address of the DNS server. Repeat
this step to set multiple DNS servers.
e. In the DNS search domains section, click the + button, and enter the search domain.
f. If the interface requires static routes, configure them in the Routes section.
80
CHAPTER 4. CONFIGURING NETWORK TEAMING
g. Click Apply
Verification
1. Select the Networking tab in the navigation on the left side of the screen, and check if there is
incoming and outgoing traffic on the interface.
81
Red Hat Enterprise Linux 9 Configuring and managing networking
down count: 0
enp8s0
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: enp7s0
Additional resources
Note that nm-connection-editor can add only new ports to a team. To use an existing connection
profile as a port, create the team using the nmcli utility as described in Configuring a network team by
using nmcli.
IMPORTANT
Network teaming is deprecated in Red Hat Enterprise Linux 9. Consider using the
network bonding driver as an alternative. For details, see Configuring network bonding.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the team, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bond, or VLAN devices as ports of the team, ensure that these devices are not
already configured.
Procedure
$ nm-connection-editor
82
CHAPTER 4. CONFIGURING NETWORK TEAMING
a. Optional: Set the name of the team interface in the Interface name field.
b. Click the Add button to add a new connection profile for a network interface and adding the
profile as a port to the team.
i. Select the connection type of the interface. For example, select Ethernet for a wired
connection.
iii. If you create a connection profile for an Ethernet device, open the Ethernet tab, and
select in the Device field the network interface you want to add as a port to the team. If
you selected a different device type, configure it accordingly. Note that you can only
use Ethernet interfaces in a team that are not assigned to any connection.
c. Repeat the previous step for each interface you want to add to the team.
d. Click the Advanced button to set advanced options to the team connection.
ii. On the Link Watcher tab, set the link watcher and its optional settings.
5. Configure the IP address settings on both the IPv4 Settings and IPv6 Settings tabs:
To use this bridge device as a port of other devices, set the Method field to Disabled.
To use DHCP, leave the Method field at its default, Automatic (DHCP).
To use static IP settings, set the Method field to Manual and fill the fields accordingly:
83
Red Hat Enterprise Linux 9 Configuring and managing networking
6. Click Save.
7. Close nm-connection-editor.
Verification
Additional resources
84
CHAPTER 5. CONFIGURING VLAN TAGGING
Red Hat Enterprise Linux provides administrators different options to configure VLAN devices. For
example:
Use the RHEL web console to configure VLAN tagging using a web browser.
Use RHEL system roles to automate the VLAN configuration on one or multiple hosts.
Prerequisites
The interface you plan to use as a parent to the virtual VLAN interface supports VLAN tags.
The bond is not configured with the fail_over_mac=follow option. A VLAN virtual device
cannot change its MAC address to match the parent’s new MAC address. In such a case, the
traffic would still be sent with the incorrect source MAC address.
The bond is usually not expected to get IP addresses from a DHCP server or IPv6 auto-
configuration. Ensure it by setting the ipv4.method=disable and ipv6.method=ignore
options while creating the bond. Otherwise, if DHCP or IPv6 auto-configuration fails after
some time, the interface might be brought down.
The switch, the host is connected to, is configured to support VLAN tags. For details, see the
documentation of your switch.
Procedure
85
Red Hat Enterprise Linux 9 Configuring and managing networking
2. Create the VLAN interface. For example, to create a VLAN interface named vlan10 that uses
enp1s0 as its parent interface and that tags packets with VLAN ID 10, enter:
# nmcli connection add type vlan con-name vlan10 ifname vlan10 vlan.parent enp1s0
vlan.id 10
Note that the VLAN must be within the range from 0 to 4094.
3. By default, the VLAN connection inherits the maximum transmission unit (MTU) from the parent
interface. Optionally, set a different MTU value:
To set a static IPv4 address, network mask, default gateway, and DNS server to the vlan10
connection, enter:
To set a static IPv6 address, network mask, default gateway, and DNS server to the vlan10
connection, enter:
Verification
86
CHAPTER 5. CONFIGURING VLAN TAGGING
Additional resources
Increased network scalability by creating multiple isolated network segments within a VLAN. This
enables you to segment and organize large networks into smaller, manageable units.
Improved traffic management by isolating and controlling different types of network traffic.
This can improve the network performance and reduce network congestion.
Efficient resource utilization by enabling the creation of smaller, more targeted network
segments.
Enhanced security by isolating network traffic and reducing the risk of unauthorized access to
sensitive data.
Prerequisites
The interface you plan to use as a parent to the virtual VLAN interface supports VLAN tags.
The bond is not configured with the fail_over_mac=follow option. A VLAN virtual device
cannot change its MAC address to match the parent’s new MAC address. In such a case, the
traffic would still be sent with the incorrect source MAC address.
The bond is usually not expected to get IP addresses from a DHCP server or IPv6 auto-
configuration. Ensure it by setting the ipv4.method=disable and ipv6.method=ignore
options while creating the bond. Otherwise, if DHCP or IPv6 auto-configuration fails after
some time, the interface might be brought down.
The switch, the host is connected to, is configured to support VLAN tags. For details, see the
documentation of your switch.
Procedure
87
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
2. Create the base VLAN interface. For example, to create a base VLAN interface named vlan10
that uses enp1s0 as its parent interface and that tags packets with VLAN ID 10, enter:
# nmcli connection add type vlan con-name vlan10 dev enp1s0 vlan.id 10
Note that the VLAN must be within the range from 0 to 4094.
3. By default, the VLAN connection inherits the maximum transmission unit (MTU) from the parent
interface. Optionally, set a different MTU value:
4. Create the nested VLAN interface on top of the base VLAN interface:
This command creates a new VLAN connection with a name of vlan10.20 and a VLAN ID of 20
on the parent VLAN connection vlan10. The dev option specifies the parent network device. In
this case it is enp1s0.10. The vlan.protocol option specifies the VLAN encapsulation protocol.
In this case it is 802.1ad (Q-in-Q).
To set a static IPv4 address, network mask, default gateway, and DNS server to the
vlan10.20 connection, enter:
To set a static IPv4 address, network mask, default gateway, and DNS server to the vlan10
connection, enter:
88
CHAPTER 5. CONFIGURING VLAN TAGGING
Verification
Additional resources
Prerequisites
The interface you plan to use as a parent to the virtual VLAN interface supports VLAN tags.
The bond is not configured with the fail_over_mac=follow option. A VLAN virtual device
cannot change its MAC address to match the parent’s new MAC address. In such a case, the
traffic would still be sent with the incorrect source MAC address.
The bond is usually not expected to get IP addresses from a DHCP server or IPv6 auto-
configuration. Ensure it by disabling the IPv4 and IPv6 protocol creating the bond.
Otherwise, if DHCP or IPv6 auto-configuration fails after some time, the interface might be
brought down.
The switch, the host is connected to, is configured to support VLAN tags. For details, see the
documentation of your switch.
Procedure
1. Select the Networking tab in the navigation on the left side of the screen.
89
Red Hat Enterprise Linux 9 Configuring and managing networking
5. Enter the name of the VLAN device or keep the automatically-generated name.
6. Click Apply.
7. By default, the VLAN device uses a dynamic IP address. If you want to set a static IP address:
c. Select Manual next to Addresses, and enter the IP address, prefix, and default gateway.
d. In the DNS section, click the + button, and enter the IP address of the DNS server. Repeat
this step to set multiple DNS servers.
e. In the DNS search domains section, click the + button, and enter the search domain.
f. If the interface requires static routes, configure them in the Routes section.
90
CHAPTER 5. CONFIGURING VLAN TAGGING
g. Click Apply
Verification
Select the Networking tab in the navigation on the left side of the screen, and check if there is
incoming and outgoing traffic on the interface:
NOTE
91
Red Hat Enterprise Linux 9 Configuring and managing networking
NOTE
In nmtui:
Prerequisites
The interface you plan to use as a parent to the virtual VLAN interface supports VLAN tags.
The bond is not configured with the fail_over_mac=follow option. A VLAN virtual device
cannot change its MAC address to match the parent’s new MAC address. In such a case, the
traffic would still be sent with the then incorrect source MAC address.
The bond is usually not expected to get IP addresses from a DHCP server or IPv6 auto-
configuration. Ensure it by setting the ipv4.method=disable and ipv6.method=ignore
options while creating the bond. Otherwise, if DHCP or IPv6 auto-configuration fails after
some time, the interface might be brought down.
The switch the host is connected to is configured to support VLAN tags. For details, see the
documentation of your switch.
Procedure
1. If you do not know the network device name on which you want configure VLAN tagging, display
the available devices:
2. Start nmtui:
# nmtui
4. Press Add.
5. Select VLAN from the list of network types, and press Enter.
7. Enter the VLAN device name to be created into the Device field.
8. Enter the name of the device on which you want to configure VLAN tagging into the Parent
92
CHAPTER 5. CONFIGURING VLAN TAGGING
8. Enter the name of the device on which you want to configure VLAN tagging into the Parent
field.
9. Enter the VLAN ID. The ID must be within the range from 0 to 4094.
10. Depending on your environment, configure the IP address settings in the IPv4 configuration
and IPv6 configuration areas accordingly. For this, press the button next to these areas, and
select:
Disabled, if this VLAN device does not require an IP address or you want to use it as a port
of other devices.
Manual, if the network requires static IP address settings. In this case, you must fill further
fields:
i. Press Show next to the protocol you want to configure to display additional fields.
ii. Press Add next to Addresses, and enter the IP address and the subnet mask in
Classless Inter-Domain Routing (CIDR) format.
If you do not specify a subnet mask, NetworkManager sets a /32 subnet mask for IPv4
addresses and /64 for IPv6 addresses.
iv. Press Add next to DNS servers, and enter the DNS server address.
v. Press Add next to Search domains, and enter the DNS search domain.
13. Select Quit, and press Enter to close the nmtui application.
Verification
94
CHAPTER 5. CONFIGURING VLAN TAGGING
Prerequisites
The interface you plan to use as a parent to the virtual VLAN interface supports VLAN tags.
The bond is not configured with the fail_over_mac=follow option. A VLAN virtual device
cannot change its MAC address to match the parent’s new MAC address. In such a case, the
traffic would still be sent with the incorrect source MAC address.
The switch, the host is connected, to is configured to support VLAN tags. For details, see the
documentation of your switch.
Procedure
$ nm-connection-editor
b. Select the VLAN id. Note that the VLAN must be within the range from 0 to 4094.
c. By default, the VLAN connection inherits the maximum transmission unit (MTU) from the
parent interface. Optionally, set a different MTU value.
d. Optionally, set the name of the VLAN interface and further VLAN-specific options.
95
Red Hat Enterprise Linux 9 Configuring and managing networking
5. Configure the IP address settings on both the IPv4 Settings and IPv6 Settings tabs:
To use this bridge device as a port of other devices, set the Method field to Disabled.
To use DHCP, leave the Method field at its default, Automatic (DHCP).
To use static IP settings, set the Method field to Manual and fill the fields accordingly:
6. Click Save.
7. Close nm-connection-editor.
Verification
96
CHAPTER 5. CONFIGURING VLAN TAGGING
Additional resources
Depending on your environment, adjust the YAML file accordingly. For example, to use different devices
than Ethernet adapters in the VLAN, adapt the base-iface attribute and type attributes of the ports you
use in the VLAN.
Prerequisites
To use Ethernet devices as ports in the VLAN, the physical or virtual Ethernet devices must be
installed on the server.
Procedure
1. Create a YAML file, for example ~/create-vlan.yml, with the following content:
---
interfaces:
- name: vlan10
type: vlan
state: up
ipv4:
enabled: true
address:
- ip: 192.0.2.1
prefix-length: 24
dhcp: false
ipv6:
enabled: true
address:
- ip: 2001:db8:1::1
prefix-length: 64
autoconf: false
dhcp: false
vlan:
base-iface: enp1s0
id: 10
- name: enp1s0
type: ethernet
state: up
routes:
config:
- destination: 0.0.0.0/0
97
Red Hat Enterprise Linux 9 Configuring and managing networking
next-hop-address: 192.0.2.254
next-hop-interface: vlan10
- destination: ::/0
next-hop-address: 2001:db8:1::fffe
next-hop-interface: vlan10
dns-resolver:
config:
search:
- example.com
server:
- 192.0.2.200
- 2001:db8:1::ffbb
These settings define a VLAN with ID 10 that uses the enp1s0 device. As the child device, the
VLAN connection has the following settings:
Verification
98
CHAPTER 5. CONFIGURING VLAN TAGGING
Additional resources
/usr/share/doc/nmstate/examples/ directory
To use the VLAN as a port in other connections, such as a bond, omit the ip attribute, and set
the IP configuration in the child configuration.
To use team, bridge, or bond devices in the VLAN, adapt the interface_name and type
attributes of the ports you use in the VLAN.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure a VLAN that uses an Ethernet connection
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
# Add an Ethernet profile for the underlying device of the VLAN
- name: enp1s0
type: ethernet
interface_name: enp1s0
autoconnect: yes
state: up
ip:
dhcp4: no
auto6: no
99
Red Hat Enterprise Linux 9 Configuring and managing networking
These settings define a VLAN to operate on top of the enp1s0 device. The VLAN interface has
the following settings:
VLAN ID - 10
The parent attribute in the VLAN profile configures the VLAN to operate on top of the
enp1s0 device. As the child device, the VLAN connection contains the IP, default gateway,
and DNS configurations.
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
100
CHAPTER 6. CONFIGURING A NETWORK BRIDGE
A bridge requires a network device in each network the bridge should connect. When you configure a
bridge, the bridge is called controller and the devices it uses ports.
Network bonds
Network teams
VLAN devices
Due to the IEEE 802.11 standard which specifies the use of 3-address frames in Wi-Fi for the efficient
use of airtime, you cannot configure a bridge over Wi-Fi networks operating in Ad-Hoc or Infrastructure
modes.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the bridge, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bond, or VLAN devices as ports of the bridge, you can either create these devices
while you create the bridge or you can create them in advance as described in:
Procedure
2. Display the network interfaces, and note the names of the interfaces you want to add to the
bridge:
101
Red Hat Enterprise Linux 9 Configuring and managing networking
In this example:
enp7s0 and enp8s0 are not configured. To use these devices as ports, add connection
profiles in the next step.
bond0 and bond1 have existing connection profiles. To use these devices as ports, modify
their profiles in the next step.
a. If the interfaces you want to assign to the bridge are not configured, create new connection
profiles for them:
These commands create profiles for enp7s0 and enp8s0, and add them to the bridge0
connection.
These commands assign the existing connection profiles named bond0 and bond1 to
the bridge0 connection.
To set a static IPv4 address, network mask, default gateway, and DNS server to the bridge0
connection, enter:
102
CHAPTER 6. CONFIGURING A NETWORK BRIDGE
To set a static IPv6 address, network mask, default gateway, and DNS server to the bridge0
connection, enter:
6. Optional: Configure further properties of the bridge. For example, to set the Spanning Tree
Protocol (STP) priority of bridge0 to 16384, enter:
8. Verify that the ports are connected, and the CONNECTION column displays the port’s
connection name:
# nmcli device
DEVICE TYPE STATE CONNECTION
...
enp7s0 ethernet connected bridge0-port1
enp8s0 ethernet connected bridge0-port2
When you activate any port of the connection, NetworkManager also activates the bridge, but
not the other ports of it. You can configure that Red Hat Enterprise Linux enables all ports
automatically when the bridge is enabled:
Verification
103
Red Hat Enterprise Linux 9 Configuring and managing networking
Use the ip utility to display the link status of Ethernet devices that are ports of a specific bridge:
Use the bridge utility to display the status of Ethernet devices that are ports of any bridge
device:
To display the status for a specific Ethernet device, use the bridge link show dev
<ethernet_device_name> command.
Additional resources
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the bridge, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bond, or VLAN devices as ports of the bridge, you can either create these devices
while you create the bridge or you can create them in advance as described in:
104
CHAPTER 6. CONFIGURING A NETWORK BRIDGE
Procedure
1. Select the Networking tab in the navigation on the left side of the screen.
5. Optional: Enable the Spanning tree protocol (STP) feature to avoid bridge loops and
broadcast radiation.
6. Click Apply.
7. By default, the bridge uses a dynamic IP address. If you want to set a static IP address:
c. Select Manual next to Addresses, and enter the IP address, prefix, and default gateway.
d. In the DNS section, click the + button, and enter the IP address of the DNS server. Repeat
this step to set multiple DNS servers.
e. In the DNS search domains section, click the + button, and enter the search domain.
f. If the interface requires static routes, configure them in the Routes section.
105
Red Hat Enterprise Linux 9 Configuring and managing networking
g. Click Apply
Verification
1. Select the Networking tab in the navigation on the left side of the screen, and check if there is
incoming and outgoing traffic on the interface:
NOTE
106
CHAPTER 6. CONFIGURING A NETWORK BRIDGE
NOTE
In nmtui:
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the bridge, the physical or virtual Ethernet devices must be
installed on the server.
Procedure
1. If you do not know the network device names on which you want configure a network bridge,
display the available devices:
2. Start nmtui:
# nmtui
4. Press Add.
5. Select Bridge from the list of network types, and press Enter.
7. Enter the bridge device name to be created into the Device field.
b. Select the type of the interface you want to add as port to the bridge, for example,
Ethernet.
c. Optional: Enter a name for the NetworkManager profile to be created for this bridge port.
9. Depending on your environment, configure the IP address settings in the IPv4 configuration
and IPv6 configuration areas accordingly. For this, press the button next to these areas, and
select:
Manual, if the network requires static IP address settings. In this case, you must fill further
fields:
i. Press Show next to the protocol you want to configure to display additional fields.
ii. Press Add next to Addresses, and enter the IP address and the subnet mask in
Classless Inter-Domain Routing (CIDR) format.
If you do not specify a subnet mask, NetworkManager sets a /32 subnet mask for IPv4
addresses and /64 for IPv6 addresses.
iv. Press Add next to DNS servers, and enter the DNS server address.
v. Press Add next to Search domains, and enter the DNS search domain.
12. Select Quit, and press Enter to close the nmtui application.
Verification
1. Use the ip utility to display the link status of Ethernet devices that are ports of a specific bridge:
2. Use the bridge utility to display the status of Ethernet devices that are ports of any bridge
device:
109
Red Hat Enterprise Linux 9 Configuring and managing networking
To display the status for a specific Ethernet device, use the bridge link show dev
<ethernet_device_name> command.
Note that nm-connection-editor can add only new ports to a bridge. To use an existing connection
profile as a port, create the bridge using the nmcli utility as described in Configuring a network bridge by
using nmcli.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports of the bridge, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bond, or VLAN devices as ports of the bridge, ensure that these devices are not
already configured.
Procedure
$ nm-connection-editor
a. Optional: Set the name of the bridge interface in the Interface name field.
b. Click the Add button to create a new connection profile for a network interface and adding
the profile as a port to the bridge.
i. Select the connection type of the interface. For example, select Ethernet for a wired
connection.
iii. If you create a connection profile for an Ethernet device, open the Ethernet tab, and
select in the Device field the network interface you want to add as a port to the bridge.
If you selected a different device type, configure it accordingly.
110
CHAPTER 6. CONFIGURING A NETWORK BRIDGE
c. Repeat the previous step for each interface you want to add to the bridge.
5. Optional: Configure further bridge settings, such as Spanning Tree Protocol (STP) options.
6. Configure the IP address settings on both the IPv4 Settings and IPv6 Settings tabs:
To use this bridge device as a port of other devices, set the Method field to Disabled.
To use DHCP, leave the Method field at its default, Automatic (DHCP).
To use static IP settings, set the Method field to Manual and fill the fields accordingly:
7. Click Save.
8. Close nm-connection-editor.
Verification
Use the ip utility to display the link status of Ethernet devices that are ports of a specific bridge.
Use the bridge utility to display the status of Ethernet devices that are ports in any bridge
111
Red Hat Enterprise Linux 9 Configuring and managing networking
Use the bridge utility to display the status of Ethernet devices that are ports in any bridge
device:
To display the status for a specific Ethernet device, use the bridge link show dev
ethernet_device_name command.
Additional resources
Depending on your environment, adjust the YAML file accordingly. For example, to use different devices
than Ethernet adapters in the bridge, adapt the base-iface attribute and type attributes of the ports
you use in the bridge.
Prerequisites
Two or more physical or virtual network devices are installed on the server.
To use Ethernet devices as ports in the bridge, the physical or virtual Ethernet devices must be
installed on the server.
To use team, bond, or VLAN devices as ports in the bridge, set the interface name in the port
list, and define the corresponding interfaces.
Procedure
1. Create a YAML file, for example ~/create-bridge.yml, with the following content:
112
CHAPTER 6. CONFIGURING A NETWORK BRIDGE
---
interfaces:
- name: bridge0
type: linux-bridge
state: up
ipv4:
enabled: true
address:
- ip: 192.0.2.1
prefix-length: 24
dhcp: false
ipv6:
enabled: true
address:
- ip: 2001:db8:1::1
prefix-length: 64
autoconf: false
dhcp: false
bridge:
options:
stp:
enabled: true
port:
- name: enp1s0
- name: enp7s0
- name: enp1s0
type: ethernet
state: up
- name: enp7s0
type: ethernet
state: up
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.254
next-hop-interface: bridge0
- destination: ::/0
next-hop-address: 2001:db8:1::fffe
next-hop-interface: bridge0
dns-resolver:
config:
search:
- example.com
server:
- 192.0.2.200
- 2001:db8:1::ffbb
113
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
Additional resources
/usr/share/doc/nmstate/examples/ directory
Prerequisites
114
CHAPTER 6. CONFIGURING A NETWORK BRIDGE
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Two or more physical or virtual network devices are installed on the server.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure a network bridge that uses two Ethernet ports
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
# Define the bridge profile
- name: bridge0
type: bridge
interface_name: bridge0
ip:
address:
- "192.0.2.1/24"
- "2001:db8:1::1/64"
gateway4: 192.0.2.254
gateway6: 2001:db8:1::fffe
dns:
- 192.0.2.200
- 2001:db8:1::ffbb
dns_search:
- example.com
state: up
115
Red Hat Enterprise Linux 9 Configuring and managing networking
NOTE
Set the IP configuration on the bridge and not on the ports of the Linux
bridge.
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
116
CHAPTER 7. SETTING UP AN IPSEC VPN
Prerequisites
Procedure
1. Press the Super key, type Settings, and press Enter to open the control-center application.
4. Select VPN.
5. Select the Identity menu entry to see the basic configuration options:
General
Authentication
Type
IKEv1 (XAUTH) - client is authenticated by user name and password, or a pre-shared key
(PSK).
The following configuration settings are available under the Advanced section:
118
CHAPTER 7. SETTING UP AN IPSEC VPN
WARNING
Identification
Phase1 Algorithms — corresponds to the ike Libreswan parameter — enter the algorithms
to be used to authenticate and set up an encrypted channel.
Phase2 Algorithms — corresponds to the esp Libreswan parameter — enter the algorithms
to be used for the IPsec negotiations.
Check the Disable PFS field to turn off Perfect Forward Secrecy (PFS) to ensure
compatibility with old servers that do not support PFS.
Phase1 Lifetime — corresponds to the ikelifetime Libreswan parameter — how long the key
used to encrypt the traffic will be valid.
Automatic (DHCP) — Choose this option if the network you are connecting to uses a DHCP
server to assign dynamic IP addresses.
Link-Local Only — Choose this option if the network you are connecting to does not have a
DHCP server and you do not want to assign IP addresses manually. Random addresses will
be assigned as per RFC 3927 with prefix 169.254/16.
119
Red Hat Enterprise Linux 9 Configuring and managing networking
In the DNS section, when Automatic is ON, switch it to OFF to enter the IP address of a
DNS server you want to use separating the IPs by comma.
Routes
Note that in the Routes section, when Automatic is ON, routes from DHCP are used, but
you can also add additional static routes. When OFF, only static routes are used.
Gateway — The IP address of the gateway leading to the remote network or host entered
above.
Metric — A network cost, a preference value to give to this route. Lower values will be
preferred over higher values.
Use this connection only for resources on its network
Select this check box to prevent the connection from becoming the default route. Selecting
this option means that only traffic specifically destined for routes learned automatically over
the connection or entered here manually is routed over the connection.
7. To configure IPv6 settings in a VPN connection, select the IPv6 menu entry:
IPv6 Method
Automatic, DHCP only — Choose this option to not use RA, but request information from
DHCPv6 directly to create a stateful configuration.
Link-Local Only — Choose this option if the network you are connecting to does not have a
DHCP server and you do not want to assign IP addresses manually. Random addresses will
be assigned as per RFC 4862 with prefix FE80::0.
8. Once you have finished editing the VPN connection, click the Add button to customize the
configuration or the Apply button to save it for the existing one.
Additional resources
nm-settings-libreswan(5)
120
CHAPTER 7. SETTING UP AN IPSEC VPN
Prerequisites
The certificate is imported into the IPsec network security services (NSS) database.
Procedure
$ nm-connection-editor
3. Select the IPsec based VPN connection type, and click Create.
a. Enter the host name or IP address of the VPN gateway into the Gateway field, and select
an authentication type. Based on the authentication type, you must enter different
additional information:
IKEv2 (Certifiate) authenticates the client by using a certificate, which is more secure.
This setting requires the nickname of the certificate in the IPsec NSS database
IKEv1 (XAUTH) authenticates the user by using a user name and password (pre-shared
key). This setting requires that you enter the following values:
User name
Password
Group name
Secret
b. If the remote server specifies a local identifier for the IKE exchange, enter the exact string
in the Remote ID field. In the remote server runs Libreswan, this value is set in the server’s
leftid parameter.
121
Red Hat Enterprise Linux 9 Configuring and managing networking
c. Optionally, configure additional settings by clicking the Advanced button. You can
configure the following settings:
Identification
Security
Connectivity
122
CHAPTER 7. SETTING UP AN IPSEC VPN
5. On the IPv4 Settings tab, select the IP assignment method and, optionally, set additional static
addresses, DNS servers, search domains, and routes.
7. Close nm-connection-editor.
NOTE
When you add a new connection by clicking the + button, NetworkManager creates a new
configuration file for that connection and then opens the same dialog that is used for
editing an existing connection. The difference between these dialogs is that an existing
connection profile has a Details menu entry.
Additional resources
123
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
Procedure
1. Edit the Libreswan configuration file in the /etc/ipsec.d/ directory of the connection that should
use automatic detection of ESP hardware offload support.
Verification
If the network card supports ESP hardware offload support, following these steps to verify the result:
1. Display the tx_ipsec and rx_ipsec counters of the Ethernet device the IPsec connection uses:
2. Send traffic through the IPsec tunnel. For example, ping a remote IP address:
# ping -c 5 remote_ip_address
3. Display the tx_ipsec and rx_ipsec counters of the Ethernet device again:
Additional resources
Prerequisites
The network driver supports ESP hardware offload on a bond device. In RHEL, only the ixgbe
driver supports this feature.
The bond uses the active-backup mode. The bonding driver does not support any other modes
for this feature.
Procedure
This command enables ESP hardware offload support on the bond0 connection.
3. Edit the Libreswan configuration file in the /etc/ipsec.d/ directory of the connection that should
use ESP hardware offload, and append the nic-offload=yes statement to the connection entry:
conn example
...
nic-offload=yes
Verification
125
Red Hat Enterprise Linux 9 Configuring and managing networking
3. Send traffic through the IPsec tunnel. For example, ping a remote IP address:
# ping -c 5 remote_ip_address
4. Display the tx_ipsec and rx_ipsec counters of the active port again:
Additional resources
To manage an IPsec-based configuration for authenticating VPN connections, you can use the
nmstatectl utility. This utility provides command line access to a declarative API for host network
management. The following are the authentication types for the host-to-subnet and host-to-host
communication modes:
7.5.1. Configuring a host-to-subnet IPSec VPN with PKI authentication and tunnel
mode by using nmstatectl
If you want to use encryption based on the trusted entity authentication in IPsec, Public Key
Infrastructure (PKI) provides secure communication by using cryptographic keys between two hosts.
Both communicating hosts generate private and public keys where each host maintains a private key by
sharing public key with the trusted entity Certificate Authority (CA). The CA generates a digital
certificate after verifying the authenticity. In case of encryption and decryption, the host uses a private
key for encryption and public key for decryption.
126
CHAPTER 7. SETTING UP AN IPSEC VPN
By using Nmstate, a declarative API for network management, you can configure a PKI authentication-
based IPsec connection. After setting the configuration, the Nmstate API ensures that the result
matches with the configuration file. If anything fails, nmstate automatically rolls back the changes to
avoid an incorrect state of the system.
Prerequisites
By using a password, you have generated a PKCS #12 file that stores certificates and
cryptographic keys.
Procedure
3. As Libreswan was already installed, remove its old database files and re-create them:
When importing the PKCS#12 file, enter the password that was used to create the file.
6. Create a YAML file, for example ~/create-pki-authentication.yml, with the following content:
---
interfaces:
- name: 'example_ipsec_conn1' 1
type: ipsec
ipv4:
enabled: true
dhcp: true
libreswan:
ipsec-interface: 'yes' 2
left: '192.0.2.250' 3
127
Red Hat Enterprise Linux 9 Configuring and managing networking
leftid: '%fromcert' 4
leftcert: 'local-host.example.com' 5
right: '192.0.2.150' 6
rightid: '%fromcert' 7
ikev2: 'insist' 8
ikelifetime: '24h' 9
salifetime: '24h' 10
2 The value yes means libreswan creates an IPsec xfrm virtual interface ipsec<number>
and automatically finds the next available number
4 On a local host, the value of %fromcert sets the ID to a Distinguished Name (DN) that is
fetched from a loaded certificate
7 On a remote host, the value of %fromcert sets the ID to a Distinguished Name (DN) that is
fetched from a loaded certificate.
8 insist value accepts and receives only the Internet Key Exchange (IKEv2) protocol
Verification
# ip xfrm status
# ip xfrm policy
Additional resources
7.5.2. Configuring a host-to-subnet IPSec VPN with RSA authentication and tunnel
128
CHAPTER 7. SETTING UP AN IPSEC VPN
7.5.2. Configuring a host-to-subnet IPSec VPN with RSA authentication and tunnel
mode by using nmstatectl
If you want to use asymmetric cryptography-based key authentication in IPsec, the RSA algorithm
provides secure communication by using either of private and public keys for encryption and decryption
between two hosts. This method uses a private key for encryption, and a public key for decryption.
By using Nmstate, a declarative API for network management, you can configure RSA-based IPsec
authentication. After setting the configuration, the Nmstate API ensures that the result matches with
the configuration file. If anything fails, nmstate automatically rolls back the changes to avoid an
incorrect state of the system.
Procedure
3. If Libreswan was already installed, remove its old database files and re-create them:
6. The previous step returned the generated key ckaid. Use that ckaid with the following
command on left, for example:
7. The output of the previous command generated the leftrsasigkey= line required for the
configuration. Do the same on the second host (right):
129
Red Hat Enterprise Linux 9 Configuring and managing networking
9. Create a YAML file, for example ~/create-rsa-authentication.yml, with the following content:
---
interfaces:
- name: 'example_ipsec_conn1' 1
type: ipsec 2
ipv4:
enabled: true
dhcp: true
libreswan:
ipsec-interface: '99' 3
leftrsasigkey: '0sAwEAAesFfVZqFzRA9F' 4
left: '192.0.2.250' 5
leftid: 'local-host-rsa.example.com' 6
right: '192.0.2.150' 7
rightrsasigkey: '0sAwEAAesFfVZqFzRA9E' 8
rightid: 'remote-host-rsa.example.com' 9
ikev2: 'insist' 10
2 An interface name
3 The value 99 means that libreswan creates an IPsec xfrm virtual interface
ipsec<number> and automatically finds the next available number
10 insist value accepts and receives only the Internet Key Exchange (IKEv2) protocol
Verification
130
CHAPTER 7. SETTING UP AN IPSEC VPN
# ip xfrm status
# ip xfrm policy
Additional resources
7.5.3. Configuring a host-to-subnet IPSec VPN with PSK authentication and tunnel
mode by using nmstatectl
If you want to use encryption based on mutual authentication in IPsec, the Pre-Shared Key (PSK)
method provides secure communication by using a secret key between two hosts. A file stores the
secret key and the same key encrypts the data flowing through the tunnel.
By using Nmstate, a declarative API for network management, you can configure PSK-based IPsec
authentication. After setting the configuration, the Nmstate API ensures that the result matches with
the configuration file. If anything fails, nmstate automatically rolls back the changes to avoid incorrect
state of the system.
NOTE
As this method uses static strings for authentication and encryption, use it only for
testing/development purposes.
Procedure
3. If Libreswan was already installed, remove its old database files and re-create them:
131
Red Hat Enterprise Linux 9 Configuring and managing networking
5. Create a YAML file, for example ~/create-pks-authentication.yml, with the following content:
---
interfaces:
- name: 'example_ipsec_conn1' 1
type: ipsec
ipv4:
enabled: true
dhcp: true
libreswan:
ipsec-interface: 'no' 2
right: '192.0.2.250' 3
rightid: 'remote-host.example.org' 4
left: '192.0.2.150' 5
leftid: 'local-host.example.org' 6
psk: "example_password"
ikev2: 'insist' 7
2 Setting no value indicates that libreswan creates only xfrm policies, and not a virtual xfrm
interface
7 insist value accepts and receives only the Internet Key Exchange (IKEv2) protocol
Verification
# ip xfrm status
# ip xfrm policy
132
CHAPTER 7. SETTING UP AN IPSEC VPN
7.5.4. Configuring a host-to-host IPsec VPN with PKI authentication and tunnel
mode by using nmstatectl
IPsec (Internet Protocol Security) is a security protocol suite to authenticate and encrypt IP
communications within networks and devices. The Libreswan software provides an IPsec
implementation for VPNs.
In tunnel mode, the source and destination IP address of communication is encrypted in the IPsec
tunnel. External network sniffers can only get left IP and right IP. In general, for tunnel mode, it supports
host-to-host, host-to-subnet, and subnet-to-subnet. In this mode, a new IP packet encapsulates an
existing packet along with its payload and header. Encapsulation in this mode protects IP data, source,
and destination headers over an unsecure network. This mode is useful to transfer data in subnet-to-
subnet, remote access connections, and untrusted networks, such as open public Wi-Fi networks. By
default, IPsec establishes a secure channel between two sites in tunnel mode. With the following
configuration, you can establish a VPN connection as a host-to-host architecture.
By using Nmstate, a declarative API for network management, you can configure an IPsec VPN
connection. After setting the configuration, the Nmstate API ensures that the result matches with the
configuration file. If anything fails, nmstate automatically rolls back the changes to avoid incorrect state
of the system.
In host-to-host configuration, you need to set leftmodecfgclient: no so that it can’t receive network
configuration from the server, hence the value no. In the case of defining systems for IPsec in nmstate,
the left-named system is the local host while the right-named system is the remote host. The following
procedure needs to run on both hosts.
Prerequisites
By using a password, you have generated a PKCS #12 file that stores certificates and
cryptographic keys.
Procedure
3. As Libreswan was already installed, remove its old database files and re-create them:
When importing the PKCS#12 file, enter the password that was used to generate the file.
133
Red Hat Enterprise Linux 9 Configuring and managing networking
---
interfaces:
- name: 'example_ipsec_conn1' 1
type: ipsec
libreswan:
left: '192.0.2.250' 2
leftid: 'local-host.example.com' 3
leftcert: 'local-host.example.com' 4
leftmodecfgclient: 'no' 5
right: '192.0.2.150' 6
rightid: 'remote-host.example.com' 7
rightsubnet: '192.0.2.150/32' 8
ikev2: 'insist' 9
5 The value for not to retrieve client configuration from a remote host
9 The value to accept and receive only the Internet Key Exchange (IKEv2) protocol
Verification
# ip xfrm policy
134
CHAPTER 7. SETTING UP AN IPSEC VPN
# ip xfrm status
Additional resources
7.5.5. Configuring a host-to-host IPsec VPN with PSK authentication and transport
mode by using nmstatectl
IPsec (Internet Protocol Security) is a security protocol suite to authenticate and encrypt IP
communications within networks and devices. The Libreswan utility provides IPsec based
implementation for VPN.
In transport mode, encryption works only for the payload of an IP packet. Also, a new IPsec header gets
appended to the IP packet by keeping the original IP header as it is. Transport mode does not encrypt
the source and destination IP of communication but copies them to an external IP header. Hence,
encryption protects only IP data across the network. This mode is useful to transfer data in a host-to-
host connection of a network. This mode is often used along with the GRE tunnel to save 20 bytes (IP
header) of overheads. By default, the IPsec utility uses tunnel mode. To use transfer mode, set type:
transport for host-to-host connection data transfer.
By using Nmstate, a declarative API for network management, you can configure an IPsec VPN
connection. After setting the configuration, the Nmstate API ensures that the result matches with the
configuration file. If anything fails, nmstate automatically rolls back the changes to avoid incorrect state
of the system. To override the default tunnel mode, specify transport mode.
In the case of defining systems for IPsec in nmstate, the left-named system is the local host while the
right-named system is the remote host. The following procedure needs to run on both hosts.
Prerequisites
By using a password, you have generated a PKCS #12 file that stores certificates and
cryptographic keys.
Procedure
3. As Libreswan was already installed, remove its old database files and re-create them:
135
Red Hat Enterprise Linux 9 Configuring and managing networking
When importing the PKCS#12 file, enter the password that was used to create the file.
---
interfaces:
- name: 'example_ipsec_conn1' 1
type: ipsec
libreswan:
type: 'transport' 2
ipsec-interface: '99' 3
left: '192.0.2.250' 4
leftid: '%fromcert' 5
leftcert: 'local-host.example.org' 6
right: '192.0.2.150' 7
prefix-length: '32' 8
rightid: '%fromcert' 9
ikev2: 'insist' 10
ikelifetime: '24h' 11
salifetime: '24h' 12
2 An IPsec mode
3 The value 99 means that libreswan creates an IPsec xfrm virtual interface
ipsec<number> and automatically finds the next available number
5 On a local host, the value of %fromcert sets the ID to a Distinguished Name (DN) which is
fetched from a loaded certificate
9 On a remote host, the value of %fromcert sets the ID to a Distinguished Name (DN) which
is fetched from a loaded certificate
10 The value to accept and receive only the Internet Key Exchange (IKEv2) protocol
136
CHAPTER 7. SETTING UP AN IPSEC VPN
Verification
# ip xfrm status
# ip xfrm policy
Additional resources
137
Red Hat Enterprise Linux 9 Configuring and managing networking
IMPORTANT
See Technology Preview Features Support Scope on the Red Hat Customer Portal for
information about the support scope for Technology Preview features.
Note that all hosts that participate in a WireGuard VPN are peers. This documentation uses the terms
client to describe hosts that establish a connection and server to describe the host with the fixed
hostname or IP address that the clients connect to and optionally route all traffic through this server.
To set up a WireGuard VPN, you must complete the following steps. You can perform most steps by
using different options:
1. Create public and private keys for every host in the VPN .
2. Configure the WireGuard server by using nmcli, nmtui, the RHEL web console , nm-connection-
editor, or the wg-quick service.
3. Configure firewalld on the WireGuard server by using the command line, the RHEL web console ,
or graphical interface.
4. Configure the WireGuard client by using nmcli, nmtui, the RHEL web console , nm-connection-
editor, or the wg-quick service.
WireGuard operates on the network layer (layer 3). Therefore, you cannot use DHCP and must assign
static IP addresses or IPv6 link-local addresses to the tunnel devices on both the server and clients.
IMPORTANT
You can use WireGuard only if the Federal Information Processing Standard (FIPS)
mode in RHEL is disabled.
138
CHAPTER 8. SETTING UP A WIREGUARD VPN
1. WireGuard reads the destination IP from the packet and compares it to the list of allowed IP
addresses in the local configuration. If the peer is not found, WireGuard drops the packet.
2. If the peer is valid, WireGuard encrypts the packet using the peer’s public key.
3. The sending host looks up the most recent Internet IP address of the host and sends the
encrypted packet to it.
1. WireGuard decrypts the packet using the private key of the remote host.
2. WireGuard reads the internal source address from the packet and looks up whether the IP is
configured in the list of allowed IP addresses in the settings for the peer on the local host. If the
source IP is on the allowlist, WireGuard accepts the packet. If the IP address is not on the list,
WireGuard drops the packet.
The association of public keys and allowed IP addresses is called Cryptokey Routing Table. This means
that the list of IP addresses behaves similar to a routing table when sending packets, and as a kind of
access control list when receiving packets.
To keep the connection active, WireGuard supports persistent keepalives. This means you can set an
interval at which WireGuard sends keepalive packets. By default, the persistent keep-alive feature is
disabled to reduce network traffic. Enable this feature on the client if you use the client in a network with
NAT or if a firewall closes the connection after some time of inactivity.
NOTE
Note that you cannot configure keepalive packets in WireGuard connections by using the
RHEL web console. To configure this feature, edit the connection profile by using the
nmcli utility.
IMPORTANT
139
Red Hat Enterprise Linux 9 Configuring and managing networking
IMPORTANT
For secure connections, create different keys for each host, and ensure that you only
share the public key with the remote WireGuard host. Do not use the example keys used
in this documentation.
If you plan to use the RHEL web console to create a WireGuard VPN connection, you can, alternatively,
generate the public and private key pairs in the web console.
Procedure
2. Create a private key and a corresponding public key for the host:
You will need the content of the key files, but not the files themselves. However, Red Hat
recommends keeping the files in case that you need to remember the keys in future.
# cat /etc/wireguard/$HOSTNAME.private.key
YFAnE0psgIdiAF7XR4abxiwVRnlMfeltxu10s/c4JXg=
You will need the private key to configure the WireGuard connection on the local host. Do not
share the private key.
# cat /etc/wireguard/$HOSTNAME.public.key
UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
You will need the public key to configure the WireGuard connection on the remote host.
Additional resources
140
CHAPTER 8. SETTING UP A WIREGUARD VPN
Server:
Client:
Prerequisites
You have generated the public and private key for both the server and client.
Procedure
# nmcli connection add type wireguard con-name server-wg0 ifname wg0 autoconnect
no
This command creates a profile named server-wg0 and assigns the virtual interface wg0 to it.
To prevent the connection from starting automatically after you add it without finalizing the
configuration, disable the autoconnect parameter.
2. Set the tunnel IPv4 address and subnet mask of the server:
3. Set the tunnel IPv6 address and subnet mask of the server:
141
Red Hat Enterprise Linux 9 Configuring and managing networking
Always set a fixed port number on hosts that receive incoming WireGuard connections. If you do
not set a port, WireGuard uses a random free port each time you activate the wg0 interface.
6. Add peer configurations for each client that you want to allow to communicate with this server.
You must add these settings manually, because the nmcli utility does not support setting the
corresponding connection properties.
[wireguard-peer.bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=]
allowed-ips=192.0.2.2;2001:db8:1::2;
The allowed-ips parameter sets the tunnel IP addresses of the client that are allowed
to send data to this server.
Add a section for each client.
Next steps
Verification
# wg show wg0
interface: wg0
public key: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
private key: (hidden)
listening port: 51820
peer: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
allowed ips: 192.0.2.2/32, 2001:db8:1::2/128
142
CHAPTER 8. SETTING UP A WIREGUARD VPN
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Additional resources
Server:
Client:
Prerequisites
You have generated the public and private key for both the server and client.
143
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
# nmtui
4. Select the WireGuard connection type in the list, and press Enter.
a. Enter the name of the connection and the virtual interface, such as wg0, that
NetworkManager should assign to the connection.
c. Set the listen port number, such as 51820, for incoming WireGuard connections.
Always set a fixed port number on hosts that receive incoming WireGuard connections. If
you do not set a port, WireGuard uses a random free port each time you activate the
interface.
ii. Set the Allowed IPs field to the tunnel IP addresses of the client that are allowed to
send data to this server.
144
CHAPTER 8. SETTING UP A WIREGUARD VPN
ii. Enter the tunnel IPv4 address and the subnet mask. Leave the Gateway field empty.
ii. Enter the tunnel IPv6 address and the subnet mask. Leave the Gateway field empty.
6. In the window with the list of connections, select Back, and press Enter.
7. In the NetworkManager TUI main window, select Quit, and press Enter.
145
Red Hat Enterprise Linux 9 Configuring and managing networking
Next steps
Verification
# wg show wg0
interface: wg0
public key: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
private key: (hidden)
listening port: 51820
peer: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
allowed ips: 192.0.2.2/32, 2001:db8:1::2/128
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Additional resources
Prerequisites
The static tunnel IP addresses and subnet masks of both the server and client
Procedure
146
CHAPTER 8. SETTING UP A WIREGUARD VPN
1. Select the Networking tab in the navigation on the left side of the screen.
3. If the wireguard-tools and systemd-resolved packages are not already installed, the web
console displays a corresponding notification. Click Install to install these packages.
4. Enter the name of the WireGuard device that you want to create.
If you want use the keys that the web console has created:
ii. Note the Public key value. You require this information when you configure the client.
ii. Paste the private key into the text field. The web console automatically calculates the
corresponding public key.
6. Set a listen port number, such as 51820, for incoming WireGuard connections.
Always set a fixed port number on hosts that receive incoming WireGuard connections. If you do
not set a port, WireGuard uses a random free port each time you activate the interface.
7. Set the tunnel IPv4 address and subnet mask of the server.
To also set an IPv6 address, you must edit the connection after you have created it.
8. Add peer configurations for each client that you want to allow to communicate with this server:
d. Set the Allowed IPs field to the tunnel IP addresses of the clients that are allowed to send
data to this server.
147
Red Hat Enterprise Linux 9 Configuring and managing networking
c. Set the Addresses field to Manual, and enter the tunnel IPv6 address and prefix of the
server.
d. Click Save.
Next steps
Verification
# wg show wg0
interface: wg0
public key: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
private key: (hidden)
listening port: 51820
148
CHAPTER 8. SETTING UP A WIREGUARD VPN
peer: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
allowed ips: 192.0.2.2/32, 2001:db8:1::2/128
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Prerequisites
You have generated the public and private key for both the server and client.
Procedure
# nm-connection-editor
5. On the General tab, select Connect automatically with priority. Optionally, set a priority value.
149
Red Hat Enterprise Linux 9 Configuring and managing networking
a. Enter the name of the virtual interface, such as wg0, that NetworkManager should assign to
the connection.
c. Set the listen port number, such as 51820, for incoming WireGuard connections.
Always set a fixed port number on hosts that receive incoming WireGuard connections. If
you do not set a port, WireGuard uses a random free port each time you activate the
interface.
ii. Set the Allowed IPs field to the tunnel IP addresses of the client that are allowed to
send data to this server.
b. Click Add to enter the tunnel IPv4 address and the subnet mask. Leave the Gateway field
empty.
b. Click Add to enter the tunnel IPv6 address and the subnet mask. Leave the Gateway field
empty.
Next steps
Verification
# wg show wg0
interface: wg0
public key: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
private key: (hidden)
listening port: 51820
peer: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
allowed ips: 192.0.2.2/32, 2001:db8:1::2/128
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
150
CHAPTER 8. SETTING UP A WIREGUARD VPN
Additional resources
Server:
Client:
Prerequisites
You have generated the public and private key for both the server and client.
Procedure
151
Red Hat Enterprise Linux 9 Configuring and managing networking
[Interface]
Address = 192.0.2.1/24, 2001:db8:1::1/32
ListenPort = 51820
PrivateKey = YFAnE0psgIdiAF7XR4abxiwVRnlMfeltxu10s/c4JXg=
[Peer]
PublicKey = bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
AllowedIPs = 192.0.2.2, 2001:db8:1::2
The [Interface] section describes the WireGuard settings of the interface on the server:
ListenPort: The port on which WireGuard listens for incoming UDP connections.
Always set a fixed port number on hosts that receive incoming WireGuard connections.
If you do not set a port, WireGuard uses a random free port each time you activate the
wg0 interface.
AllowedIPs: The tunnel IP addresses of the client that are allowed to send data to this
server.
The systemd instance name must match the name of the configuration file in the
/etc/wireguard/ directory without the .conf suffix. The service also uses this name for the
virtual network interface.
Next steps
Verification
# wg show wg0
interface: wg0
public key: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
private key: (hidden)
listening port: 51820
152
CHAPTER 8. SETTING UP A WIREGUARD VPN
peer: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
allowed ips: 192.0.2.2/32, 2001:db8:1::2/128
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Additional resources
Procedure
1. Open the WireGuard port for incoming connections in the firewalld service:
2. If clients should route all traffic through the tunnel and use the WireGuard server as the default
gateway, enable masquerading for the public zone:
# firewall-cmd --reload
Verification
# firewall-cmd --list-all
public (active)
...
153
Red Hat Enterprise Linux 9 Configuring and managing networking
ports: 51820/udp
masquerade: yes
...
Additional resources
Prerequisites
Procedure
1. Select the Networking tab in the navigation on the left side of the screen.
6. If clients should route all traffic through the tunnel and use the WireGuard server as the default
gateway, enable masquerading for the public zone:
Note that you cannot enable masquerading in firewalld zones in the web console.
Verification
154
CHAPTER 8. SETTING UP A WIREGUARD VPN
1. Select the Networking tab in the navigation on the left side of the screen.
3. The list contains an entry for the wireguard service and displays the UDP port that you
configured in the WireGuard connection profile.
Procedure
1. Press the Super key, enter firewall, and select the Firewall application from the results.
b. Enter the port number you set for incoming WireGuard connections:
d. Click OK.
5. If clients should route all traffic through the tunnel and use the WireGuard server as the default
gateway:
Verification
# firewall-cmd --list-all
155
Red Hat Enterprise Linux 9 Configuring and managing networking
public (active)
...
ports: 51820/udp
masquerade: yes
...
Client:
Server:
Prerequisites
You have generated the public and private key for both the server and client.
Procedure
# nmcli connection add type wireguard con-name client-wg0 ifname wg0 autoconnect
no
This command creates a profile named client-wg0 and assigns the virtual interface wg0 to it. To
prevent the connection from starting automatically after you add it without finalizing the
configuration, disable the autoconnect parameter.
2. Optional: Configure NetworkManager so that it does not automatically start the client-wg
connection:
156
CHAPTER 8. SETTING UP A WIREGUARD VPN
3. Set the tunnel IPv4 address and subnet mask of the client:
4. Set the tunnel IPv6 address and subnet mask of the client:
5. If you want to route all traffic through the tunnel, set the tunnel IP addresses of the server as
the default gateway:
Routing all traffic through the tunnel requires that you set, in a later step, the allowed-ips on
the this client to 0.0.0.0/0;::/0.
Note that routing all traffic through the tunnel can impact the connectivity to other hosts based
on the server routing and firewall configuration.
7. Add peer configurations for each server that you want to allow to communicate with this client.
You must add these settings manually, because the nmcli utility does not support setting the
corresponding connection properties.
[wireguard-peer.UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=]
endpoint=server.example.com:51820
allowed-ips=192.0.2.1;2001:db8:1::1;
persistent-keepalive=20
The endpoint parameter sets the hostname or IP address and the port of the server.
The client uses this information to establish the connection.
The allowed-ips parameter sets a list of IP addresses that can send data to this client.
For example, set the parameter to:
The tunnel IP addresses of the server to allow only the server to communicate with
this client. The value in the example above configures this scenario.
0.0.0.0/0;::/0; to allow any remote IPv4 and IPv6 address to communicate with this
157
Red Hat Enterprise Linux 9 Configuring and managing networking
0.0.0.0/0;::/0; to allow any remote IPv4 and IPv6 address to communicate with this
client. Use this setting to route all traffic through the tunnel and use the WireGuard
server as default gateway.
Verification
# ping 192.0.2.1
# ping6 2001:db8:1::1
# wg show wg0
interface: wg0
public key: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
private key: (hidden)
listening port: 51820
peer: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
endpoint: server.example.com:51820
allowed ips: 192.0.2.1/32, 2001:db8:1::1/128
latest handshake: 1 minute, 41 seconds ago
transfer: 824 B received, 1.01 KiB sent
persistent keepalive: every 20 seconds
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Note that the output has only the latest handshake and transfer entries if you have already
sent traffic through the VPN tunnel.
158
CHAPTER 8. SETTING UP A WIREGUARD VPN
Additional resources
Client:
Server:
Prerequisites
You have generated the public and private key for both the server and client.
Procedure
# nmtui
159
Red Hat Enterprise Linux 9 Configuring and managing networking
4. Select the WireGuard connection type in the list, and press Enter.
a. Enter the name of the connection and the virtual interface, such as wg0, that
NetworkManager should assign to the connection.
ii. Set the Allowed IPs field. For example, set it to:
The tunnel IP addresses of the server to allow only the server to communicate with
this client.
0.0.0.0/0,::/0 to allow any remote IPv4 and IPv6 address to communicate with this
client. Use this setting to route all traffic through the tunnel and use the WireGuard
server as default gateway.
iii. Enter the host name or IP address and port of the WireGuard server into the Endpoint
field. Use the following format: hostname_or_IP:port_number
iv. Optional: If you use the client in a network with network address translation (NAT) or if a
firewall closes the UDP connection after some time of inactivity, set a persistent keep
alive interval in seconds. In this interval, the client sends a keepalive packet to the server.
ii. Enter the tunnel IPv4 address and the subnet mask. Leave the Gateway field empty.
160
CHAPTER 8. SETTING UP A WIREGUARD VPN
ii. Enter the tunnel IPv6 address and the subnet mask. Leave the Gateway field empty.
6. In the window with the list of connections, select Back, and press Enter.
7. In the NetworkManager TUI main window, select Quit, and press Enter.
Verification
# ping 192.0.2.1
# ping6 2001:db8:1::1
# wg show wg0
interface: wg0
public key: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
private key: (hidden)
161
Red Hat Enterprise Linux 9 Configuring and managing networking
peer: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
endpoint: server.example.com:51820
allowed ips: 192.0.2.1/32, 2001:db8:1::1/128
latest handshake: 1 minute, 41 seconds ago
transfer: 824 B received, 1.01 KiB sent
persistent keepalive: every 20 seconds
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Note that the output contains only the latest handshake and transfer entries if you have
already sent traffic through the VPN tunnel.
Additional resources
Prerequisites
The static tunnel IP addresses and subnet masks of both the server and client
Procedure
1. Select the Networking tab in the navigation on the left side of the screen.
3. If the wireguard-tools and systemd-resolved packages are not already installed, the web
162
CHAPTER 8. SETTING UP A WIREGUARD VPN
3. If the wireguard-tools and systemd-resolved packages are not already installed, the web
console displays a corresponding notification. Click Install to install these packages.
4. Enter the name of the WireGuard device that you want to create.
If you want use the keys that the web console has created:
ii. Note the Public key value. You require this information when you configure the client.
ii. Paste the private key into the text field. The web console automatically calculates the
corresponding public key.
7. Set the tunnel IPv4 address and subnet mask of the client.
To also set an IPv6 address, you must edit the connection after you have created it.
8. Add a peer configuration for the server that you want to allow to communicate with this client:
c. Set the Endpoint field to the hostname or IP address and the port of the server, for
example server.example.com:51820. The client uses this information to establish the
connection.
d. Set the Allowed IPs field to the tunnel IP addresses of the clients that are allowed to send
data to this server. For example, set the field to one of the following:
The tunnel IP addresses of the server to allow only the server to communicate with this
client. The value in the screen capture below configures this scenario.
0.0.0.0/0 to allow any remote IPv4 address to communicate with this client. Use this
setting to route all traffic through the tunnel and use the WireGuard server as default
gateway.
163
Red Hat Enterprise Linux 9 Configuring and managing networking
c. Set the Addresses field to Manual, and enter the tunnel IPv6 address and prefix of the
client.
d. Click Save.
Verification
# ping 192.0.2.1
WireGuard establishes the connection when you try to send traffic through the tunnel.
# wg show wg0
interface: wg0
public key: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
private key: (hidden)
listening port: 45513
164
CHAPTER 8. SETTING UP A WIREGUARD VPN
peer: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
endpoint: server.example.com:51820
allowed ips: 192.0.2.1/32, 2001:db8:1::1/128
latest handshake: 1 minute, 41 seconds ago
transfer: 824 B received, 1.01 KiB sent
persistent keepalive: every 20 seconds
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Note that the output has only the latest handshake and transfer entries if you have already
sent traffic through the VPN tunnel.
Prerequisites
You have generated the public and private key for both the server and client.
Procedure
# nm-connection-editor
165
Red Hat Enterprise Linux 9 Configuring and managing networking
a. Enter the name of the virtual interface, such as wg0, that NetworkManager should assign to
the connection.
ii. Set the Allowed IPs field. For example, set it to:
The tunnel IP addresses of the server to allow only the server to communicate with
this client.
0.0.0.0/0;::/0; to allow any remote IPv4 and IPv6 address to communicate with this
client. Use this setting to route all traffic through the tunnel and use the WireGuard
server as default gateway.
Note that routing all traffic through the tunnel can impact the connectivity to other
hosts based on the server routing and firewall configuration.
iii. Enter the hostname or IP address and port of the WireGuard server into the Endpoint
field. Use the following format: hostname_or_IP:port_number
iv. Optional: If you use the client in a network with network address translation (NAT) or if a
firewall closes the UDP connection after some time of inactivity, set a persistent keep
alive interval in seconds. In this interval, the client sends a keep alive packet to the
server.
v. Click Apply.
b. Click Add to enter the tunnel IPv4 address and the subnet mask.
c. If you want to route all traffic through the tunnel, set the tunnel IPv4 address of the server
in the Gateway field. Otherwise, leave the field empty.
Routing all IPv4 traffic through the tunnel requires that you included 0.0.0.0/0 in the
Allowed IPs field on this client.
b. Click Add to enter the tunnel IPv6 address and the subnet mask.
c. If you want to route all traffic through the tunnel, set the tunnel IPv6 address of the server
in the Gateway field. Otherwise, leave the field empty.
Routing all IPv4 traffic through the tunnel requires that you included ::/0 in the Allowed IPs
166
CHAPTER 8. SETTING UP A WIREGUARD VPN
Routing all IPv4 traffic through the tunnel requires that you included ::/0 in the Allowed IPs
field on this client.
Verification
# ping 192.0.2.1
# ping6 2001:db8:1::1
# wg show wg0
interface: wg0
public key: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
private key: (hidden)
listening port: 51820
peer: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
endpoint: server.example.com:51820
allowed ips: 192.0.2.1/32, 2001:db8:1::1/128
latest handshake: 1 minute, 41 seconds ago
transfer: 824 B received, 1.01 KiB sent
persistent keepalive: every 20 seconds
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
Note that the output only has the latest handshake and transfer entries if you have already
sent traffic through the VPN tunnel.
Additional resources
You can configure a WireGuard client by creating a configuration file in the /etc/wireguard/ directory.
167
Red Hat Enterprise Linux 9 Configuring and managing networking
You can configure a WireGuard client by creating a configuration file in the /etc/wireguard/ directory.
Use this method to configure the service independently from NetworkManager.
Client:
Server:
Prerequisites
You have generated the public and private key for both the server and client.
Procedure
[Interface]
Address = 192.0.2.2/24, 2001:db8:1::2/32
PrivateKey = aPUcp5vHz8yMLrzk8SsDyYnV33IhE/k20e52iKJFV0A=
[Peer]
PublicKey = UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
AllowedIPs = 192.0.2.1, 2001:db8:1::1
Endpoint = server.example.com:51820
PersistentKeepalive = 20
The [Interface] section describes the WireGuard settings of the interface on the client:
168
CHAPTER 8. SETTING UP A WIREGUARD VPN
AllowedIPs: The IP addresses that are allowed to send data to this client. For example,
set the parameter to:
The tunnel IP addresses of the server to allow only the server to communicate with
this client. The value in the example above configures this scenario.
0.0.0.0/0, ::/0 to allow any remote IPv4 and IPv6 address to communicate with this
client. Use this setting to route all traffic through the tunnel and use the WireGuard
server as default gateway.
Endpoint: Sets the hostname or IP address and the port of the server. The client uses
this information to establish the connection.
The systemd instance name must match the name of the configuration file in the
/etc/wireguard/ directory without the .conf suffix. The service also uses this name for the
virtual network interface.
Verification
# ping 192.0.2.1
# ping6 2001:db8:1::1
# wg show wg0
interface: wg0
public key: bnwfQcC8/g2i4vvEqcRUM2e6Hi3Nskk6G9t4r26nFVM=
private key: (hidden)
listening port: 51820
peer: UtjqCJ57DeAscYKRfp7cFGiQqdONRn69u249Fa4O6BE=
endpoint: server.example.com:51820
allowed ips: 192.0.2.1/32, 2001:db8:1::1/128
latest handshake: 1 minute, 41 seconds ago
transfer: 824 B received, 1.01 KiB sent
persistent keepalive: every 20 seconds
To display the private key in the output, use the WG_HIDE_KEYS=never wg show wg0
command.
169
Red Hat Enterprise Linux 9 Configuring and managing networking
Note that the output contains only the latest handshake and transfer entries if you have
already sent traffic through the VPN tunnel.
Additional resources
170
CHAPTER 9. CONFIGURING IP TUNNELS
The routers in both networks that establish the tunnel requires at least two interfaces:
One interface that is connected to the network through which the tunnel is established.
To establish the tunnel, you create a virtual interface on both routers with an IP address from the
remote subnet.
Depending on the type, these tunnels act either on layer 2 or 3 of the Open Systems Interconnection
(OSI) model.
IMPORTANT
Data sent through an IPIP tunnel is not encrypted. For security reasons, use the tunnel
only for data that is already encrypted, for example, by other protocols, such as HTTPS.
Note that IPIP tunnels support only unicast packets. If you require an IPv4 tunnel that supports
multicast, see Configuring a GRE tunnel using nmcli to encapsulate layer-3 traffic in IPv4 packets.
For example, you can create an IPIP tunnel between two RHEL routers to connect two internal subnets
over the internet as shown in the following diagram:
171
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
Each RHEL router has a network interface that is connected to its local subnet.
Each RHEL router has a network interface that is connected to the internet.
The traffic you want to send through the tunnel is IPv4 unicast.
Procedure
# nmcli connection add type ip-tunnel ip-tunnel.mode ipip con-name tun0 ifname
tun0 remote 198.51.100.5 local 203.0.113.10
The remote and local parameters set the public IP addresses of the remote and the local
routers.
Note that a /30 subnet with two usable IP addresses is sufficient for the tunnel.
d. Add a static route that routes traffic to the 172.16.0.0/24 network to the tunnel IP on router
B:
172
CHAPTER 9. CONFIGURING IP TUNNELS
# nmcli connection add type ip-tunnel ip-tunnel.mode ipip con-name tun0 ifname
tun0 remote 203.0.113.10 local 198.51.100.5
The remote and local parameters set the public IP addresses of the remote and local
routers.
d. Add a static route that routes traffic to the 192.0.2.0/24 network to the tunnel IP on router
A:
Verification
From each RHEL router, ping the IP address of the internal interface of the other router:
# ping 172.16.0.1
# ping 192.0.2.1
Additional resources
173
Red Hat Enterprise Linux 9 Configuring and managing networking
IMPORTANT
Data sent through a GRE tunnel is not encrypted. For security reasons, use the tunnel
only for data that is already encrypted, for example, by other protocols, such as HTTPS.
For example, you can create a GRE tunnel between two RHEL routers to connect two internal subnets
over the internet as shown in the following diagram:
NOTE
The gre0 device name is reserved. Use gre1 or a different name for the device.
Prerequisites
Each RHEL router has a network interface that is connected to its local subnet.
Each RHEL router has a network interface that is connected to the internet.
Procedure
# nmcli connection add type ip-tunnel ip-tunnel.mode gre con-name gre1 ifname
gre1 remote 198.51.100.5 local 203.0.113.10
174
CHAPTER 9. CONFIGURING IP TUNNELS
The remote and local parameters set the public IP addresses of the remote and the local
routers.
Note that a /30 subnet with two usable IP addresses is sufficient for the tunnel.
d. Add a static route that routes traffic to the 172.16.0.0/24 network to the tunnel IP on router
B:
# nmcli connection add type ip-tunnel ip-tunnel.mode gre con-name gre1 ifname
gre1 remote 203.0.113.10 local 198.51.100.5
The remote and local parameters set the public IP addresses of the remote and the local
routers.
d. Add a static route that routes traffic to the 192.0.2.0/24 network to the tunnel IP on router
A:
175
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
1. From each RHEL router, ping the IP address of the internal interface of the other router:
# ping 172.16.0.1
# ping 192.0.2.1
Additional resources
IMPORTANT
Data sent through a GRETAP tunnel is not encrypted. For security reasons, establish the
tunnel over a VPN or a different encrypted connection.
For example, you can create a GRETAP tunnel between two RHEL routers to connect two networks
using a bridge as shown in the following diagram:
176
CHAPTER 9. CONFIGURING IP TUNNELS
NOTE
The gretap0 device name is reserved. Use gretap1 or a different name for the device.
Prerequisites
Each RHEL router has a network interface that is connected to its local network, and the
interface has no IP configuration assigned.
Each RHEL router has a network interface that is connected to the internet.
Procedure
c. Add a new connection profile for the interface that is connected to local network to the
bridge:
d. Add a new connection profile for the GRETAP tunnel interface to the bridge:
177
Red Hat Enterprise Linux 9 Configuring and managing networking
# nmcli connection add type ip-tunnel ip-tunnel.mode gretap port-type bridge con-
name bridge0-port2 ifname gretap1 remote 198.51.100.5 local 203.0.113.10
controller bridge0
The remote and local parameters set the public IP addresses of the remote and the local
routers.
e. Optional: Disable the Spanning Tree Protocol (STP) if you do not need it:
By default, STP is enabled and causes a delay before you can use the connection.
f. Configure that activating the bridge0 connection automatically activates the ports of the
bridge:
c. Add a new connection profile for the interface that is connected to local network to the
bridge:
d. Add a new connection profile for the GRETAP tunnel interface to the bridge:
# nmcli connection add type ip-tunnel ip-tunnel.mode gretap port-type bridge con-
name bridge0-port2 ifname gretap1 remote 203.0.113.10 local 198.51.100.5
controller bridge0
The remote and local parameters set the public IP addresses of the remote and the local
routers.
e. Optional: Disable the Spanning Tree Protocol (STP) if you do not need it:
f. Configure that activating the bridge0 connection automatically activates the ports of the
178
CHAPTER 9. CONFIGURING IP TUNNELS
f. Configure that activating the bridge0 connection automatically activates the ports of the
bridge:
Verification
1. On both routers, verify that the enp1s0 and gretap1 connections are connected and that the
CONNECTION column displays the connection name of the port:
# nmcli device
nmcli device
DEVICE TYPE STATE CONNECTION
...
bridge0 bridge connected bridge0
enp1s0 ethernet connected bridge0-port1
gretap1 iptunnel connected bridge0-port2
2. From each RHEL router, ping the IP address of the internal interface of the other router:
# ping 192.0.2.2
# ping 192.0.2.1
Additional resources
179
Red Hat Enterprise Linux 9 Configuring and managing networking
In this example, RHEL-host-A and RHEL-host-B use a bridge, br0, to connect the virtual network of a
VM on each host with a VXLAN named vxlan10. Due to this configuration, the VXLAN is invisible to the
VMs, and the VMs do not require any special configuration. If you later connect more VMs to the same
virtual network, the VMs are automatically members of the same virtual layer-2 domain.
IMPORTANT
Just as normal layer-2 traffic, data in a VXLAN is not encrypted. For security reasons, use
a VXLAN over a VPN or other types of encrypted connections.
VXLANs use a 24-bit ID. Therefore, you can create up to 16,777,216 isolated networks. For
example, a virtual LAN (VLAN), supports only 4,096 isolated networks.
VXLANs use the IP protocol. This enables you to route the traffic and virtually run systems in
different networks and locations within the same layer-2 domain.
Unlike most tunnel protocols, a VXLAN is not only a point-to-point network. A VXLAN can learn
the IP addresses of the other endpoints either dynamically or use statically-configured
forwarding entries.
180
CHAPTER 10. USING A VXLAN TO CREATE A VIRTUAL LAYER-2 DOMAIN FOR VMS
Additional resources
/usr/share/doc/kernel-doc-<kernel_version>/Documentation/networking/vxlan.rst provided
by the kernel-doc package
Run this procedure on both RHEL hosts, and adjust the IP address configuration accordingly.
Prerequisites
Procedure
Verification
# ping RHEL-host-B.example.com
Note that you cannot ping the other VM host before you have configured the network on that
host as well.
Additional resources
181
Red Hat Enterprise Linux 9 Configuring and managing networking
Run this procedure on both RHEL hosts, and adjust the IP addresses accordingly.
Procedure
# nmcli connection add type bridge con-name br0 ifname br0 ipv4.method disabled
ipv6.method disabled
This command sets no IPv4 and IPv6 addresses on the bridge device, because this bridge works
on layer 2.
# nmcli connection add type vxlan port-type bridge con-name br0-vxlan10 ifname
vxlan10 id 10 local 198.51.100.2 remote 203.0.113.1 controller br0
remote 203.0.113.1: Sets the unicast or multicast IP address to use in outgoing packets
when the destination link layer address is not known in the VXLAN device forwarding
database.
controller br0: Sets this VXLAN connection to be created as a port in the br0 connection.
ipv4.method disabled and ipv6.method disabled: Disables IPv4 and IPv6 on the bridge.
By default, NetworkManager uses 8472 as the destination port. If the destination port is
different, additionally, pass the destination-port <port_number> option to the command.
4. Open port 8472 for incoming UDP connections in the local firewall:
Verification
182
CHAPTER 10. USING A VXLAN TO CREATE A VIRTUAL LAYER-2 DOMAIN FOR VMS
Additional resources
Prerequisites
Procedure
<network>
<name>vxlan10-bridge</name>
<forward mode="bridge" />
<bridge name="br0" />
</network>
# rm ~/vxlan10-bridge.xml
5. Configure the vxlan10-bridge virtual network to start automatically when the libvirtd service
starts:
Verification
183
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
# virsh net-list
Name State Autostart Persistent
----------------------------------------------------
vxlan10-bridge active yes yes
...
Additional resources
Prerequisites
Procedure
To create a new VM and configure it to use the vxlan10-bridge network, pass the --network
network:vxlan10-bridge option to the virt-install command when you create the VM:
Verification
184
CHAPTER 10. USING A VXLAN TO CREATE A VIRTUAL LAYER-2 DOMAIN FOR VMS
Note that the libvirtd service dynamically updates the bridge’s configuration. When you start a
VM which uses the vxlan10-bridge network, the corresponding vnet* device on the host
appears as a port of the bridge.
3. Use address resolution protocol (ARP) requests to verify whether VMs are in the same VXLAN:
# arping -c 1 192.0.2.2
ARPING 192.0.2.2 from 192.0.2.1 enp1s0
Unicast reply from 192.0.2.2 [52:54:00:c5:98:1c] 1.450ms
Sent 1 probe(s) (0 broadcast(s))
Received 1 response(s) (0 request(s), 0 broadcast(s))
If the command shows a reply, the VM is in the same layer-2 domain and, in this case in the
same VXLAN.
Additional resources
185
Red Hat Enterprise Linux 9 Configuring and managing networking
Use the nmcli utility to configure connections by using the command line.
Use the GNOME system menu to quickly connect to wifi networks that do not require any
configuration.
Use the GNOME Settings application to configure connections by using the GNOME
application.
Use the network RHEL system role to automate the configuration of connections on one or
multiple hosts.
WARNING
Do not connect to wifi networks that do not use encryption or which support only
the insecure WEP or WPA standards.
Red Hat Enterprise Linux 9 supports the following wifi security types:
None: Encryption is disabled, and data is transferred in plain text over the network.
Enhanced Open: With opportunistic wireless encryption (OWE), devices negotiate unique
pairwise master keys (PMK) to encrypt connections in wireless networks without authentication.
LEAP: The Lightweight Extensible Authentication Protocol, which was developed by Cisco, is a
proprietary version of the extensible authentication protocol (EAP).
WPA & WPA2 Personal: In personal mode, the Wi-Fi Protected Access (WPA) and Wi-Fi
Protected Access 2 (WPA2) authentication methods use a pre-shared key.
WPA & WPA2 Enterprise: In enterprise mode, WPA and WPA2 use the EAP framework and
authenticate users to a remote authentication dial-in user service (RADIUS) server.
WPA3 Personal: Wi-Fi Protected Access 3 (WPA3) Personal uses simultaneous authentication
of equals (SAE) instead of pre-shared keys (PSK) to prevent dictionary attacks. WPA3 uses
perfect forward secrecy (PFS).
186
CHAPTER 11. MANAGING WIFI CONNECTIONS
You can use the nmcli utility to connect to a wifi network. When you attempt to connect to a network
for the first time, the utility automatically creates a NetworkManager connection profile for it. If the
network requires additional settings, such as static IP addresses, you can then modify the profile after it
has been automatically created.
Prerequisites
Procedure
1. If the wifi radio has been disabled in NetworkManager, enable this feature:
The service set identifier (SSID) column contains the names of the networks. If the column
shows --, the access point of this network does not broadcast an SSID.
If you prefer to set the password in the command instead of entering it interactively, use the
password wifi-password option in the command instead of --ask:
Note that, if the network requires static IP addresses, NetworkManager fails to activate the
connection at this point. You can configure the IP addresses in later steps.
187
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
If the output lists the wifi connection you have created, the connection is active.
# ping -c 3 example.com
Additional resources
NOTE
Using the GNOME system menu to establish a connection to a wifi network for the first
time has certain limitations. For example, you can not configure IP address settings. In
this case first configure the connections:
Prerequisites
Procedure
1. Open the system menu on the right side of the top bar.
188
CHAPTER 11. MANAGING WIFI CONNECTIONS
5. Click Connect.
6. If this is the first time you connect to this network, enter the password for the network, and click
Connect.
Verification
1. Open the system menu on the right side of the top bar, and verify that the wifi network is
connected:
# ping -c 3 example.com
In GNOME settings, you can configure wifi connections for all wifi network security types that RHEL
supports.
189
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
Procedure
2. Click on the name of the wifi network you want to connect to.
4. If the network requires additional settings, such as static IP addresses or a security type other
than WPA2 Personal:
b. Optional: Configure the network profile on the Details tab to not automatically connect.
If you deactivate this feature, you must always manually connect to the network, for
example, by using GNOME settings or the GNOME system menu.
c. Configure IPv4 settings on the IPv4 tab, and IPv6 settings on the IPv6 tab.
d. On the Security tab, select the authentication of the network, such as WPA3 Personal, and
enter the password.
Depending on the selected security, the application shows additional fields. Fill them
accordingly. For details, ask the administrator of the wifi network.
e. Click Apply.
Verification
1. Open the system menu on the right side of the top bar, and verify that the wifi network is
connected:
# ping -c 3 example.com
190
CHAPTER 11. MANAGING WIFI CONNECTIONS
The nmtui application provides a text-based user interface for NetworkManager. You can use nmtui to
connect to a wifi network.
NOTE
In nmtui:
Procedure
1. If you do not know the network device name you want to use in the connection, display the
available devices:
2. Start nmtui:
# nmtui
5. Select Wi-Fi from the list of network types, and press Enter.
8. Enter the name of the Wi-Fi network, the Service Set Identifier (SSID), into the SSID field.
10. Select the Security field, press Enter, and set the authentication type of the network from the
list.
Depending on the authentication type you have selected, nmtui displays different fields.
a. Press the Automatic button next to the protocol, and select Manual from the displayed list.
b. Press the Show button next to the protocol you want to configure to display additional
fields, and fill them.
191
Red Hat Enterprise Linux 9 Configuring and managing networking
13. Press the OK button to create and automatically activate the new connection.
15. Select Quit, and press Enter to close the nmtui application.
Verification
If the output lists the wifi connection you have created, the connection is active.
# ping -c 3 example.com
By default, NetworkManager enables the auto-connect feature for connection profiles and
automatically connects to a saved network if it is available.
Prerequisites
192
CHAPTER 11. MANAGING WIFI CONNECTIONS
Procedure
# nm-connection-editor
5. Optional: Configure the network profile on the General tab to not automatically connect.
If you deactivate this feature, you must always manually connect to the network, for example, by
using GNOME settings or the GNOME system menu.
6. On the Wi-Fi tab, enter the service set identifier (SSID) in the SSID field.
7. On the Wi-Fi Security tab, select the authentication type for the network, such as WPA3
Personal, and enter the password.
Depending on the selected security, the application shows additional fields. Fill them
accordingly. For details, ask the administrator of the wifi network.
8. Configure IPv4 settings on the IPv4 tab, and IPv6 settings on the IPv6 tab.
9. Click Save.
Verification
1. Open the system menu on the right side of the top bar, and verify that the wifi network is
connected:
# ping -c 3 example.com
193
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
The following files required for TLS authentication exist on the control node:
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure a wifi connection with 802.1X authentication
hosts: managed-node-01.example.com
tasks:
- name: Copy client key for 802.1X authentication
ansible.builtin.copy:
src: "/srv/data/client.key"
dest: "/etc/pki/tls/private/client.key"
mode: 0400
- block:
194
CHAPTER 11. MANAGING WIFI CONNECTIONS
- ansible.builtin.import_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: Configure the Example-wifi profile
interface_name: wlp1s0
state: up
type: wireless
autoconnect: yes
ip:
dhcp4: true
auto6: true
wireless:
ssid: "Example-wifi"
key_mgmt: "wpa-eap"
ieee802_1x:
identity: "user_name"
eap: tls
private_key: "/etc/pki/tls/client.key"
private_key_password: "password"
private_key_password_flags: none
client_cert: "/etc/pki/tls/client.pem"
ca_cert: "/etc/pki/tls/cacert.pem"
domain_suffix_match: "example.com"
These settings define a wifi connection profile for the wlp1s0 interface. The profile uses 802.1X
standard to authenticate the client to the wifi network. The connection retrieves IPv4
addresses, IPv6 addresses, default gateway, routes, DNS servers, and search domains from a
DHCP server and IPv6 stateless address autoconfiguration (SLAAC).
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
195
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
The wifi connection profile exists in NetworkManager and has a valid IP configuration.
If the client is required to verify the certificate of the authenticator, the Certificate Authority
(CA) certificate must be stored in the /etc/pki/ca-trust/source/anchors/ directory.
Procedure
1. Set the wifi security mode to wpa-eap, the Extensible Authentication Protocol (EAP) to peap,
the inner authentication protocol to mschapv2, and the user name:
IMPORTANT
3. If the client needs to verify the certificate of the authenticator, set the 802-1x.ca-cert
parameter in the connection profile to the path of the CA certificate:
NOTE
For security reasons, clients should validate the certiciate of the authenticator.
Verification
196
CHAPTER 11. MANAGING WIFI CONNECTIONS
Verification
Additional resources
By default, setregdomain attempts to determine the country code automatically. If this fails, the
wireless regulatory domain setting might be wrong. To work around this problem, you can manually set
the country code.
IMPORTANT
Manually setting the regulatory domain disables the automatic detection. Therefore, if
you later use the computer in a different country, the previously configured setting might
no longer be correct. In this case, remove the /etc/sysconfig/regdomain file to switch
back to automatic detection or use this procedure to manually update the regulatory
domain setting again.
Procedure
# iw reg get
global
country US: DFS-FCC
...
COUNTRY=<country_code>
Set the COUNTRY variable to an ISO 3166-1 alpha2 country code, such as DE for Germany or
US for the United States of America.
# setregdomain
Verification
# iw reg get
global
197
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
198
CHAPTER 12. CONFIGURING RHEL AS A WPA2 OR WPA3 PERSONAL ACCESS POINT
Configures the dnsmasq service to provide DHCP and DNS services for clients
Enables IP forwarding
Adds nftables firewall rules to masquerade traffic from the wifi device and configures IP
forwarding
Prerequisites
Procedure
1. List the wifi devices to identify the one that should provide the access point:
To use a wifi device as an access point, the device must support this feature.
NetworkManager uses the dnsmasq service to provide DHCP and DNS services to clients of
the access point.
This command creates a connection profile for an access point on the wlp0s20f3 device that
provides WPA2 and WPA3 Personal authentication. The name of the wireless network, the
Service Set Identifier (SSID), is Example-Hotspot and uses the pre-shared key password.
199
Red Hat Enterprise Linux 9 Configuring and managing networking
6. By default, NetworkManager uses the IP address 10.42.0.1 for the wifi device and assigns IP
addresses from the remaining 10.42.0.0/24 subnet to clients. To configure a different subnet
and IP address, enter:
The IP address you set, in this case 192.0.2.254, is the one that NetworkManager assigns to the
wifi device. Clients will use this IP address as default gateway and DNS server.
Verification
1. On the server:
a. Verify that NetworkManager started the dnsmasq service and that the service listens on
port 67 (DHCP) and 53 (DNS):
b. Display the nftables rule set to ensure that NetworkManager enabled forwarding and
masquerading for traffic from the 10.42.0.0/24 subnet:
chain filter_forward {
type filter hook forward priority filter; policy accept;
ip daddr 10.42.0.0/24 oifname "wlp0s20f3" ct state { established, related } accept
ip saddr 10.42.0.0/24 iifname "wlp0s20f3" accept
iifname "wlp0s20f3" oifname "wlp0s20f3" accept
iifname "wlp0s20f3" reject
oifname "wlp0s20f3" reject
}
}
200
CHAPTER 12. CONFIGURING RHEL AS A WPA2 OR WPA3 PERSONAL ACCESS POINT
c. Ping a host on the remote network or the internet to verify that the connection works:
# ping -c 3 www.redhat.com
Additional resources
201
Red Hat Enterprise Linux 9 Configuring and managing networking
Media Access Control security (MACsec) is a layer 2 protocol that secures different traffic types over
the Ethernet links including:
MACsec encrypts and authenticates all traffic in LANs, by default with the GCM-AES-128 algorithm, and
uses a pre-shared key to establish the connection between the participant hosts. If you want to change
the pre-shared key, you need to update the NM configuration on all hosts in the network that uses
MACsec.
A MACsec connection uses an Ethernet device, such as an Ethernet network card, VLAN, or tunnel
device, as parent. You can either set an IP configuration only on the MACsec device to communicate
with other hosts only using the encrypted connection, or you can also set an IP configuration on the
parent device. In the latter case, you can use the parent device to communicate with other hosts using an
unencrypted connection and the MACsec device for encrypted connections.
MACsec does not require any special hardware. For example, you can use any switch, except if you want
to encrypt traffic only between a host and a switch. In this scenario, the switch must also support
MACsec.
IMPORTANT
You can use MACsec only between hosts that are in the same (physical or virtual) LAN.
Procedure
Create the connectivity association key (CAK) and connectivity-association key name
(CKN) for the pre-shared key:
202
CHAPTER 13. USING MACSEC TO ENCRYPT LAYER-2 TRAFFIC IN THE SAME PHYSICAL NETWORK
Use the CAK and CKN generated in the previous step in the macsec.mka-cak and
macsec.mka-ckn parameters. The values must be the same on every host in the MACsec-
protected network.
a. Configure the IPv4 settings. For example, to set a static IPv4 address, network mask,
default gateway, and DNS server to the macsec0 connection, enter:
b. Configure the IPv6 settings. For example, to set a static IPv6 address, network mask,
default gateway, and DNS server to the macsec0 connection, enter:
Verification
203
Red Hat Enterprise Linux 9 Configuring and managing networking
# ip macsec show
4. Display individual counters for each type of protection: integrity-only (encrypt off) and
encryption (encrypt on)
# ip -s macsec show
Using the MACsec security standard for securing communication at the link layer, also known as layer 2
of the Open Systems Interconnection (OSI) model provides the following notable benefits:
Encryption at layer 2 eliminates the need for encrypting individual services at layer 7. This
reduces the overhead associated with managing a large number of certificates for each
endpoint on each host.
Point-to-point security between directly connected network devices such as routers and
switches.
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server
configuration.
Procedure
1. On the first host on which you configure MACsec, create the connectivity association key (CAK)
and connectivity-association key name (CKN) for the pre-shared key:
2. On both hosts that you want to connect over a MACsec connection, complete the following
steps:
204
CHAPTER 13. USING MACSEC TO ENCRYPT LAYER-2 TRAFFIC IN THE SAME PHYSICAL NETWORK
---
routes:
config:
- destination: 0.0.0.0/0
next-hop-interface: macsec0
next-hop-address: 192.0.2.2
table-id: 254
- destination: 192.0.2.2/32
next-hop-interface: macsec0
next-hop-address: 0.0.0.0
table-id: 254
dns-resolver:
config:
search:
- example.com
server:
- 192.0.2.200
- 2001:db8:1::ffbb
interfaces:
- name: macsec0
type: macsec
state: up
ipv4:
enabled: true
address:
- ip: 192.0.2.1
prefix-length: 32
ipv6:
enabled: true
address:
- ip: 2001:db8:1::1
prefix-length: 64
macsec:
encrypt: true
base-iface: enp0s1
mka-cak: 50b71a8ef0bd5751ea76de6d6c98c03a
mka-ckn: f2b4297d39da7330910a74abc0449feb45b5c0b9fc23df1430e1898fcf1c4550
port: 0
validation: strict
send-sci: true
b. Use the CAK and CKN generated in the previous step in the mka-cak and mka-ckn
parameters. The values must be the same on every host in the MACsec-protected network.
c. Optional: In the same YAML configuration file, you can also configure the following settings:
205
Red Hat Enterprise Linux 9 Configuring and managing networking
Verification
# ip macsec show
5. Display individual counters for each type of protection: integrity-only (encrypt off) and
encryption (encrypt on)
# ip -s macsec show
Additional resources
206
CHAPTER 14. GETTING STARTED WITH IPVLAN
L2 mode
In IPVLAN L2 mode, virtual devices receive and respond to address resolution protocol (ARP)
requests. The netfilter framework runs only inside the container that owns the virtual device. No
netfilter chains are executed in the default namespace on the containerized traffic. Using L2
mode provides good performance, but less control on the network traffic.
L3 mode
In L3 mode, virtual devices process only L3 traffic and above. Virtual devices do not respond to
ARP request and users must configure the neighbour entries for the IPVLAN IP addresses on
the relevant peers manually. The egress traffic of a relevant container is landed on the netfilter
POSTROUTING and OUTPUT chains in the default namespace while the ingress traffic is
threaded in the same way as L2 mode. Using L3 mode provides good control but decreases the
network traffic performance.
L3S mode
In L3S mode, virtual devices process the same way as in L3 mode, except that both egress and
ingress traffics of a relevant container are landed on netfilter chain in the default namespace.
L3S mode behaves in a similar way to L3 mode but provides greater control of the network.
NOTE
The IPVLAN virtual device does not receive broadcast and multicast traffic in case of L3
and L3S modes.
MACVLAN IPVLAN
Uses MAC address for each MACVLAN device. Uses single MAC address which does not limit the
number of IPVLAN devices.
Note that, if a switch reaches the maximum number
of MAC addresses it can store in its MAC table,
connectivity can be lost.
Netfilter rules for a global namespace cannot affect It is possible to control traffic to or from a IPVLAN
traffic to or from a MACVLAN device in a child device in L3 mode and L3S mode.
namespace.
207
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
Note that network interface controller (NIC) is a hardware component which connects a
computer to a network.
2. To assign an IPv4 or IPv6 address to the interface, enter the following command:
3. In case of configuring an IPVLAN device in L3 mode or L3S mode, make the following setups:
a. Configure the neighbor setup for the remote peer on the remote host:
where MAC_address is the MAC address of the real NIC on which an IPVLAN device is based
on.
208
CHAPTER 14. GETTING STARTED WITH IPVLAN
5. To check if the IPVLAN device is active, execute the following command on the remote host:
# ping IP_address
209
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
NOTE
If you set a DNS server in the loopback connection profile, this entry is always available in
the /etc/resolv.conf file. The DNS server entry remains independent of whether or not the
host roams between different networks.
210
CHAPTER 15. CONFIGURING NETWORKMANAGER TO IGNORE CERTAIN DEVICES
Verification
# ip address show lo
# cat /etc/resolv.conf
...
nameserver 192.0.2.0
...
Procedure
1. Optional: Display the list of devices to identify the device or MAC address you want to set as
unmanaged:
# ip link show
...
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP
mode DEFAULT group default qlen 1000
link/ether 52:54:00:74:79:56 brd ff:ff:ff:ff:ff:ff
...
[keyfile]
unmanaged-devices=interface-name:enp1s0
211
Red Hat Enterprise Linux 9 Configuring and managing networking
[keyfile]
unmanaged-devices=mac:52:54:00:74:79:56
[keyfile]
unmanaged-devices=type:ethernet
[keyfile]
unmanaged-devices=interface-name:enp1s0;interface-name:enp7s0
Verification
The unmanaged state next to the enp1s0 device indicates that NetworkManager does not
manage this device.
Troubleshooting
# NetworkManager --print-config
...
[keyfile]
unmanaged-devices=interface-name:enp1s0
...
If the output does not match the settings that you configured, ensure that no configuration file
with a higher priority overrides your settings. For details about how NetworkManager merges
multiple configuration files, see the NetworkManager.conf(5) man page.
Use this method, for example, for testing purposes. To permanently configure network devices as
unmanaged, see Permanently configuring a device as unmanaged in NetworkManager .
Procedure
212
CHAPTER 15. CONFIGURING NETWORKMANAGER TO IGNORE CERTAIN DEVICES
Procedure
1. Optional: Display the list of devices to identify the device you want to set as unmanaged:
Verification
The unmanaged state next to the enp1s0 device indicates that NetworkManager does not
manage this device.
Additional resources
213
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
Create a dummy interface named dummy0 with static IPv4 and IPv6 addresses:
NOTE
To configure a dummy interface without IPv4 and IPv6 addresses, set both the
ipv4.method and ipv6.method parameters to disabled. Otherwise, IP auto-
configuration fails, and NetworkManager deactivates the connection and
removes the device.
Verification
Additional resources
214
CHAPTER 17. USING NETWORKMANAGER TO DISABLE IPV6 FOR A SPECIFIC CONNECTION
NOTE
If disabling IPv6 using kernel tunables or kernel boot parameters, additional consideration
must be given to system configuration. For more information, see the How do I disable or
enable the IPv6 protocol in RHEL? article.
Prerequisites
Procedure
Verification
215
Red Hat Enterprise Linux 9 Configuring and managing networking
# cat /proc/sys/net/ipv6/conf/enp1s0/disable_ipv6
1
216
CHAPTER 18. CHANGING A HOSTNAME
Procedure
# reboot
a. Restart all services that only read the hostname when the service starts:
b. Active shell users must re-login for the changes to take effect.
Verification
Static hostname: Stored in the /etc/hostname file. Typically, services use this name as the
hostname.
Transient hostname: A fall-back value that is typically received from the network configuration.
217
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
This command sets the static, pretty, and transient hostname to the new value. To set only a
specific type, pass the --static, --pretty, or --transient option to the command.
3. The hostnamectl utility automatically restarts the systemd-hostnamed to activate the new
name. For the changes to take effect, reboot the host:
# reboot
a. Restart all services that only read the hostname when the service starts:
b. Active shell users must re-login for the changes to take effect.
Verification
Additional resources
hostnamectl(1)
systemd-hostnamed.service(8)
218
CHAPTER 19. CONFIGURING NETWORKMANAGER DHCP SETTINGS
Note that RHEL does not provide dhcpcd and, therefore, NetworkManager can not use this client.
Procedure
[main]
dhcp=dhclient
2. If you set the dhcp parameter to dhclient, install the dhcp-client package:
3. Restart NetworkManager:
Verification
Search in the /var/log/messages log file for an entry similar to the following:
This log entry confirms that NetworkManager uses dhclient as DHCP client.
Additional resources
A Dynamic Host Configuration Protocol (DHCP) client requests the dynamic IP address and
219
Red Hat Enterprise Linux 9 Configuring and managing networking
A Dynamic Host Configuration Protocol (DHCP) client requests the dynamic IP address and
corresponding configuration information from a DHCP server each time a client connects to the
network.
When you configured a connection to retrieve an IP address from a DHCP server, the NetworkManager
requests an IP address from a DHCP server. By default, the client waits 45 seconds for this request to be
completed. When a DHCP connection is started, a dhcp client requests an IP address from a DHCP
server.
Prerequisites
Procedure
1. Set the ipv4.dhcp-timeout and ipv6.dhcp-timeout properties. For example, to set both
options to 30 seconds, enter:
Alternatively, set the parameters to infinity to configure that NetworkManager does not stop
trying to request and renew an IP address until it is successful.
2. Optional: Configure the behavior if NetworkManager does not receive an IPv4 address before
the timeout:
If the IPv6 configuration is enabled and successful, NetworkManager activates the IPv6
connection and no longer tries to activate the IPv4 connection.
If the connection still cannot acquire a DHCP address, auto-activation fails. Note that
after 5 minutes, the auto-connection process starts again to acquire an IP address from
the DHCP server.
3. Optional: Configure the behavior if NetworkManager does not receive an IPv6 address before
the timeout:
Additional resources
220
CHAPTER 20. RUNNING DHCLIENT EXIT HOOKS USING NETWORKMANAGER A DISPATCHER SCRIPT
/etc/NetworkManager/dispatcher.d/: The general location for dispatcher scripts the root user
can edit.
For security reasons, the NetworkManager-dispatcher service executes scripts only if the following
conditions met:
2. The action, such as up, when the interface has been activated.
The Dispatcher scripts section in the NetworkManager(8) man page provides an overview of actions
and environment variables you can use in scripts.
The NetworkManager-dispatcher service runs one script at a time, but asynchronously from the main
NetworkManager process. Note that, if a script is queued, the service will always run it, even if a later
event makes it obsolete. However, the NetworkManager-dispatcher service runs scripts that are
symbolic links referring to files in /etc/NetworkManager/dispatcher.d/no-wait.d/ immediately, without
waiting for the termination of previous scripts, and in parallel.
Additional resources
Prerequisites
221
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
Procedure
#!/bin/bash
# Run dhclient.exit-hooks.d scripts
if [ -n "$DHCP4_DHCP_LEASE_TIME" ] ; then
if [ "$2" = "dhcp4-change" ] || [ "$2" = "up" ] ; then
if [ -d /etc/dhcp/dhclient-exit-hooks.d ] ; then
for f in /etc/dhcp/dhclient-exit-hooks.d/*.sh ; do
if [ -x "${f}" ]; then
. "${f}"
fi
done
fi
fi
fi
3. Set the permissions so that only the root user can execute it:
# restorecon /etc/NetworkManager/dispatcher.d/12-dhclient-down
Additional resources
222
CHAPTER 21. MANUALLY CONFIGURING THE /ETC/RESOLV.CONF FILE
NOTE
Procedure
[main]
dns=none
NOTE
Verification
# cat /etc/resolv.conf
If you successfully disabled DNS processing, NetworkManager did not override the manually
223
Red Hat Enterprise Linux 9 Configuring and managing networking
If you successfully disabled DNS processing, NetworkManager did not override the manually
configured settings.
Troubleshooting
Display the NetworkManager configuration to ensure that no other configuration file with a
higher priority overrode the setting:
# NetworkManager --print-config
...
dns=none
...
Additional resources
Prerequisites
The NetworkManager rc-manager configuration option is not set to file. To verify, use the
NetworkManager --print-config command.
Procedure
1. Create a file, such as /etc/resolv.conf.manually-configured, and add the DNS configuration for
your environment to it. Use the same parameters and syntax as in the original /etc/resolv.conf.
# rm /etc/resolv.conf
# ln -s /etc/resolv.conf.manually-configured /etc/resolv.conf
Additional resources
224
CHAPTER 22. CONFIGURING THE ORDER OF DNS SERVERS
If only one connection profile exists, NetworkManager uses the order of IPv4 and IPv6 DNS
server specified in that connection.
If multiple connection profiles are activated, NetworkManager orders DNS servers based on a
DNS priority value. If you set DNS priorities, the behavior of NetworkManager depends on the
value set in the dns parameter. You can set this parameter in the [main] section in the
/etc/NetworkManager/NetworkManager.conf file:
dns=dnsmasq or dns=systemd-resolved:
When you use one of these settings, NetworkManager sets either 127.0.0.1 for dnsmasq or
127.0.0.53 as nameserver entry in the /etc/resolv.conf file.
Both the dnsmasq and systemd-resolved services forward queries for the search domain
set in a NetworkManager connection to the DNS server specified in that connection, and
forwardes queries to other domains to the connection with the default route. When multiple
connections have the same search domain set, dnsmasq and systemd-resolved forward
queries for this domain to the DNS server set in the connection with the lowest priority
value.
Negative values have the special effect of excluding other configurations with a greater value.
For example, if at least one connection with a negative priority value exists, NetworkManager
uses only the DNS servers specified in the connection profile with the lowest priority.
225
Red Hat Enterprise Linux 9 Configuring and managing networking
If multiple connections have the same DNS priority, NetworkManager prioritizes the DNS in the
following order:
a. VPN connections
b. Connection with an active default route. The active default route is the default route with
the lowest metric.
Additional resources
You can override these system-wide defaults with a custom default value for IPv4 and IPv6
connections.
Procedure
[connection]
b. Add the custom default values to the [connection] section. For example, to set the new
default for both IPv4 and IPv6 to 200, add:
ipv4.dns-priority=200
ipv6.dns-priority=200
You can set the parameters to a value between -2147483647 and 2147483647. Note that
setting the parameters to 0 enables the built-in defaults ( 50 for VPN connections and 100
for other connections).
Additional resources
Note that setting DNS priorities makes only sense if you have multiple connections with different DNS
servers configured. If you have only one connection with multiple DNS servers configured, manually set
the DNS servers in the preferred order in the connection profile.
Prerequisites
Procedure
2. Set the ipv4.dns-priority and ipv6.dns-priority parameters. For example, to set both
parameters to 10, enter:
Verification
Display the contents of the /etc/resolv.conf file to verify that the DNS server order is correct:
# cat /etc/resolv.conf
227
Red Hat Enterprise Linux 9 Configuring and managing networking
For example, you connect a server to a Virtual Private Network (VPN), and hosts in the VPN use the
example.com domain. In this case, you can configure RHEL to process DNS queries in the following
way:
Send only DNS requests for example.com to the DNS server in the VPN network.
Send all other requests to the DNS server that is configured in the connection profile with the
default gateway.
With this configuration, NetworkManager adds the nameserver 127.0.0.1 entry to the /etc/resolv.conf
file, and dnsmasq dynamically routes DNS requests to the corresponding DNS servers specified in the
NetworkManager connection profiles.
Prerequisites
A DNS server and search domain are configured in the NetworkManager connection profile that
is responsible for resolving a specific domain.
For example, to ensure that the DNS server specified in a VPN connection resolves queries for
the example.com domain, the VPN connection profile must contain the following settings:
The dnsmasq service is not running or configured to listen on a different interface then
localhost.
Procedure
2. Edit the /etc/NetworkManager/NetworkManager.conf file, and set the following entry in the
[main] section:
228
CHAPTER 23. USING DIFFERENT DNS SERVERS FOR DIFFERENT DOMAINS
dns=dnsmasq
Verification
1. Search in the systemd journal of the NetworkManager unit for which domains the service uses
a different DNS server:
2. Use the tcpdump packet sniffer to verify the correct route of DNS requests:
c. On a different terminal, resolve host names for a domain for which an exception exists and
another domain, for example:
# host -t A www.example.com
# host -t A www.redhat.com
d. Verify in the tcpdump output that Red Hat Enterprise Linux sends only DNS queries for the
example.com domain to the designated DNS server and through the corresponding
interface:
...
13:52:42.234533 tun0 Out IP server.43534 > 198.51.100.7.domain: 50121+ A?
www.example.com. (33)
...
13:52:57.753235 enp1s0 Out IP server.40864 > 192.0.2.1.domain: 6906+ A?
www.redhat.com. (33)
...
Red Hat Enterprise Linux sends the DNS query for www.example.com to the DNS server
on 198.51.100.7 and the query for www.redhat.com to 192.0.2.1.
Troubleshooting
1. Verify that the nameserver entry in the /etc/resolv.conf file refers to 127.0.0.1:
229
Red Hat Enterprise Linux 9 Configuring and managing networking
# cat /etc/resolv.conf
nameserver 127.0.0.1
2. Verify that the dnsmasq service listens on port 53 on the loopback device:
If the service does not listen on 127.0.0.1:53, check the journal entries of the NetworkManager
unit:
# journalctl -u NetworkManager
With this configuration, NetworkManager adds the nameserver 127.0.0.53 entry to the
/etc/resolv.conf file, and systemd-resolved dynamically routes DNS requests to the corresponding
DNS servers specified in the NetworkManager connection profiles.
IMPORTANT
See Technology Preview Features Support Scope on the Red Hat Customer Portal for
information about the support scope for Technology Preview features.
For a supported solution, see Using dnsmasq in NetworkManager to send DNS requests
for a specific domain to a selected DNS server.
Prerequisites
A DNS server and search domain are configured in the NetworkManager connection profile that
is responsible for resolving a specific domain.
For example, to ensure that the DNS server specified in a VPN connection resolves queries for
the example.com domain, the VPN connection profile must contain the following settings:
230
CHAPTER 23. USING DIFFERENT DNS SERVERS FOR DIFFERENT DOMAINS
Procedure
2. Edit the /etc/NetworkManager/NetworkManager.conf file, and set the following entry in the
[main] section:
dns=systemd-resolved
Verification
1. Display the DNS servers systemd-resolved uses and for which domains the service uses a
different DNS server:
# resolvectl
...
Link 2 (enp1s0)
Current Scopes: DNS
Protocols: +DefaultRoute ...
Current DNS Server: 192.0.2.1
DNS Servers: 192.0.2.1
Link 3 (tun0)
Current Scopes: DNS
Protocols: -DefaultRoute ...
Current DNS Server: 198.51.100.7
DNS Servers: 198.51.100.7 203.0.113.19
DNS Domain: example.com
The output confirms that systemd-resolved uses different DNS servers for the example.com
domain.
2. Use the tcpdump packet sniffer to verify the correct route of DNS requests:
c. On a different terminal, resolve host names for a domain for which an exception exists and
231
Red Hat Enterprise Linux 9 Configuring and managing networking
c. On a different terminal, resolve host names for a domain for which an exception exists and
another domain, for example:
# host -t A www.example.com
# host -t A www.redhat.com
d. Verify in the tcpdump output that Red Hat Enterprise Linux sends only DNS queries for the
example.com domain to the designated DNS server and through the corresponding
interface:
...
13:52:42.234533 tun0 Out IP server.43534 > 198.51.100.7.domain: 50121+ A?
www.example.com. (33)
...
13:52:57.753235 enp1s0 Out IP server.40864 > 192.0.2.1.domain: 6906+ A?
www.redhat.com. (33)
...
Red Hat Enterprise Linux sends the DNS query for www.example.com to the DNS server
on 198.51.100.7 and the query for www.redhat.com to 192.0.2.1.
Troubleshooting
1. Verify that the nameserver entry in the /etc/resolv.conf file refers to 127.0.0.53:
# cat /etc/resolv.conf
nameserver 127.0.0.53
2. Verify that the systemd-resolved service listens on port 53 on the local IP address 127.0.0.53:
If the service does not listen on 127.0.0.53:53, check if the systemd-resolved service is running.
232
CHAPTER 24. MANAGING THE DEFAULT GATEWAY SETTING
Prerequisites
At least one static IP address must be configured on the connection on which the default
gateway will be set.
If the user is logged in on a physical console, user permissions are sufficient. Otherwise, user
must have root permissions.
Procedure
WARNING
Verification
233
Red Hat Enterprise Linux 9 Configuring and managing networking
# ip -4 route
default via 192.0.2.1 dev example proto static metric 100
# ip -6 route
default via 2001:db8:1::1 dev example proto static metric 100 pref medium
Prerequisites
At least one static IP address must be configured on the connection on which the default
gateway will be set.
If the user is logged in on a physical console, user permissions are sufficient. Otherwise, the user
must have root permissions.
Procedure
nmcli> print
...
ipv4.gateway: <IPv4_gateway_address>
...
ipv6.gateway: <IPv6_gateway_address>
...
234
CHAPTER 24. MANAGING THE DEFAULT GATEWAY SETTING
WARNING
nmcli> quit
Verification
# ip -4 route
default via 192.0.2.1 dev example proto static metric 100
# ip -6 route
default via 2001:db8:1::1 dev example proto static metric 100 pref medium
Prerequisites
At least one static IP address must be configured on the connection on which the default
gateway will be set.
Procedure
# nm-connection-editor
2. Select the connection to modify, and click the gear wheel icon to edit the existing connection.
3. Set the IPv4 default gateway. For example, to set the IPv4 address of the default gateway on
235
Red Hat Enterprise Linux 9 Configuring and managing networking
3. Set the IPv4 default gateway. For example, to set the IPv4 address of the default gateway on
the connection to 192.0.2.1:
b. Enter the address in the gateway field next to the IP range the gateway’s address is within:
4. Set the IPv6 default gateway. For example, to set the IPv6 address of the default gateway on
the connection to 2001:db8:1::1:
b. Enter the address in the gateway field next to the IP range the gateway’s address is within:
5. Click OK.
6. Click Save.
7. Restart the network connection for changes to take effect. For example, to restart the example
connection using the command line:
WARNING
# ip -4 route
default via 192.0.2.1 dev example proto static metric 100
# ip -6 route
default via 2001:db8:1::1 dev example proto static metric 100 pref medium
Additional resources
236
CHAPTER 24. MANAGING THE DEFAULT GATEWAY SETTING
Additional resources
Prerequisites
At least one static IP address must be configured on the connection on which the default
gateway will be set.
Procedure
1. Set the IPv4 default gateway. For example, to set the IPv4 address of the default gateway on
the connection to 192.0.2.1:
b. Enter the address in the gateway field next to the IP range the gateway’s address is within:
2. Set the IPv6 default gateway. For example, to set the IPv6 address of the default gateway on
the connection to 2001:db8:1::1:
b. Enter the address in the gateway field next to the IP range the gateway’s address is within:
3. Click Apply.
4. Back in the Network window, disable and re-enable the connection by switching the button for
the connection to Off and back to On for changes to take effect.
237
Red Hat Enterprise Linux 9 Configuring and managing networking
WARNING
$ ip -4 route
default via 192.0.2.1 dev example proto static metric 100
$ ip -6 route
default via 2001:db8:1::1 dev example proto static metric 100 pref medium
Additional resources
Use the nmstatectl utility to set the default gateway through the Nmstate API. The Nmstate API
ensures that, after setting the configuration, the result matches the configuration file. If anything fails,
nmstatectl automatically rolls back the changes to avoid leaving the system in an incorrect state.
Prerequisites
At least one static IP address must be configured on the connection on which the default
gateway will be set.
The enp1s0 interface is configured, and the IP address of the default gateway is within the
subnet of the IP configuration of this interface.
Procedure
1. Create a YAML file, for example ~/set-default-gateway.yml, with the following content:
---
routes:
config:
238
CHAPTER 24. MANAGING THE DEFAULT GATEWAY SETTING
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.1
next-hop-interface: enp1s0
These settings define 192.0.2.1 as the default gateway, and the default gateway is reachable
through the enp1s0 interface.
Additional resources
/usr/share/doc/nmstate/examples/ directory
IMPORTANT
When you run a play that uses the network RHEL system role and if the setting values do
not match the values specified in the play, the role overrides the existing connection
profile with the same name. To prevent resetting these values to their defaults, always
specify the whole configuration of the network connection profile in the play, even if the
configuration, for example the IP configuration, already exists.
Depending on whether it already exists, the procedure creates or updates the enp1s0 connection profile
with the following settings:
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
239
Red Hat Enterprise Linux 9 Configuring and managing networking
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with static IP and default gateway
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: enp1s0
type: ethernet
autoconnect: yes
ip:
address:
- 198.51.100.20/24
- 2001:db8:1::1/64
gateway4: 198.51.100.254
gateway6: 2001:db8:1::fffe
dns:
- 198.51.100.200
- 2001:db8:1::ffbb
dns_search:
- example.com
state: up
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
240
CHAPTER 24. MANAGING THE DEFAULT GATEWAY SETTING
You can set the metric for both the IPv4 and IPv6 gateway of a connection using the following
command:
IMPORTANT
Do not set the same metric value for the same protocol in multiple connection profiles to
avoid routing issues.
If you set a default gateway without a metric value, NetworkManager automatically sets the metric value
based on the interface type. For that, NetworkManager assigns the default value of this network type to
the first connection that is activated, and sets an incremented value to each other connection of the
same type in the order they are activated. For example, if two Ethernet connections with a default
gateway exist, NetworkManager sets a metric of 100 on the route to the default gateway of the
connection that you activate first. For the second connection, NetworkManager sets 101.
The following is an overview of frequently-used network types and their default metrics:
VPN 50
Ethernet 100
MACsec 125
InfiniBand 150
Bond 300
Team 350
VLAN 400
Bridge 425
TUN 450
Wi-Fi 600
IP tunnel 675
Additional resources
241
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
The NetworkManager connection profile for the connection that is not connected to the default
gateway exists.
Procedure
1. If the connection uses a dynamic IP configuration, configure that NetworkManager does not
use the connection as the default route for IPv4 and IPv6 connections:
Note that setting ipv4.never-default and ipv6.never-default to yes, automatically removes the
default gateway’s IP address for the corresponding protocol from the connection profile.
Verification
Use the ip -4 route and ip -6 route commands to verify that RHEL does not use the network
interface for the default route for the IPv4 and IPv6 protocol.
NOTE
Prerequisites
The host uses NetworkManager to manage network connections, which is the default.
Procedure
242
CHAPTER 24. MANAGING THE DEFAULT GATEWAY SETTING
# ip -4 route
default via 192.0.2.1 dev enp1s0 proto static metric 101
default via 198.51.100.1 dev enp7s0 proto static metric 102
...
# ip -6 route
default via 2001:db8:1::1 dev enp1s0 proto static metric 101 pref medium
default via 2001:db8:2::1 dev enp7s0 proto static metric 102 pref medium
...
Entries starting with default indicate a default route. Note the interface names of these entries
displayed next to dev.
2. Use the following commands to display the NetworkManager connections that use the
interfaces you identified in the previous step:
In these examples, the profiles named Corporate-LAN and Internet-Provider have the default
gateways set. Because, in a local network, the default gateway is typically the host that is one
hop closer to the internet, the rest of this procedure assumes that the default gateways in the
Corporate-LAN are incorrect.
3. Configure that NetworkManager does not use the Corporate-LAN connection as the default
route for IPv4 and IPv6 connections:
Note that setting ipv4.never-default and ipv6.never-default to yes, automatically removes the
default gateway’s IP address for the corresponding protocol from the connection profile.
Verification
Display the IPv4 and IPv6 routing tables and verify that only one default gateway is available for
each protocol:
243
Red Hat Enterprise Linux 9 Configuring and managing networking
# ip -4 route
default via 192.0.2.1 dev enp1s0 proto static metric 101
...
# ip -6 route
default via 2001:db8:1::1 dev enp1s0 proto static metric 101 pref medium
...
Additional resources
244
CHAPTER 25. CONFIGURING A STATIC ROUTE
You need static routes to achieve a functioning communication among multiple networks if all of these
conditions apply:
The exclusive traffic flow through the default gateways is not sufficient.
The Example of a network that requires static routes section describes scenarios and how the traffic
flows between different networks when you do not configure static routes.
NOTE
The network topology in this example is artificial and only used to explain the concept of
static routing. It is not a recommended topology in production environments.
For a functioning communication among all networks in this example, configure a static route to Raleigh
(198.51.100.0/24) with next the hop Router 2 ( 203.0.113.10). The IP address of the next hop is the one
of Router 2 in the data center network (203.0.113.0/24).
For a simplified configuration, set this static route only on Router 1. However, this increases the
traffic on Router 1 because hosts from the data center (203.0.113.0/24) send traffic to Raleigh
(198.51.100.0/24) always through Router 1 to Router 2.
For a more complex configuration, configure this static route on all hosts in the data center
(203.0.113.0/24). All hosts in this subnet then send traffic directly to Router 2 ( 203.0.113.10)
that is closer to Raleigh (198.51.100.0/24).
For more details between which networks traffic flows or not, see the explanations below the diagram.
245
Red Hat Enterprise Linux 9 Configuring and managing networking
In case that the required static routes are not configured, the following are the situations in which the
communication works and when it does not:
Can communicate with other hosts in the same subnet because they are directly connected.
Can communicate with the internet because Router 1 is in the Berlin network (192.0.2.0/24)
and has a default gateway, which leads to the internet.
Can communicate with the data center network (203.0.113.0/24) because Router 1 has
interfaces in both the Berlin (192.0.2.0/24) and the data center (203.0.113.0/24) networks.
Cannot communicate with the Raleigh network (198.51.100.0/24) because Router 1 has no
interface in this network. Therefore, Router 1 sends the traffic to its own default gateway
(internet).
Can communicate with other hosts in the same subnet because they are directly connected.
Can communicate with the internet because they have their default gateway set to Router 1,
and Router 1 has interfaces in both networks, the data center (203.0.113.0/24) and to the
internet.
Can communicate with the Berlin network (192.0.2.0/24) because they have their default
246
CHAPTER 25. CONFIGURING A STATIC ROUTE
Can communicate with the Berlin network (192.0.2.0/24) because they have their default
gateway set to Router 1, and Router 1 has interfaces in both the data center (203.0.113.0/24)
and the Berlin (192.0.2.0/24) networks.
Cannot communicate with the Raleigh network (198.51.100.0/24) because the data center
network has no interface in this network. Therefore, hosts in the data center
(203.0.113.0/24) send traffic to their default gateway (Router 1). Router 1 also has no
interface in the Raleigh network (198.51.100.0/24) and, as a result, Router 1 sends this traffic
to its own default gateway (internet).
Can communicate with other hosts in the same subnet because they are directly connected.
Cannot communicate with hosts on the internet. Router 2 sends the traffic to Router 1
because of the default gateway settings. The actual behavior of Router 1 depends on the
reverse path filter (rp_filter) system control (sysctl) setting. By default on RHEL, Router 1
drops the outgoing traffic instead of routing it to the internet. However, regardless of the
configured behavior, communication is not possible without the static route.
Cannot communicate with the data center network (203.0.113.0/24). The outgoing traffic
reaches the destination through Router 2 because of the default gateway setting. However,
replies to packets do not reach the sender because hosts in the data center network
(203.0.113.0/24) send replies to their default gateway (Router 1). Router 1 then sends the
traffic to the internet.
Cannot communicate with the Berlin network (192.0.2.0/24). Router 2 sends the traffic to
Router 1 because of the default gateway settings. The actual behavior of Router 1 depends
on the rp_filter sysctl setting. By default on RHEL, Router 1 drops the outgoing traffic
instead of sending it to the Berlin network (192.0.2.0/24). However, regardless of the
configured behavior, communication is not possible without the static route.
NOTE
In addition to configuring the static routes, you must enable IP forwarding on both
routers.
Additional resources
Enabling IP forwarding
cwnd=n: Sets the congestion window (CWND) size, defined in number of packets.
247
Red Hat Enterprise Linux 9 Configuring and managing networking
lock-cwnd=true|false: Defines whether or not the kernel can update the CWND value.
lock-mtu=true|false: Defines whether or not the kernel can update the MTU to path MTU
discovery.
lock-window=true|false: Defines whether or not the kernel can update the maximum window
size for TCP packets.
mtu=<mtu_value>: Sets the maximum transfer unit (MTU) to use along the path to the
destination.
onlink=true|false: Defines whether the next hop is directly attached to this link even if it does
not match any interface prefix.
scope=<scope>: For an IPv4 route, this attribute sets the scope of the destinations covered by
the route prefix. Set the value as an integer (0-255).
src=<source_address>: Sets the source address to prefer when sending traffic to the
destinations covered by the route prefix.
table=<table_id>: Sets the ID of the table the route should be added to. If you omit this
parameter, NetworkManager uses the main table.
tos=<type_of_service_key>: Sets the type of service (TOS) key. Set the value as an integer
(0-255).
type=<route_type>: Sets the route type. NetworkManager supports the unicast, local,
blackhole, unreachable, prohibit, and throw route types. The default is unicast.
window=<window_size>: Sets the maximal window size for TCP to advertise to these
destinations, measured in bytes.
IMPORTANT
If you use the ipv4.routes option without a preceding + sign, nmcli overrides all current
settings of this parameter.
An IPv4 route to the remote 198.51.100.0/24 network. The corresponding gateway with the IP
address 192.0.2.10 is reachable through the LAN connection profile.
248
CHAPTER 25. CONFIGURING A STATIC ROUTE
An IPv6 route to the remote 2001:db8:2::/64 network. The corresponding gateway with the IP
address 2001:db8:1::10 is reachable through the LAN connection profile.
Prerequisites
The LAN connection profile exists and it configures this host to be in the same IP subnet as the
gateways.
Procedure
To set multiple routes in one step, pass the individual routes comma-separated to the
command:
Verification
# ip -4 route
...
198.51.100.0/24 via 192.0.2.10 dev enp1s0
# ip -6 route
...
2001:db8:2::/64 via 2001:db8:1::10 dev enp1s0 metric 1024 pref medium
For example, the procedure below adds a route to the 192.0.2.0/24 network that uses the gateway
running on 198.51.100.1, which is reachable through an existing connection profile.
NOTE
249
Red Hat Enterprise Linux 9 Configuring and managing networking
NOTE
In nmtui:
Prerequisites
The gateway for the static route must be directly reachable on the interface.
If the user is logged in on a physical console, user permissions are sufficient. Otherwise, the
command requires root permissions.
Procedure
1. Start nmtui:
# nmtui
3. Select the connection profile through which you can reach the next hop to the destination
network, and press Enter.
4. Depending on whether it is an IPv4 or IPv6 route, press the Show button next to the protocol’s
configuration area.
5. Press the Edit button next to Routing. This opens a new window where you configure static
routes:
The destination network, including the prefix in Classless Inter-Domain Routing (CIDR)
format
A metric value, if you add multiple routes to the same network and want to prioritize the
routes by efficiency
b. Repeat the previous step for every route you want to add and that is reachable through this
connection profile.
c. Press the OK button to return to the window with the connection settings.
8. Select the connection profile that you edited, and press Enter twice to deactivate and activate
it again.
IMPORTANT
Skip this step if you run nmtui over a remote connection, such as SSH, that uses
the connection profile you want to reactivate. In this case, if you would deactivate
it in nmtui, the connection is terminated and, consequently, you cannot activate
it again. To avoid this problem, use the nmcli connection <connection_profile>
up command to reactivate the connection in the mentioned scenario.
10. Select Quit, and press Enter to close the nmtui application.
Verification
$ ip route
...
192.0.2.0/24 via 198.51.100.1 dev example proto static metric 100
An IPv4 route to the remote 198.51.100.0/24 network. The corresponding gateway has the IP
address 192.0.2.10.
An IPv6 route to the remote 2001:db8:2::/64 network. The corresponding gateway has the IP
address 2001:db8:1::10.
Prerequisites
251
Red Hat Enterprise Linux 9 Configuring and managing networking
The network configuration of the connection is opened in the control-center application. See
Configuring an Ethernet connection by using nm-connection-editor .
Procedure
a. Optional: Disable automatic routes by clicking the On button in the Routes section of the
IPv4 tab to use only static routes. If automatic routes are enabled, Red Hat Enterprise Linux
uses static routes and routes received from a DHCP server.
b. Enter the address, netmask, gateway, and optionally a metric value of the IPv4 route:
a. Optional: Disable automatic routes by clicking the On button i the Routes section of the
IPv4 tab to use only static routes.
b. Enter the address, netmask, gateway, and optionally a metric value of the IPv6 route:
3. Click Apply.
4. Back in the Network window, disable and re-enable the connection by switching the button for
the connection to Off and back to On for changes to take effect.
WARNING
Verification
# ip -4 route
...
198.51.100.0/24 via 192.0.2.10 dev enp1s0
252
CHAPTER 25. CONFIGURING A STATIC ROUTE
# ip -6 route
...
2001:db8:2::/64 via 2001:db8:1::10 dev enp1s0 metric 1024 pref medium
An IPv4 route to the remote 198.51.100.0/24 network. The corresponding gateway with the IP
address 192.0.2.10 is reachable through the example connection.
An IPv6 route to the remote 2001:db8:2::/64 network. The corresponding gateway with the IP
address 2001:db8:1::10 is reachable through the example connection.
Prerequisites
Procedure
$ nm-connection-editor
2. Select the example connection profile, and click the gear wheel icon to edit the existing
connection.
b. Click the Add button and enter the address, netmask, gateway, and optionally a metric
value.
c. Click OK.
b. Click the Add button and enter the address, netmask, gateway, and optionally a metric
253
Red Hat Enterprise Linux 9 Configuring and managing networking
b. Click the Add button and enter the address, netmask, gateway, and optionally a metric
value.
c. Click OK.
5. Click Save.
6. Restart the network connection for changes to take effect. For example, to restart the example
connection using the command line:
Verification
# ip -4 route
...
198.51.100.0/24 via 192.0.2.10 dev enp1s0
# ip -6 route
...
2001:db8:2::/64 via 2001:db8:1::10 dev enp1s0 metric 1024 pref medium
An IPv4 route to the remote 198.51.100.0/24 network. The corresponding gateway with the IP
address 192.0.2.10 is reachable through the example connection.
An IPv6 route to the remote 2001:db8:2::/64 network. The corresponding gateway with the IP
address 2001:db8:1::10 is reachable through the example connection.
Prerequisites
The example connection profile exists and it configures this host to be in the same IP subnet as
the gateways.
254
CHAPTER 25. CONFIGURING A STATIC ROUTE
Procedure
4. Optionally, verify that the routes were added correctly to the configuration:
nmcli> print
...
ipv4.routes: { ip = 198.51.100.0/24, nh = 192.0.2.10 }
...
ipv6.routes: { ip = 2001:db8:2::/64, nh = 2001:db8:1::10 }
...
The ip attribute displays the network to route and the nh attribute the gateway (next hop).
nmcli> quit
Verification
# ip -4 route
...
198.51.100.0/24 via 192.0.2.10 dev enp1s0
# ip -6 route
...
2001:db8:2::/64 via 2001:db8:1::10 dev enp1s0 metric 1024 pref medium
Additional resources
255
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
Prerequisites
The enp1s0 network interface is configured and is in the same IP subnet as the gateways.
Procedure
1. Create a YAML file, for example ~/add-static-route-to-enp1s0.yml, with the following content:
---
routes:
config:
- destination: 198.51.100.0/24
next-hop-address: 192.0.2.10
next-hop-interface: enp1s0
- destination: 2001:db8:2::/64
next-hop-address: 2001:db8:1::10
next-hop-interface: enp1s0
An IPv4 route to the remote 198.51.100.0/24 network. The corresponding gateway with the
IP address 192.0.2.10 is reachable through the enp1s0 interface.
An IPv6 route to the remote 2001:db8:2::/64 network. The corresponding gateway with the
IP address 2001:db8:1::10 is reachable through the enp1s0 interface.
Verification
# ip -4 route
...
198.51.100.0/24 via 192.0.2.10 dev enp1s0
256
CHAPTER 25. CONFIGURING A STATIC ROUTE
# ip -6 route
...
2001:db8:2::/64 via 2001:db8:1::10 dev enp1s0 metric 1024 pref medium
Additional resources
/usr/share/doc/nmstate/examples/ directory
IMPORTANT
When you run a play that uses the network RHEL system role and if the setting values do
not match the values specified in the play, the role overrides the existing connection
profile with the same name. To prevent resetting these values to their defaults, always
specify the whole configuration of the network connection profile in the play, even if the
configuration, for example the IP configuration, already exists.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with static IP and additional routes
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: enp7s0
type: ethernet
autoconnect: yes
ip:
address:
- 192.0.2.1/24
- 2001:db8:1::1/64
gateway4: 192.0.2.254
gateway6: 2001:db8:1::fffe
257
Red Hat Enterprise Linux 9 Configuring and managing networking
dns:
- 192.0.2.200
- 2001:db8:1::ffbb
dns_search:
- example.com
route:
- network: 198.51.100.0
prefix: 24
gateway: 192.0.2.10
- network: 2001:db8:2::
prefix: 64
gateway: 2001:db8:1::10
state: up
Depending on whether it already exists, the procedure creates or updates the enp7s0
connection profile with the following settings:
Static routes:
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Verification
258
CHAPTER 25. CONFIGURING A STATIC ROUTE
# ip -4 route
...
198.51.100.0/24 via 192.0.2.10 dev enp7s0
# ip -6 route
...
2001:db8:2::/64 via 2001:db8:1::10 dev enp7s0 metric 1024 pref medium
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
259
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
The system uses NetworkManager to configure the network, which is the default.
The RHEL router you want to set up in the procedure has four network interfaces:
The enp7s0 interface is connected to the network of provider A. The gateway IP in the
provider’s network is 198.51.100.2, and the network uses a /30 network mask.
The enp1s0 interface is connected to the network of provider B. The gateway IP in the
provider’s network is 192.0.2.2, and the network uses a /30 network mask.
The enp8s0 interface is connected to the 10.0.0.0/24 subnet with internal workstations.
The enp9s0 interface is connected to the 203.0.113.0/24 subnet with the company’s
servers.
Hosts in the internal workstations subnet use 10.0.0.1 as the default gateway. In the procedure,
260
CHAPTER 26. CONFIGURING POLICY-BASED ROUTING TO DEFINE ALTERNATIVE ROUTES
Hosts in the internal workstations subnet use 10.0.0.1 as the default gateway. In the procedure,
you assign this IP address to the enp8s0 network interface of the router.
Hosts in the server subnet use 203.0.113.1 as the default gateway. In the procedure, you assign
this IP address to the enp9s0 network interface of the router.
Procedure
The nmcli connection add command creates a NetworkManager connection profile. The
command uses the following options:
con-name <connection_name>: Sets the name of the profile. Use a meaningful name to
avoid confusion.
This command uses the ipv4.routes parameter instead of ipv4.gateway to set the default
gateway. This is required to assign the default gateway for this connection to a different routing
table (5000) than the default. NetworkManager automatically creates this new routing table
when the connection is activated.
This command uses the ipv4.routes parameter to add a static route to the routing table with ID
261
Red Hat Enterprise Linux 9 Configuring and managing networking
This command uses the ipv4.routes parameter to add a static route to the routing table with ID
5000. This static route for the 10.0.0.0/24 subnet uses the IP of the local network interface to
provider B (192.0.2.1) as next hop.
Additionally, the command uses the ipv4.routing-rules parameter to add a routing rule with
priority 5 that routes traffic from the 10.0.0.0/24 subnet to table 5000. Low values have a high
priority.
Note that the syntax in the ipv4.routing-rules parameter is the same as in an ip rule add
command, except that ipv4.routing-rules always requires specifying a priority.
# nmcli connection add type ethernet con-name Servers ifname enp9s0 ipv4.method
manual ipv4.addresses 203.0.113.1/24 connection.zone trusted
Verification
b. Use the traceroute utility to display the route to a host on the internet:
# traceroute redhat.com
traceroute to redhat.com (209.132.183.105), 30 hops max, 60 byte packets
1 10.0.0.1 (10.0.0.1) 0.337 ms 0.260 ms 0.223 ms
2 192.0.2.1 (192.0.2.1) 0.884 ms 1.066 ms 1.248 ms
...
The output of the command displays that the router sends packets over 192.0.2.1, which is
the network of provider B.
b. Use the traceroute utility to display the route to a host on the internet:
# traceroute redhat.com
traceroute to redhat.com (209.132.183.105), 30 hops max, 60 byte packets
1 203.0.113.1 (203.0.113.1) 2.179 ms 2.073 ms 1.944 ms
2 198.51.100.2 (198.51.100.2) 1.868 ms 1.798 ms 1.549 ms
...
The output of the command displays that the router sends packets over 198.51.100.2, which
is the network of provider A.
Troubleshooting steps
On the RHEL router:
262
CHAPTER 26. CONFIGURING POLICY-BASED ROUTING TO DEFINE ALTERNATIVE ROUTES
# ip rule list
0: from all lookup local
5: from 10.0.0.0/24 lookup 5000
32766: from all lookup main
32767: from all lookup default
By default, RHEL contains rules for the tables local, main, and default.
# firewall-cmd --get-active-zones
external
interfaces: enp1s0 enp7s0
trusted
interfaces: enp8s0 enp9s0
# firewall-cmd --info-zone=external
external (active)
target: default
icmp-block-inversion: no
interfaces: enp1s0 enp7s0
sources:
services: ssh
ports:
protocols:
masquerade: yes
...
Additional resources
To configure policy-based routing remotely and on multiple nodes, you can use the network
263
Red Hat Enterprise Linux 9 Configuring and managing networking
To configure policy-based routing remotely and on multiple nodes, you can use the network
RHEL system role.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
The managed nodes you want to configure has four network interfaces:
The enp7s0 interface is connected to the network of provider A. The gateway IP in the
provider’s network is 198.51.100.2, and the network uses a /30 network mask.
The enp1s0 interface is connected to the network of provider B. The gateway IP in the
provider’s network is 192.0.2.2, and the network uses a /30 network mask.
The enp8s0 interface is connected to the 10.0.0.0/24 subnet with internal workstations.
The enp9s0 interface is connected to the 203.0.113.0/24 subnet with the company’s
servers.
Hosts in the internal workstations subnet use 10.0.0.1 as the default gateway. In the procedure,
you assign this IP address to the enp8s0 network interface of the router.
Hosts in the server subnet use 203.0.113.1 as the default gateway. In the procedure, you assign
this IP address to the enp9s0 network interface of the router.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
264
CHAPTER 26. CONFIGURING POLICY-BASED ROUTING TO DEFINE ALTERNATIVE ROUTES
---
- name: Configuring policy-based routing
hosts: managed-node-01.example.com
tasks:
- name: Routing traffic from a specific subnet to a different default gateway
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: Provider-A
interface_name: enp7s0
type: ethernet
autoconnect: True
ip:
address:
- 198.51.100.1/30
gateway4: 198.51.100.2
dns:
- 198.51.100.200
state: up
zone: external
- name: Provider-B
interface_name: enp1s0
type: ethernet
autoconnect: True
ip:
address:
- 192.0.2.1/30
route:
- network: 0.0.0.0
prefix: 0
gateway: 192.0.2.2
table: 5000
state: up
zone: external
- name: Internal-Workstations
interface_name: enp8s0
type: ethernet
autoconnect: True
ip:
address:
- 10.0.0.1/24
route:
- network: 10.0.0.0
prefix: 24
table: 5000
routing_rule:
- priority: 5
from: 10.0.0.0/24
table: 5000
state: up
zone: trusted
- name: Servers
265
Red Hat Enterprise Linux 9 Configuring and managing networking
interface_name: enp9s0
type: ethernet
autoconnect: True
ip:
address:
- 203.0.113.1/24
state: up
zone: trusted
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Verification
b. Use the traceroute utility to display the route to a host on the internet:
# traceroute redhat.com
traceroute to redhat.com (209.132.183.105), 30 hops max, 60 byte packets
1 10.0.0.1 (10.0.0.1) 0.337 ms 0.260 ms 0.223 ms
2 192.0.2.1 (192.0.2.1) 0.884 ms 1.066 ms 1.248 ms
...
The output of the command displays that the router sends packets over 192.0.2.1, which is
the network of provider B.
b. Use the traceroute utility to display the route to a host on the internet:
# traceroute redhat.com
traceroute to redhat.com (209.132.183.105), 30 hops max, 60 byte packets
1 203.0.113.1 (203.0.113.1) 2.179 ms 2.073 ms 1.944 ms
2 198.51.100.2 (198.51.100.2) 1.868 ms 1.798 ms 1.549 ms
...
The output of the command displays that the router sends packets over 198.51.100.2, which
266
CHAPTER 26. CONFIGURING POLICY-BASED ROUTING TO DEFINE ALTERNATIVE ROUTES
The output of the command displays that the router sends packets over 198.51.100.2, which
is the network of provider A.
3. On the RHEL router that you configured using the RHEL system role:
# ip rule list
0: from all lookup local
5: from 10.0.0.0/24 lookup 5000
32766: from all lookup main
32767: from all lookup default
By default, RHEL contains rules for the tables local, main, and default.
# firewall-cmd --get-active-zones
external
interfaces: enp1s0 enp7s0
trusted
interfaces: enp8s0 enp9s0
# firewall-cmd --info-zone=external
external (active)
target: default
icmp-block-inversion: no
interfaces: enp1s0 enp7s0
sources:
services: ssh
ports:
protocols:
masquerade: yes
...
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
267
Red Hat Enterprise Linux 9 Configuring and managing networking
One benefit of VRF over partitioning on layer 2 is that routing scales better considering the number of
peers involved.
Red Hat Enterprise Linux uses a virtual vrt device for each VRF domain and adds routes to a VRF
domain by adding existing network devices to a VRF device. Addresses and routes previously attached
to the original device will be moved inside the VRF domain.
IMPORTANT
To enable remote peers to contact both VRF interfaces while reusing the same IP
address, the network interfaces must belong to different broadcasting domains. A
broadcast domain in a network is a set of nodes, which receive broadcast traffic sent by
any of them. In most configurations, all nodes connected to the same switch belong to
the same broadcasting domain.
Prerequisites
Procedure
a. Create a connection for the VRF device and assign it to a routing table. For example, to
create a VRF device named vrf0 that is assigned to the 1001 routing table:
# nmcli connection add type vrf ifname vrf0 con-name vrf0 table 1001 ipv4.method
disabled ipv6.method disabled
c. Assign a network device to the VRF just created. For example, to add the enp1s0 Ethernet
268
CHAPTER 27. REUSING THE SAME IP ADDRESS ON DIFFERENT INTERFACES
c. Assign a network device to the VRF just created. For example, to add the enp1s0 Ethernet
device to the vrf0 VRF device and assign an IP address and the subnet mask to enp1s0,
enter:
a. Create the VRF device and assign it to a routing table. For example, to create a VRF device
named vrf1 that is assigned to the 1002 routing table, enter:
# nmcli connection add type vrf ifname vrf1 con-name vrf1 table 1002 ipv4.method
disabled ipv6.method disabled
c. Assign a network device to the VRF just created. For example, to add the enp7s0 Ethernet
device to the vrf1 VRF device and assign an IP address and the subnet mask to enp7s0,
enter:
IMPORTANT
To enable remote peers to contact both VRF interfaces while reusing the same IP
address, the network interfaces must belong to different broadcasting domains. A
broadcast domain in a network is a set of nodes which receive broadcast traffic sent by
any of them. In most configurations, all nodes connected to the same switch belong to
the same broadcasting domain.
Prerequisites
269
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
a. Create the VRF device and assign it to a routing table. For example, to create a VRF device
named blue that is assigned to the 1001 routing table:
c. Assign a network device to the VRF device. For example, to add the enp1s0 Ethernet
device to the blue VRF device:
e. Assign an IP address and subnet mask to the enp1s0 device. For example, to set it to
192.0.2.1/24:
a. Create the VRF device and assign it to a routing table. For example, to create a VRF device
named red that is assigned to the 1002 routing table:
c. Assign a network device to the VRF device. For example, to add the enp7s0 Ethernet
device to the red VRF device:
e. Assign the same IP address and subnet mask to the enp7s0 device as you used for enp1s0
in the blue VRF domain:
270
CHAPTER 27. REUSING THE SAME IP ADDRESS ON DIFFERENT INTERFACES
271
Red Hat Enterprise Linux 9 Configuring and managing networking
WARNING
To prevent that you lock out yourself out remotely, perform this procedure on the
local console or remotely over a network interface that you do not want to assign to
the VRF device.
Prerequisites
You are logged in locally or using a network interface that is different to the one you want to
assign to the VRF device.
Procedure
1. Create the vrf0 connection with a same-named virtual device, and attach it to routing table
1000:
# nmcli connection add type vrf ifname vrf0 con-name vrf0 table 1000 ipv4.method
disabled ipv6.method disabled
2. Add the enp1s0 device to the vrf0 connection, and configure the IP settings:
# nmcli connection add type ethernet con-name enp1s0 ifname enp1s0 controller vrf0
ipv4.method manual ipv4.address 192.0.2.1/24 ipv4.gateway 192.0.2.254
This command creates the enp1s0 connection as a port of the vrf0 connection. Due to this
configuration, the routing information are automatically assigned to the routing table 1000 that
is associated with the vrf0 device.
This adds a route to the 198.51.100.0/24 network that uses 192.0.2.2 as the router.
272
CHAPTER 28. STARTING A SERVICE WITHIN AN ISOLATED VRF NETWORK
Verification
# ip vrf show
Name Table
-----------------------
vrf0 1000
# ip route show
default via 203.0.113.0/24 dev enp7s0 proto static metric 100
The main routing table does not mention any routes associated with the device enp1s0 device
or the 192.0.2.1/24 subnet.
The default entry indicates that services that use this routing table, use 192.0.2.254 as their
default gateway and not the default gateway in the main routing table.
5. Execute the traceroute utility in the network associated with vrf0 to verify that the utility uses
the route from table 1000:
The first hop is the default gateway that is assigned to the routing table 1000 and not the
default gateway from the system’s main routing table.
Additional resources
273
Red Hat Enterprise Linux 9 Configuring and managing networking
You can configure a service, such as the Apache HTTP Server, to start within an isolated virtual routing
and forwarding (VRF) network.
IMPORTANT
Services can only bind to local IP addresses that are in the same VRF network.
Prerequisites
You configured Apache HTTP Server to listen only on the IP address that is assigned to the
interface associated with the vrf0 device.
Procedure
You require the content of the ExecStart parameter in a later step to run the same command
within the isolated VRF network.
# mkdir /etc/systemd/system/httpd.service.d/
[Service]
ExecStart=
ExecStart=/usr/sbin/ip vrf exec vrf0 /usr/sbin/httpd $OPTIONS -DFOREGROUND
To override the ExecStart parameter, you first need to unset it and then set it to the new value
as shown.
4. Reload systemd.
# systemctl daemon-reload
Verification
274
CHAPTER 28. STARTING A SERVICE WITHIN AN ISOLATED VRF NETWORK
# pidof -c httpd
1904 ...
Additional resources
275
Red Hat Enterprise Linux 9 Configuring and managing networking
You can set the following ethtool settings in NetworkManager connection profiles:
Offload features
Network interface controllers can use the TCP offload engine (TOE) to offload processing certain
operations to the network controller. This improves the network throughput.
Interrupt coalesce settings
By using interrupt coalescing, the system collects network packets and generates a single interrupt
for multiple packets. This increases the amount of data sent to the kernel with one hardware
interrupt, which reduces the interrupt load, and maximizes the throughput.
Ring buffers
These buffers store incoming and outgoing network packets. You can increase the ring buffer sizes
to reduce a high packet drop rate.
Channel settings
A network interface manages its associated number of channels along with hardware settings and
network drivers. All devices associated with a network interface communicate with each other
through interrupt requests (IRQ). Each device queue holds pending IRQ and communicates with
each other over a data line known as channel. Types of queues are associated with specific channel
types. These channel types include:
other for link interrupts or single root input/output virtualization (SR-IOV) coordination
Procedure
1. For example, to enable the RX offload feature and disable TX offload in the enp1s0 connection
profile, enter:
2. To remove the setting of an offload feature that you previously enabled or disabled, set the
feature’s parameter to a null value. For example, to remove the configuration for TX offload,
enter:
276
CHAPTER 29. CONFIGURING ETHTOOL SETTINGS IN NETWORKMANAGER CONNECTION PROFILES
Verification
Use the ethtool -k command to display the current offload features of a network device:
# ethtool -k network_device
Additional resources
You can use the network RHEL system role to configure ethtool features of a NetworkManager
connection.
IMPORTANT
When you run a play that uses the network RHEL system role and if the setting values do
not match the values specified in the play, the role overrides the existing connection
profile with the same name. To prevent resetting these values to their defaults, always
specify the whole configuration of the network connection profile in the play, even if the
configuration, for example the IP configuration, already exists.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with ethtool features
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: enp1s0
277
Red Hat Enterprise Linux 9 Configuring and managing networking
type: ethernet
autoconnect: yes
ip:
address:
- 198.51.100.20/24
- 2001:db8:1::1/64
gateway4: 198.51.100.254
gateway6: 2001:db8:1::fffe
dns:
- 198.51.100.200
- 2001:db8:1::ffbb
dns_search:
- example.com
ethtool:
features:
gro: "no"
gso: "yes"
tx_sctp_segmentation: "no"
state: up
This playbook creates the enp1s0 connection profile with the following settings, or updates it if
the profile already exists:
ethtool features:
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
278
CHAPTER 29. CONFIGURING ETHTOOL SETTINGS IN NETWORKMANAGER CONNECTION PROFILES
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
You can use NetworkManager to set ethtool coalesce settings in connection profiles.
Procedure
1. For example, to set the maximum number of received packets to delay to 128 in the enp1s0
connection profile, enter:
2. To remove a coalesce setting, set it to a null value. For example, to remove the
ethtool.coalesce-rx-frames setting, enter:
Verification
1. Use the ethtool -c command to display the current offload features of a network device:
# ethtool -c network_device
Additional resources
You can use the network RHEL system role to configure ethtool coalesce settings of a
NetworkManager connection.
IMPORTANT
When you run a play that uses the network RHEL system role and if the setting values do
not match the values specified in the play, the role overrides the existing connection
profile with the same name. To prevent resetting these values to their defaults, always
specify the whole configuration of the network connection profile in the play, even if the
configuration, for example the IP configuration, already exists.
279
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with ethtool coalesce settings
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: enp1s0
type: ethernet
autoconnect: yes
ip:
address:
- 198.51.100.20/24
- 2001:db8:1::1/64
gateway4: 198.51.100.254
gateway6: 2001:db8:1::fffe
dns:
- 198.51.100.200
- 2001:db8:1::ffbb
dns_search:
- example.com
ethtool:
coalesce:
rx_frames: 128
tx_frames: 128
state: up
This playbook creates the enp1s0 connection profile with the following settings, or updates it if
the profile already exists:
280
CHAPTER 29. CONFIGURING ETHTOOL SETTINGS IN NETWORKMANAGER CONNECTION PROFILES
RX frames: 128
TX frames: 128
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
Receive ring buffers are shared between the device driver and network interface controller (NIC). The
card assigns a transmit (TX) and receive (RX) ring buffer. As the name implies, the ring buffer is a
circular buffer where an overflow overwrites existing data. There are two ways to move data from the
NIC to the kernel, hardware interrupts and software interrupts, also called SoftIRQs.
The kernel uses the RX ring buffer to store incoming packets until the device driver can process them.
The device driver drains the RX ring, typically by using SoftIRQs, which puts the incoming packets into a
kernel data structure called an sk_buff or skb to begin its journey through the kernel and up to the
application that owns the relevant socket.
The kernel uses the TX ring buffer to hold outgoing packets which should be sent to the network. These
ring buffers reside at the bottom of the stack and are a crucial point at which packet drop can occur,
which in turn will adversely affect network performance.
Procedure
# ethtool -S enp1s0
...
rx_queue_0_drops: 97326
rx_queue_1_drops: 63783
...
281
Red Hat Enterprise Linux 9 Configuring and managing networking
Note that the output of the command depends on the network card and the driver.
High values in discard or drop counters indicate that the available buffer fills up faster than the
kernel can process the packets. Increasing the ring buffers can help to avoid such loss.
# ethtool -g enp1s0
Ring parameters for enp1s0:
Pre-set maximums:
RX: 4096
RX Mini: 0
RX Jumbo: 16320
TX: 4096
Current hardware settings:
RX: 255
RX Mini: 0
RX Jumbo: 0
TX: 255
If the values in the Pre-set maximums section are higher than in the Current hardware
settings section, you can change the settings in the next steps.
IMPORTANT
Depending on the driver your NIC uses, changing in the ring buffer can shortly
interrupt the network connection.
Additional resources
282
CHAPTER 29. CONFIGURING ETHTOOL SETTINGS IN NETWORKMANAGER CONNECTION PROFILES
Ring buffers are circular buffers where an overflow overwrites existing data. The network card assigns a
transmit (TX) and receive (RX) ring buffer. Receive ring buffers are shared between the device driver
and the network interface controller (NIC). Data can move from NIC to the kernel through either
hardware interrupts or software interrupts, also called SoftIRQs.
The kernel uses the RX ring buffer to store incoming packets until the device driver can process them.
The device driver drains the RX ring, typically by using SoftIRQs, which puts the incoming packets into a
kernel data structure called an sk_buff or skb to begin its journey through the kernel and up to the
application that owns the relevant socket.
The kernel uses the TX ring buffer to hold outgoing packets which should be sent to the network. These
ring buffers reside at the bottom of the stack and are a crucial point at which packet drop can occur,
which in turn will adversely affect network performance.
IMPORTANT
When you run a play that uses the network RHEL system role and if the setting values do
not match the values specified in the play, the role overrides the existing connection
profile with the same name. To prevent resetting these values to their defaults, always
specify the whole configuration of the network connection profile in the play, even if the
configuration, for example the IP configuration, already exists.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
You know the maximum ring buffer sizes that the device supports.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure the network
hosts: managed-node-01.example.com
tasks:
- name: Configure an Ethernet connection with increased ring buffer sizes
ansible.builtin.include_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: enp1s0
type: ethernet
283
Red Hat Enterprise Linux 9 Configuring and managing networking
autoconnect: yes
ip:
address:
- 198.51.100.20/24
- 2001:db8:1::1/64
gateway4: 198.51.100.254
gateway6: 2001:db8:1::fffe
dns:
- 198.51.100.200
- 2001:db8:1::ffbb
dns_search:
- example.com
ethtool:
ring:
rx: 4096
tx: 4096
state: up
This playbook creates the enp1s0 connection profile with the following settings, or updates it if
the profile already exists:
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
284
CHAPTER 29. CONFIGURING ETHTOOL SETTINGS IN NETWORKMANAGER CONNECTION PROFILES
/usr/share/doc/rhel-system-roles/network/ directory
By using NetworkManager, you can manage network devices and connections. The ethtool utility
manages the link speed and related settings of a network interface card. ethtool handles IRQ based
communication with associated devices to manage related channels settings in connection profiles.
Procedure
Verification
Check the updated channel settings associated with the network device:
285
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
286
CHAPTER 30. INTRODUCTION TO NETWORKMANAGER DEBUGGING
2. Removing pending changes from the modified connection settings. As NetworkManager does
not revert the manual changes, you can reconfigure the device and revert external or manual
parameters.
3. Creating different modified connection settings than that of the existing connection settings.
bridge.ageing-time
bridge.forward-delay
bridge.group-address
bridge.group-forward-mask
bridge.hello-time
bridge.max-age
bridge.multicast-hash-max
bridge.multicast-last-member-count
bridge.multicast-last-member-interval
bridge.multicast-membership-interval
bridge.multicast-querier
bridge.multicast-querier-interval
bridge.multicast-query-interval
bridge.multicast-query-response-interval
287
Red Hat Enterprise Linux 9 Configuring and managing networking
bridge.multicast-query-use-ifaddr
bridge.multicast-router
bridge.multicast-snooping
bridge.multicast-startup-query-count
bridge.multicast-startup-query-interval
bridge.priority
bridge.stp
bridge.VLAN-filtering
bridge.VLAN-protocol
bridge.VLANs
802-3-ethernet.accept-all-mac-addresses
802-3-ethernet.cloned-mac-address
IPv4.addresses
IPv4.dhcp-client-id
IPv4.dhcp-iaid
IPv4.dhcp-timeout
IPv4.DNS
IPv4.DNS-priority
IPv4.DNS-search
IPv4.gateway
IPv4.ignore-auto-DNS
IPv4.ignore-auto-routes
IPv4.may-fail
IPv4.method
IPv4.never-default
IPv4.route-table
IPv4.routes
IPv4.routing-rules
IPv6.addr-gen-mode
288
CHAPTER 30. INTRODUCTION TO NETWORKMANAGER DEBUGGING
IPv6.addresses
IPv6.dhcp-duid
IPv6.dhcp-iaid
IPv6.dhcp-timeout
IPv6.DNS
IPv6.DNS-priority
IPv6.DNS-search
IPv6.gateway
IPv6.ignore-auto-DNS
IPv6.may-fail
IPv6.method
IPv6.never-default
IPv6.ra-timeout
IPv6.route-metric
IPv6.route-table
IPv6.routes
IPv6.routing-rules
Additional resources
This procedure disables rate-limiting and enables recording debug logs for the all (ALL) domains.
Procedure
RateLimitBurst=0
289
Red Hat Enterprise Linux 9 Configuring and managing networking
[logging]
domains=ALL:TRACE
Verification
Query the systemd journal to display the journal entries of the NetworkManager unit:
# journalctl -u NetworkManager
...
Jun 30 15:24:32 server NetworkManager[164187]: <debug> [1656595472.4939] active-
connection[0x5565143c80a0]: update activation type from assume to managed
Jun 30 15:24:32 server NetworkManager[164187]: <trace> [1656595472.4939]
device[55b33c3bdb72840c] (enp1s0): sys-iface-state: assume -> managed
Jun 30 15:24:32 server NetworkManager[164187]: <trace> [1656595472.4939]
l3cfg[4281fdf43e356454,ifindex=3]: commit type register (type "update", source "device",
existing a369f23014b9ede3) -> a369f23014b9ede3
Jun 30 15:24:32 server NetworkManager[164187]: <info> [1656595472.4940] manager:
NetworkManager state is now CONNECTED_SITE
...
Procedure
2. To modify the logging level and domains, use the following options:
To set the log level for all domains to the same LEVEL, enter:
290
CHAPTER 30. INTRODUCTION TO NETWORKMANAGER DEBUGGING
Note that updating the logging level using this command disables logging for all the other
domains.
To change the level of specific domains and preserve the level of all other domains, enter:
Procedure
# journalctl -u NetworkManager -b
Additional resources
INFO Logs various informational messages that are useful for tracking state and
operations
Note that subsequent levels log all messages from earlier levels. For example, setting the log level to
INFO also logs messages contained in the ERR and WARN log level.
291
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
292
CHAPTER 31. USING LLDP TO DEBUG NETWORK CONFIGURATION PROBLEMS
Prerequisites
Procedure
interfaces:
- name: enp1s0
type: ethernet
lldp:
enabled: true
293
Red Hat Enterprise Linux 9 Configuring and managing networking
system-name: Summit300-48
- type: 6
system-description: Summit300-48 - Version 7.4e.1 (Build 5)
05/27/05 04:53:11
- type: 7
system-capabilities:
- MAC Bridge component
- Router
- type: 1
_description: MAC address
chassis-id: 00:01:30:F9:AD:A0
chassis-id-type: 4
- type: 2
_description: Interface name
port-id: 1/1
port-id-type: 5
- type: 127
ieee-802-1-vlans:
- name: v2-0488-03-0505
vid: 488
oui: 00:80:c2
subtype: 3
- type: 127
ieee-802-3-mac-phy-conf:
autoneg: true
operational-mau-type: 16
pmd-autoneg-cap: 27648
oui: 00:12:0f
subtype: 1
- type: 127
ieee-802-1-ppvids:
-0
oui: 00:80:c2
subtype: 2
- type: 8
management-addresses:
- address: 00:01:30:F9:AD:A0
address-subtype: MAC
interface-number: 1001
interface-number-subtype: 2
- type: 127
ieee-802-3-max-frame-size: 1522
oui: 00:12:0f
subtype: 4
mac-address: 82:75:BE:6F:8C:7A
mtu: 1500
4. Verify the output to ensure that the settings match your expected configuration. For example,
the LLDP information of the interface connected to the switch shows that the switch port this
host is connected to uses VLAN ID 448:
- type: 127
ieee-802-1-vlans:
- name: v2-0488-03-0505
vid: 488
If the network configuration of the enp1s0 interface uses a different VLAN ID, change it
294
CHAPTER 31. USING LLDP TO DEBUG NETWORK CONFIGURATION PROBLEMS
If the network configuration of the enp1s0 interface uses a different VLAN ID, change it
accordingly.
Additional resources
295
Red Hat Enterprise Linux 9 Configuring and managing networking
The scheduling mechanism arranges or rearranges the packets before they enter or exit different
queues. The most common scheduler is the First-In-First-Out (FIFO) scheduler. You can do the qdiscs
operations temporarily using the tc utility or permanently using NetworkManager.
In Red Hat Enterprise Linux, you can configure default queueing disciplines in various ways to manage
the traffic on a network interface.
enqueue requests so that a packet can be queued up for later transmission and
dequeue requests so that one of the queued-up packets can be chosen for immediate
transmission.
Every qdisc has a 16-bit hexadecimal identification number called a handle, with an attached colon, such
as 1: or abcd:. This number is called the qdisc major number. If a qdisc has classes, then the identifiers
are formed as a pair of two numbers with the major number before the minor, <major>:<minor>, for
example abcd:1. The numbering scheme for the minor numbers depends on the qdisc type. Sometimes
the numbering is systematic, where the first-class has the ID <major>:1, the second one <major>:2, and
so on. Some qdiscs allow the user to set class minor numbers arbitrarily when creating the class.
Classful qdiscs
Different types of qdiscs exist and help in the transfer of packets to and from a networking
interface. You can configure qdiscs with root, parent, or child classes. The point where children can
be attached are called classes. Classes in qdisc are flexible and can always contain either multiple
children classes or a single child, qdisc. There is no prohibition against a class containing a classful
qdisc itself, this facilitates complex traffic control scenarios.
Classful qdiscs do not store any packets themselves. Instead, they enqueue and dequeue requests
down to one of their children according to criteria specific to the qdisc. Eventually, this recursive
packet passing ends up where the packets are stored (or picked up from in the case of dequeuing).
Classless qdiscs
Some qdiscs contain no child classes and they are called classless qdiscs. Classless qdiscs require
less customization compared to classful qdiscs. It is usually enough to attach them to an interface.
Additional resources
296
CHAPTER 32. LINUX TRAFFIC CONTROL
Netfilter assigns a connection tracking entry. Connection tracking is a Linux kernel networking feature
for logical networks that tracks connections and identifies packet flow in those connections. This feature
filters and analyzes every packet, sets up the connection tracking table to store connection status, and
updates the connection status based on identified packets. For example, in the case of FTP connection,
Netfilter assigns a connection tracking entry to ensure all packets of FTP connection work in the same
manner. The connection tracking entry stores a Netfilter mark and tracks the connection state
information in the memory table in which a new packet tuple maps with an existing entry. If the packet
tuple does not map with an existing entry, the packet adds a new connection tracking entry that groups
packets of the same connection.
You can control and analyze traffic on the network interface. The tc traffic controller utility uses the
qdisc discipline to configure the packet scheduler in the network. The qdisc kernel-configured queuing
discipline enqueues packets to the interface. By using qdisc, Kernel catches all the traffic before a
network interface transmits it. Also, to limit the bandwidth rate of packets belonging to the same
connection, use the tc qdisc command.
To retrieve data from connection tracking marks into various fields, use the tc utility with the ctinfo
module and the connmark functionality. For storing packet mark information, the ctinfo module copies
the Netfilter mark and the connection state information into a socket buffer ( skb) mark metadata field.
Transmitting a packet over a physical medium removes all the metadata of a packet. Before the packet
loses its metadata, the ctinfo module maps and copies the Netfilter mark value to a specific value of the
Diffserv code point (DSCP) in the packet’s IP field.
Additional resources
Procedure
dropped - the number of times a packet is dropped because all queues are full
297
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
# sysctl -w net.core.default_qdisc=pfifo_fast
# modprobe -r NETWORKDRIVERNAME
# modprobe NETWORKDRIVERNAME
Verification
Additional resources
298
CHAPTER 32. LINUX TRAFFIC CONTROL
You can update the current qdisc without changing the default one.
Procedure
Verification
Procedure
3. Optional: To add another qdisc over the existing qdisc, use the +tc.qdisc option:
Verification
299
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
The connection tracking entry stores the Netfilter mark and connection information. When a router
forwards a packet from the firewall, the router either removes or modifies the connection tracking entry
from the packet. The connection tracking information (ctinfo) module retrieves data from connection
tracking marks into various fields. This kernel module preserves the Netfilter mark by copying it into
socket buffer (skb) mark metadata field.
Prerequisites
Procedure
name ifb4eth0
Sets new virtual device interface.
numtxqueues 48
Sets the number of transmit queues.
numrxqueues 48
Sets the number of receive queues.
type ifb
Sets the type of the new device.
c. Add the qdisc attribute on the physical network interface and apply it to the incoming
traffic:
300
CHAPTER 32. LINUX TRAFFIC CONTROL
In the handle ffff: option, the handle parameter assigns the major number ffff: as a default
value to a classful qdisc on the enp1s0 physical network interface, where qdisc is a
queueing discipline parameter to analyze traffic control.
# tc filter add dev enp1s0 parent ffff: protocol ip u32 match u32 0 0 action ctinfo
cpmark 100 action mirred egress redirect dev ifb4eth0
parent ffff:
Sets major number ffff: for the parent qdisc.
u32 match u32 0 0
Sets the u32 filter to match the IP headers of u32 pattern. The first 0 represents the
second byte of IP header while the other 0 is for the mask match telling the filter which
bits to match.
action ctinfo
Sets action to retrieve data from the connection tracking mark into various fields.
cpmark 100
Copies the connection tracking mark (connmark) 100 into the packet IP header field.
action mirred egress redirect dev ifb4eth0
Sets action mirred to redirect the received packets to the ifb4eth0 destination
interface.
This command sets the major number 1 to root qdisc and uses the htb hierarchy token
bucket with classful qdisc of minor-id 1000.
f. Limit the traffic on the interface to 1 Mbit/s with an upper limit of 2 Mbit/s:
# tc class add dev ifb4eth0 parent 1:1 classid 1:100 htb ceil 2mbit rate 1mbit prio
100
parent 1:1
Sets parent with classid as 1 and root as 1.
classid 1:100
Sets classid as 1:100 where 1 is the number of parent qdisc and 100 is the number of
classes of the parent qdisc.
htb ceil 2mbit
The htb classful qdisc allows upper limit bandwidth of 2 Mbit/s as the ceil rate limit.
g. Apply the Stochastic Fairness Queuing (sfq) of classless qdisc to interface with a time
301
Red Hat Enterprise Linux 9 Configuring and managing networking
g. Apply the Stochastic Fairness Queuing (sfq) of classless qdisc to interface with a time
interval of 60 seconds to reduce queue algorithm perturbation:
# tc filter add dev ifb4eth0 parent 1:0 protocol ip prio 100 handle 100 fw classid
1:100
i. Restore the packet meta mark from the connection mark (CONNMARK):
# nft add rule ip mangle PREROUTING counter meta mark set ct mark
In this command, the nft utility has a mangle table with the PREROUTING chain rule
specification that alters incoming packets before routing to replace the packet mark with
CONNMARK.
j. If no nft table and chain exist, create a table and add a chain rule:
k. Set the meta mark on tcp packets that are received on the specified destination address
192.0.2.3:
# nft add rule ip mangle PREROUTING ip daddr 192.0.2.3 counter meta mark set
0x64
m. Run the iperf3 utility as the server on a system by using the -s parameter and the server
then waits for the response of the client connection:
# iperf3 -s
2. On the client, run iperf3 as a client and connect to the server that listens on IP address
192.0.2.3 for periodic HTTP request-response timestamp:
192.0.2.3 is the IP address of the server while 192.0.2.4 is the IP address of the client.
302
CHAPTER 32. LINUX TRAFFIC CONTROL
...
[ID] Interval Transfer Bitrate
[5] 0.00-14.81 sec 1.51 MBytes 853 Kbits/sec receiver
Verification
1. Display the statistics about packet counts of the htb and sfq classes on the interface:
2. Display the statistics of packet counts for the mirred and ctinfo actions:
303
Red Hat Enterprise Linux 9 Configuring and managing networking
Action statistics:
Sent 25891504 bytes 3137 pkt (dropped 0, overlimits 61 requeues 0)
backlog 0b 0p requeues 0
Additional resources
304
CHAPTER 32. LINUX TRAFFIC CONTROL
PLUG kernel-core
IMPORTANT
Additional resources
305
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
The Ethernet connection profile exists in NetworkManager and has a valid IP configuration.
The following files required for TLS authentication exist on the client:
The client key stored is in the /etc/pki/tls/private/client.key file, and the file is owned and
only readable by the root user.
Procedure
1. Set the Extensible Authentication Protocol (EAP) to tls and the paths to the client certificate
and key file:
Note that you must set the 802-1x.eap, 802-1x.client-cert, and 802-1x.private-key parameters
in a single command.
306
RHEL CLIENT TO THE NETWORK BY USING THE 802.1X STANDARD WITH A CERTIFICATE STORED ON THE FILE SYSTEM
IMPORTANT
Verification
Additional resources
NOTE
The nmstate library only supports the TLS Extensible Authentication Protocol (EAP)
method.
Prerequisites
The following files required for TLS authentication exist on the client:
The client key stored is in the /etc/pki/tls/private/client.key file, and the file is owned and
only readable by the root user.
307
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
1. Create a YAML file, for example ~/create-ethernet-profile.yml, with the following content:
---
interfaces:
- name: enp1s0
type: ethernet
state: up
ipv4:
enabled: true
address:
- ip: 192.0.2.1
prefix-length: 24
dhcp: false
ipv6:
enabled: true
address:
- ip: 2001:db8:1::1
prefix-length: 64
autoconf: false
dhcp: false
802.1x:
ca-cert: /etc/pki/tls/certs/ca.crt
client-cert: /etc/pki/tls/certs/client.crt
eap-methods:
- tls
identity: client.example.org
private-key: /etc/pki/tls/private/client.key
private-key-password: password
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.0.2.254
next-hop-interface: enp1s0
- destination: ::/0
next-hop-address: 2001:db8:1::fffe
next-hop-interface: enp1s0
dns-resolver:
config:
search:
- example.com
server:
- 192.0.2.200
- 2001:db8:1::ffbb
These settings define an Ethernet connection profile for the enp1s0 device with the following
settings:
308
RHEL CLIENT TO THE NETWORK BY USING THE 802.1X STANDARD WITH A CERTIFICATE STORED ON THE FILE SYSTEM
Verification
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
The following files required for TLS authentication exist on the control node:
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure an Ethernet connection with 802.1X authentication
hosts: managed-node-01.example.com
tasks:
309
Red Hat Enterprise Linux 9 Configuring and managing networking
These settings define an Ethernet connection profile for the enp1s0 device with the following
settings:
310
RHEL CLIENT TO THE NETWORK BY USING THE 802.1X STANDARD WITH A CERTIFICATE STORED ON THE FILE SYSTEM
802.1X network authentication using the TLS Extensible Authentication Protocol (EAP)
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
The following files required for TLS authentication exist on the control node:
311
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Configure a wifi connection with 802.1X authentication
hosts: managed-node-01.example.com
tasks:
- name: Copy client key for 802.1X authentication
ansible.builtin.copy:
src: "/srv/data/client.key"
dest: "/etc/pki/tls/private/client.key"
mode: 0400
- block:
- ansible.builtin.import_role:
name: rhel-system-roles.network
vars:
network_connections:
- name: Configure the Example-wifi profile
interface_name: wlp1s0
state: up
type: wireless
autoconnect: yes
ip:
dhcp4: true
auto6: true
wireless:
ssid: "Example-wifi"
key_mgmt: "wpa-eap"
ieee802_1x:
identity: "user_name"
eap: tls
private_key: "/etc/pki/tls/client.key"
private_key_password: "password"
private_key_password_flags: none
client_cert: "/etc/pki/tls/client.pem"
ca_cert: "/etc/pki/tls/cacert.pem"
domain_suffix_match: "example.com"
These settings define a wifi connection profile for the wlp1s0 interface. The profile uses 802.1X
standard to authenticate the client to the wifi network. The connection retrieves IPv4
addresses, IPv6 addresses, default gateway, routes, DNS servers, and search domains from a
DHCP server and IPv6 stateless address autoconfiguration (SLAAC).
312
RHEL CLIENT TO THE NETWORK BY USING THE 802.1X STANDARD WITH A CERTIFICATE STORED ON THE FILE SYSTEM
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
/usr/share/doc/rhel-system-roles/network/ directory
313
Red Hat Enterprise Linux 9 Configuring and managing networking
The IEEE 802.1X standard defines secure authentication and authorization methods to protect networks
from unauthorized clients. By using the hostapd service and FreeRADIUS, you can provide network
access control (NAC) in your network.
In this documentation, the RHEL host acts as a bridge to connect different clients with an existing
network. However, the RHEL host grants only authenticated clients access to the network.
34.1. PREREQUISITES
A clean installation of the freeradius package.
If the package is already installed, remove the /etc/raddb/ directory, uninstall and then install
the package again. Do not reinstall the package by using the dnf reinstall command, because
the permissions and symbolic links in the /etc/raddb/ directory are then different.
Prerequisites
Procedure
# nmcli connection add type ethernet port-type bridge con-name br0-port1 ifname
enp1s0 controller br0
# nmcli connection add type ethernet port-type bridge con-name br0-port2 ifname
314
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
3. Enable the bridge to forward extensible authentication protocol over LAN (EAPOL) packets:
Verification
1. Display the link status of Ethernet devices that are ports of a specific bridge:
# cat /sys/class/net/br0/bridge/group_fwd_mask
0x8
Additional resources
A TLS server certificate for encrypted connections to the server. Use a trusted certificate
authority (CA) to issue the certificate.
The server certificate requires the extended key usage (EKU) field set to TLS Web Server
Authentication.
Client certificates issued by the same CA for extended authentication protocol transport layer
security (EAP-TLS). EAP-TLS provides certificate-based authentication and is enabled by
default.
The client certificates require their EKU field set to TLS Web Client Authentication.
315
Red Hat Enterprise Linux 9 Configuring and managing networking
WARNING
IMPORTANT
If you use the default configuration, certificates generated by these scripts expire after
60 days and keys use an insecure password ("whatever"). However, you can customize
the CA, server, and client configuration.
After you perform the procedure, the following files, which you require later in this documentation, are
created:
/etc/raddb/certs/ca.pem: CA certificate
Prerequisites
Procedure
# cd /etc/raddb/certs/
...
[ req ]
default_bits = 2048
input_password = ca_password
output_password = ca_password
...
316
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
[certificate_authority]
countryName = US
stateOrProvinceName = North Carolina
localityName = Raleigh
organizationName = Example Inc.
emailAddress = [email protected]
commonName = "Example Certificate Authority"
...
...
[ CA_default ]
default_days = 730
...
[ req ]
distinguished_name = server
default_bits = 2048
input_password = key_password
output_password = key_password
...
[server]
countryName = US
stateOrProvinceName = North Carolina
localityName = Raleigh
organizationName = Example Inc.
emailAddress = [email protected]
commonName = "Example Server Certificate"
...
...
[ CA_default ]
default_days = 365
...
[ req ]
distinguished_name = client
default_bits = 2048
input_password = password_on_private_key
output_password = password_on_private_key
...
[client]
countryName = US
stateOrProvinceName = North Carolina
localityName = Raleigh
organizationName = Example Inc.
emailAddress = [email protected]
commonName = [email protected]
...
# make all
317
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
/etc/raddb/certs/README.md
EAP-TLS (transport layer security) uses a secure TLS connection to authenticate clients by
using certificates. To use EAP-TLS, you need TLS client certificates for each network client and
a server certificate for the server. Note that the same certificate authority (CA) must have
issued the certificates. Always use your own CA to create certificates, because all client
certificates issued by the CA you use can authenticate to your FreeRADIUS server.
EAP-TTLS (tunneled transport layer security) uses a secure TLS connection as the outer
authentication protocol to set up the tunnel. The inner authentication then uses, for example,
the password authentication protocol (PAP) or challenge handshake authentication protocol
(CHAP). To use EAP-TTLS, you need a TLS server certificate.
EAP-PEAP (protected extensible authentication protocol) uses a secure TLS connection as the
outer authentication protocol to set up the tunnel. The authenticator authenticates the
certificate of the RADIUS server. Afterwards, the supplicant authenticates through the
encrypted tunnel by using Microsoft challenge handshake authentication protocol version 2
(MS-CHAPv2) or other methods.
NOTE
The default FreeRADIUS configuration files serve as documentation and describe all
parameters and directives. If you want to disable certain features, comment them out
instead of removing the corresponding parts in the configuration files. This enables you
to preserve the structure of the configuration files and the included documentation.
Prerequisites
The configuration files in the /etc/raddb/ directory are unchanged and as provided by the
freeradius package.
If you store the files in a different location or if they have different names, set the
318
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
If you store the files in a different location or if they have different names, set the
private_key_file, certificate_file, and ca_file parameters in the /etc/raddb/mods-
available/eap file accordingly.
Procedure
1. If the /etc/raddb/certs/dh with Diffie-Hellman (DH) parameters does not exist, create one. For
example, to create a DH file with a 2048 bits prime, enter:
For security reasons, do not use a DH file with less than a 2048 bits prime. Depending on the
number of bits, the creation of the file can take several minutes.
2. Set secure permissions on the TLS private key, server certificate, CA certificate, and the file
with DH parameters:
eap {
...
tls-config tls-common {
...
private_key_password = key_password
...
}
}
b. Depending on your environment, set the default_eap_type parameter in the eap directive
to your primary EAP type you use:
eap {
...
default_eap_type = ttls
...
}
c. Comment out the md5 directives to disable the insecure EAP-MD5 authentication method:
eap {
...
# md5 {
#}
...
}
Note that, in the default configuration file, other insecure EAP authentication methods are
319
Red Hat Enterprise Linux 9 Configuring and managing networking
Note that, in the default configuration file, other insecure EAP authentication methods are
commented out by default.
4. Edit the /etc/raddb/sites-available/default file, and comment out all authentication methods
other than eap:
authenticate {
...
# Auth-Type PAP {
# pap
#}
# Auth-Type CHAP {
# chap
#}
# Auth-Type MS-CHAP {
# mschap
#}
# mschap
# digest
...
}
This leaves only EAP enabled for the outer authentication and disables plain-text
authentication methods.
client localhost {
ipaddr = 127.0.0.1
...
secret = localhost_client_password
...
}
client localhost_ipv6 {
ipv6addr = ::1
secret = localhost_client_password
}
client hostapd.example.org {
ipaddr = 192.0.2.2/32
secret = hostapd_client_password
}
c. Optional: If other hosts should also be able to access the FreeRADIUS service, add client
directives for them as well, for example:
320
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
client <hostname_or_description> {
ipaddr = <IP_address_or_range>
secret = <client_password>
}
The ipaddr parameter accepts IPv4 and IPv6 addresses, and you can use the optional
classless inter-domain routing (CIDR) notation to specify ranges. However, you can set only
one value in this parameter. For example, to grant access to both an IPv4 and IPv6 address,
you must add two client directives.
Use a descriptive name for the client directive, such as a hostname or a word that describes
where the IP range is used.
6. If you want to use EAP-TTLS or EAP-PEAP, add the users to the /etc/raddb/users file:
For users who should use certificate-based authentication (EAP-TLS), do not add any entry.
# radiusd -XC
...
Configuration appears to be OK
Verification
Troubleshooting
# radiusd -X
...
Ready to process requests
321
Red Hat Enterprise Linux 9 Configuring and managing networking
Next steps
Disable no longer required authentication methods and other features you do not use.
The hostapd service provides an integrated RADIUS server. However, use the integrated RADIUS server
only for testing purposes. For production environments, use FreeRADIUS server, which supports
additional features, such as different authentication methods and access control.
IMPORTANT
The hostapd service does not interact with the traffic plane. The service acts only as an
authenticator. For example, use a script or service that uses the hostapd control
interface to allow or deny traffic based on the result of authentication events.
Prerequisites
The FreeRADIUS server has been configured, and it is ready to authenticate clients.
Procedure
# Log level
logger_syslog_level=2
logger_stdout_level=2
322
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
driver=wired
For further details about the parameters used in this configuration, see their descriptions in the
/usr/share/doc/hostapd/hostapd.conf example configuration file.
Verification
See:
Troubleshooting
323
Red Hat Enterprise Linux 9 Configuring and managing networking
# hostapd -d /etc/hostapd/hostapd.conf
Additional resources
/usr/share/doc/hostapd/hostapd.conf file
After you set up the hostapd service as an authenticator for 802.1X network authentication.
The output of the test utilities used in this procedure provide additional information about the EAP
communication and help you to debug problems.
Prerequisites
A FreeRADIUS server:
The client, on which you run this procedure, has been authorized in the FreeRADIUS
server’s client databases.
You stored the certificate authority (CA) certificate in the /etc/pki/tls/certs/ca.pem file.
Procedure
ap_scan=0
network={
eap=TTLS
eapol_flags=0
key_mgmt=IEEE8021X
324
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
2. To authenticate to:
The -a option defines the IP address of the FreeRADIUS server, and the -s option specifies
the password for the host on which you run the command in the FreeRADIUS server’s client
configuration.
An authenticator, enter:
The -i option specifies the network interface name on which wpa_supplicant sends out
extended authentication protocol over LAN (EAPOL) packets.
Additional resources
/usr/share/doc/wpa_supplicant/wpa_supplicant.conf file
After you set up the hostapd service as an authenticator for 802.1X network authentication.
The output of the test utilities used in this procedure provide additional information about the EAP
communication and help you to debug problems.
325
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
A FreeRADIUS server:
The client, on which you run this procedure, has been authorized in the FreeRADIUS
server’s client databases.
You stored the certificate authority (CA) certificate in the /etc/pki/tls/certs/ca.pem file.
The CA that issued the client certificate is the same that issued the server certificate of the
FreeRADIUS server.
Procedure
ap_scan=0
network={
eap=TLS
eapol_flags=0
key_mgmt=IEEE8021X
identity="[email protected]"
client_cert="/etc/pki/tls/certs/client.pem"
private_key="/etc/pki/tls/private/client.key"
private_key_passwd="password_on_private_key"
2. To authenticate to:
The -a option defines the IP address of the FreeRADIUS server, and the -s option specifies
326
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
The -a option defines the IP address of the FreeRADIUS server, and the -s option specifies
the password for the host on which you run the command in the FreeRADIUS server’s client
configuration.
An authenticator, enter:
The -i option specifies the network interface name on which wpa_supplicant sends out
extended authentication protocol over LAN (EAPOL) packets.
Additional resources
/usr/share/doc/wpa_supplicant/wpa_supplicant.conf file
IMPORTANT
When the 802-1x-tr-mgmt systemd service starts, RHEL blocks all traffic on the listen port of hostapd
except extensible authentication protocol over LAN (EAPOL) packets and uses the hostapd_cli utility
to connect to the hostapd control interface. The /usr/local/bin/802-1x-tr-mgmt script then evaluates
events. Depending on the different events received by hostapd_cli, the script allows or blocks traffic
for MAC addresses. Note that, when the 802-1x-tr-mgmt service stops, all traffic is automatically
allowed again.
Prerequisites
The hostapd service has been configured, and the service is ready to authenticate clients.
Procedure
#!/bin/sh
if [ "x$1" == "xblock_all" ]
then
327
Red Hat Enterprise Linux 9 Configuring and managing networking
chain accesscontrol {
ether saddr @allowed_macs accept
ether daddr @allowed_macs accept
drop
}
chain forward {
type filter hook forward priority 0; policy accept;
meta ibrname "br0" jump accesscontrol
}
}
EOF
echo "802-1x-tr-mgmt Blocking all traffic through br0. Traffic for given host will be allowed
after 802.1x authentication"
fi
case ${2:-NOTANEVENT} in
AP-STA-DISCONNECTED | CTRL-EVENT-EAP-FAILURE)
nft delete element bridge tr-mgmt-br0 allowed_macs { $3 }
echo "802-1x-tr-mgmt $1: Denied traffic from $3"
;;
esac
[Unit]
Description=Example 802.1x traffic management for hostapd
After=hostapd.service
After=sys-devices-virtual-net-%i.device
[Service]
Type=simple
ExecStartPre=-/bin/sh -c '/usr/sbin/tc qdisc del dev %i ingress > /dev/null 2>&1'
328
AN 802.1X NETWORK AUTHENTICATION SERVICE FOR LAN CLIENTS BY USING HOSTAPD WITH FREERADIUS BACKEND
[Install]
WantedBy=multi-user.target
3. Reload systemd:
# systemctl daemon-reload
4. Enable and start the 802-1x-tr-mgmt service with the interface name hostapd is listening on:
Verification
Additional resources
329
Red Hat Enterprise Linux 9 Configuring and managing networking
NOTE
In case a connection is bound to a link speed, the usage of multiple links can increase the
connection throughput. Note, that in case of the connection is bound to a CPU, the usage of
multiple links causes the connection slowdown.
Additional resources
Understanding Multipath TCP: High availability for endpoints and the networking highway of the
future
Prerequisites
The following packages are installed:
iperf3
mptcpd
systemtap
Procedure
330
CHAPTER 35. GETTING STARTED WITH MULTIPATH TCP
2. Start the iperf3 server, and force it to create MPTCP sockets instead of TCP sockets:
3. Connect the client to the server, and force it to create MPTCP sockets instead of TCP sockets:
4. After the connection is established, verify the ss output to see the subflow-specific status:
# nstat MPTcp*
#kernel
MPTcpExtMPCapableSYNRX 2 0.0
MPTcpExtMPCapableSYNTX 2 0.0
MPTcpExtMPCapableSYNACKRX 2 0.0
MPTcpExtMPCapableACKRX 2 0.0
Additional resources
IMPORTANT
331
Red Hat Enterprise Linux 9 Configuring and managing networking
IMPORTANT
The configuration in this procedure will not persist after rebooting your machine.
Note that MPTCP does not yet support mixed IPv6 and IPv4 endpoints for the same socket. Use
endpoints belonging to the same address family.
Prerequisites
enp4s0: 192.0.2.1/24
enp1s0: 198.51.100.1/24
enp4s0f0: 192.0.2.2/24
enp4s0f1: 198.51.100.2/24
Procedure
1. Configure the client to accept up to 1 additional remote address, as provided by the server:
The signal option ensures that the ADD_ADDR packet is sent after the three-way-handshake.
3. Start the iperf3 server, and force it to create MPTCP sockets instead of TCP sockets:
4. Connect the client to the server, and force it to create MPTCP sockets instead of TCP sockets:
Verification
332
CHAPTER 35. GETTING STARTED WITH MULTIPATH TCP
# nstat MPTcp*
#kernel
MPTcpExtMPCapableSYNRX 2 0.0
MPTcpExtMPCapableACKRX 2 0.0
MPTcpExtMPJoinSynRx 2 0.0
MPTcpExtMPJoinAckRx 2 0.0
MPTcpExtEchoAdd 2 0.0
Additional resources
enp4s0: 192.0.2.1/24
enp1s0: 198.51.100.1/24
enp7s0: 192.0.2.3/24
enp4s0f0: 192.0.2.2/24
enp4s0f1: 198.51.100.2/24
enp6s0: 192.0.2.5/24
Prerequisites
Procedure
333
Red Hat Enterprise Linux 9 Configuring and managing networking
2. Optional: The RHEL kernel default for subflow limit is 2. If you require more:
[Unit]
Description=Set MPTCP subflow limit to 3
After=network.target
[Service]
ExecStart=ip mptcp limits set subflows 3
Type=oneshot
[Install]
WantedBy=multi-user.target
The oneshot unit executes the ip mptcp limits set subflows 3 command after your
network (network.target) is operational during every boot process.
The ip mptcp limits set subflows 3 command sets the maximum number of additional
subflows for each connection, so 4 in total. It is possible to add maximally 3 additional
subflows.
3. Enable MPTCP on all connection profiles that you want to use for connection aggregation:
By default, NetworkManager does not add MPTCP flags to IP addresses if there is no default
gateway. If you want to bypass that check, you need to use also the also-without-default-route
flag.
Verification
# sysctl net.mptcp.enabled
net.mptcp.enabled = 1
2. Verify that you set the subflow limit correctly, in case the default was not enough:
334
CHAPTER 35. GETTING STARTED WITH MULTIPATH TCP
Additional resources
nm-settings-nmcli(5)
ip-mptcp(8)
Understanding Multipath TCP: High availability for endpoints and the networking highway of the
future
The MPTCP protocol allows monitoring MPTCP-specific events related to socket and sub-flow creation
and deletion, using the ip utility provided by the iproute package. This utility uses the netlink interface
to monitor MPTCP events.
This procedure demonstrates how to monitor MPTCP events. For that, it simulates a MPTCP server
application, and a client connects to this service. The involved clients in this example use the following
interfaces and IP addresses:
Server: 192.0.2.1
To simplify this example, all interfaces are within the same subnet. This is not a requirement. However, it
is important that routing has been configured correctly, and the client can reach the server via both
interfaces.
Prerequisites
A RHEL client with two network interfaces, such as a laptop with Ethernet and WiFi
A RHEL server
335
Red Hat Enterprise Linux 9 Configuring and managing networking
Both the client and the server run RHEL 9.0 or later
You installed the mptcpd package on both the client and the server
Procedure
1. Set the per connection additional subflow limits to 1 on both client and server:
2. On the server, to simulate a MPTCP server application, start netcat (nc) in listen mode with
enforced MPTCP sockets instead of TCP sockets:
The -k option causes that nc does not close the listener after the first accepted connection.
This is required to demonstrate the monitoring of sub-flows.
3. On the client:
# ip -4 route
192.0.2.0/24 dev enp1s0 proto kernel scope link src 192.0.2.2 metric 100
192.0.2.0/24 dev wlp1s0 proto kernel scope link src 192.0.2.3 metric 600
The enp1s0 interface has a lower metric than wlp1s0. Therefore, RHEL uses enp1s0 by
default.
# ip mptcp monitor
RHEL uses the enp1s0 interface and its associated IP address as a source for this
connection.
The token identifies the MPTCP socket as an unique ID, and later it enables you to correlate
MPTCP events on the same socket.
d. On the terminal with the running nc connection to the server, press Enter. This first data
packet fully establishes the connection. Note that, as long as no data has been sent, the
connection is not established.
On the monitoring terminal, ip mptcp monitor now logs:
336
CHAPTER 35. GETTING STARTED WITH MULTIPATH TCP
At this point, only one connection to the server has been established.
This command sets the name and IP address of the WiFi interface of the client in this
command.
The locid field displays the local address ID of the new sub-flow and identifies this sub-flow
even if the connection uses network address translation (NAT). The saddr4 field matches
the endpoint’s IP address from the ip mptcp endpoint add command.
The connection with source address 192.0.2.2 corresponds to the first MPTCP sub-
flow that you established previously.
The connection from the sub-flow over the wlp1s0 interface with source address
192.0.2.3.
Use the ID from the locid field from the ip mptcp monitor output, or retrieve the endpoint
ID using the ip mptcp endpoint show command.
i. On the first terminal with the nc client, press Ctrl+C to terminate the session.
On the monitoring terminal, ip mptcp monitor now logs:
337
Red Hat Enterprise Linux 9 Configuring and managing networking
[ CLOSED] token=63c070d2
Additional resources
Procedure
Verification
338
CHAPTER 36. MANAGING THE MPTCPD SERVICE
Prerequisites
Procedure
# ip mptcp endpoint
Note, that the endpoint, which mptcpd service creates, lasts till the host shutdown.
Additional resources
The instruction below shows how to use the mptcpize tool to manage applications in the TCP
environment.
Assuming, you need to run the iperf3 utility with the enabled MPTCP socket. You can achieve this goal
339
Red Hat Enterprise Linux 9 Configuring and managing networking
Assuming, you need to run the iperf3 utility with the enabled MPTCP socket. You can achieve this goal
by following the procedure below.
Prerequisites
Procedure
Assuming, you need to manage mptcp socket for the nginx service. You can achieve this goal by
following the procedure below.
Prerequisites
Procedure
340
CHAPTER 37. NETWORKMANAGER CONNECTION PROFILES IN KEYFILE FORMAT
[connection]
id=example_connection
uuid=82c6272d-1ff7-4d56-9c7c-0eb27c300029
type=ethernet
autoconnect=true
[ipv4]
method=auto
[ipv6]
method=auto
[ethernet]
mac-address=00:53:00:8f:fa:66
WARNING
Use the nmcli utility, the network RHEL system role, or the nmstate API to
manage NetworkManager connections. For example, you can use the nmcli utility in
offline mode to create connection profiles.
Each section corresponds to a NetworkManager setting name as described in the nm-settings(5) and
nm-settings-keyfile(5) man pages. Each key-value-pair in a section is one of the properties listed in the
settings specification of the man page.
Most variables in NetworkManager keyfiles have a one-to-one mapping. This means that a
NetworkManager property is stored in the keyfile as a variable of the same name and in the same
format. However, there are exceptions, mainly to make the keyfile syntax easier to read. For a list of
these exceptions, see the nm-settings-keyfile(5) man page.
IMPORTANT
341
Red Hat Enterprise Linux 9 Configuring and managing networking
IMPORTANT
For security reasons, because connection profiles can contain sensitive information, such
as private keys and passphrases, NetworkManager uses only configuration files owned by
the root user and that are only readable and writable by root.
Depending on the purpose of the connection profile, save it in one of the following directories:
NetworkManager does not automatically reload profiles from disk. When you create or update a
connection profile in keyfile format, use the nmcli connection reload command to inform
NetworkManager about the changes.
The offline mode ensures that nmcli operates without the NetworkManager service to produce keyfile
connection profiles through standard output. This feature can be useful if:
You want to create your connection profiles that need to be pre-deployed somewhere. For
example in a container image, or as an RPM package.
You want to create your connection profiles in an environment where the NetworkManager
service is not available. For example when you want to use the chroot utility. Alternatively, when
you want to create or modify the network configuration of the RHEL system to be installed
through the Kickstart %post script.
network bond
network bridge
Procedure
1. Create a new connection profile in the keyfile format. For example, for a connection profile of an
342
CHAPTER 37. NETWORKMANAGER CONNECTION PROFILES IN KEYFILE FORMAT
1. Create a new connection profile in the keyfile format. For example, for a connection profile of an
Ethernet device that does not use DHCP, run a similar nmcli command:
NOTE
The connection name you specified with the con-name key is saved into the id
variable of the generated profile. When you use the nmcli command to manage
this connection later, specify the connection as follows:
When the id variable is not omitted, use the connection name, for example
Example-Connection.
When the id variable is omitted, use the file name without the
.nmconnection suffix, for example output.
2. Set permissions to the configuration file so that only the root user can read and update it:
4. If you set the autoconnect variable in the profile to false, activate the connection:
Verification
2. Verify that NetworkManager can read the profile from the configuration file:
If the output does not show the newly created connection, verify that the keyfile permissions
343
Red Hat Enterprise Linux 9 Configuring and managing networking
If the output does not show the newly created connection, verify that the keyfile permissions
and the syntax you used are correct.
Additional resources
nmcli(1)
nm-settings-keyfile(5)
NOTE
Manually creating or updating the configuration files can result in an unexpected or non-
functional network configuration. As an alternative, you can use nmcli in offline mode.
See Using nmcli to create keyfile connection profiles in offline mode
Procedure
1. If you create a profile for a hardware interface, such as Ethernet, display the MAC address of this
interface:
2. Create a connection profile. For example, for a connection profile of an Ethernet device that
uses DHCP, create the /etc/NetworkManager/system-connections/example.nmconnection
file with the following content:
344
CHAPTER 37. NETWORKMANAGER CONNECTION PROFILES IN KEYFILE FORMAT
[connection]
id=example_connection
type=ethernet
autoconnect=true
[ipv4]
method=auto
[ipv6]
method=auto
[ethernet]
mac-address=00:53:00:8f:fa:66
NOTE
You can use any file name with a .nmconnection suffix. However, when you later
use nmcli commands to manage the connection, you must use the connection
name set in the id variable when you refer to this connection. When you omit the
id variable, use the file name without the .nmconnection to refer to this
connection.
3. Set permissions on the configuration file so that only the root user can read and update it:
5. Verify that NetworkManager read the profile from the configuration file:
If the command does not show the newly added connection, verify that the file permissions and
the syntax you used in the file are correct.
6. If you set the autoconnect variable in the profile to false, activate the connection:
Verification
345
Red Hat Enterprise Linux 9 Configuring and managing networking
Additional resources
nm-settings-keyfile (5)
3. If the value set in the variable matches the MAC address of an interface, the helper utility
renames the interface to the name set in the DEVICE parameter of the file.
Additional resources
NOTE
Prerequisites
If the connection profiles contain a DEVICE variable that is set to a custom device name, such
346
CHAPTER 37. NETWORKMANAGER CONNECTION PROFILES IN KEYFILE FORMAT
If the connection profiles contain a DEVICE variable that is set to a custom device name, such
as provider or lan, you created a systemd link file or a udev rule for each of the custom device
names.
Procedure
Verification
Optionally, you can verify that you successfully migrated all your connection profiles:
Additional resources
nm-settings-keyfile(5)
nm-settings-ifcfg-rh(5)
347
Red Hat Enterprise Linux 9 Configuring and managing networking
RHEL uses the network and network-online targets and the NetworkManager-wait-online service
while applying network settings. Also, you can configure systemd services to start after the network is
fully available if these services cannot dynamically reload.
The network-online target starts a service, which adds substantial delays to further execution. Systemd
automatically adds dependencies with Wants and After parameters for this target unit to all the System
V (SysV) init script service units with a Linux Standard Base (LSB) header referring to the $network
facility. The LSB header is metadata for init scripts. You can use it to specify dependencies. This is
similar to the systemd target.
The network target does not significantly delay the execution of the boot process. Reaching the
network target means that the service that is responsible for setting up the network has started.
However, it does not mean that a network device was configured. This target is important during the
shutdown of the system. For example, if you have a service that was ordered after the network target
during bootup, then this dependency is reversed during the shutdown. The network does not get
disconnected until your service has been stopped. All mount units for remote network file systems
automatically start the network-online target unit and order themselves after it.
NOTE
The network-online target unit is only useful during the system starts. After the system
has completed booting up, this target does not track the online state of the network.
Therefore, you cannot use network-online to monitor the network connection. This
target provides a one-time system startup concept.
When the startup completes, either all profiles are in a disconnected state or are successfully activated.
You can configure profiles to auto-connect. The following are a few examples of parameters that set
timeouts or define when the connection is considered active:
348
CHAPTER 38. SYSTEMD NETWORK TARGETS AND SERVICES
connection.wait-device-timeout - sets the timeout for the driver to detect the device
ipv4.may-fail and ipv6.may-fail - sets activation with one IP address family ready, or whether a
particular address family must have completed configuration.
Additional resources
Procedure
[Unit]
After=network-online.target
# systemctl daemon-reload
349
Red Hat Enterprise Linux 9 Configuring and managing networking
Supports atomic and transactional operations at the host and cluster level
Supports partial editing of most properties and preserves existing settings that are not specified
in the instructions
import libnmstate
Note that you must install the nmstate package to use this library.
Example 39.1. Querying the network state using the libnmstate library
The following Python code imports the libnmstate library and displays the available network
interfaces and their state:
import json
import libnmstate
from libnmstate.schema import Interface
net_state = libnmstate.show()
for iface_state in net_state[Interface.KEY]:
print(iface_state[Interface.NAME] + ": "
+ iface_state[Interface.STATE])
You can use the nmstatectl utility to store the current network configuration of one or all interfaces in a
file. You can then use this file to:
Copy the file to a different host and configure the host with the same or modified settings.
For example, you can export the settings of the enp1s0 interface to a file, modify the configuration, and
350
CHAPTER 39. INTRODUCTION TO NMSTATE
For example, you can export the settings of the enp1s0 interface to a file, modify the configuration, and
apply the settings to the host.
Prerequisites
Procedure
This command stores the configuration of enp1s0 in YAML format. To store the output in
JSON format, pass the --json option to the command.
If you do not specify an interface name, nmstatectl exports the configuration of all interfaces.
2. Modify the ~/network-config.yml file using a text editor to update the configuration.
If you exported the settings in JSON format, pass the --json option to the command.
With the nmstate package installed, you can store *.yml files with Nmstate instructions in the
/etc/nmstate/ directory. The nmstate service then automatically applies the files on the next reboot or
when you manually restart the service. After Nmstate successfully applies a file, it renames the file’s .yml
suffix to .applied to prevent the service from processing the same file again.
The nmstate service is a oneshot systemd service. Consequently, systemd executes it only when the
system boots and when you manually restart the service.
NOTE
By default, the nmstate service is disabled. Use the systemctl enable nmstate
command to enable it. Afterwards, systemd executes this service each time when the
system starts.
Using the declarative method with the state configurations, you can configure interfaces, and
the NetworkManager creates a profile for these interfaces in the background.
351
Red Hat Enterprise Linux 9 Configuring and managing networking
With the network_state variable, you can specify the options that you require to change, and all
the other options will remain the same as they are. However, with the network_connections
variable, you must specify all settings to change the network connection profile.
For example, to create an Ethernet connection with dynamic IP address settings, use the following vars
block in your playbook:
vars: vars:
network_state: network_connections:
interfaces: - name: enp7s0
- name: enp7s0 interface_name: enp7s0
type: ethernet type: ethernet
state: up autoconnect: yes
ipv4: ip:
enabled: true dhcp4: yes
auto-dns: true auto6: yes
auto-gateway: true state: up
auto-routes: true
dhcp: true
ipv6:
enabled: true
auto-dns: true
auto-gateway: true
auto-routes: true
autoconf: true
dhcp: true
For example, to only change the connection status of dynamic IP address settings that you created as
above, use the following vars block in your playbook:
vars: vars:
network_state: network_connections:
interfaces: - name: enp7s0
- name: enp7s0 interface_name: enp7s0
type: ethernet type: ethernet
state: down autoconnect: yes
ip:
dhcp4: yes
auto6: yes
state: down
Additional resources
/usr/share/ansible/roles/rhel-system-roles.network/README.md file
352
CHAPTER 39. INTRODUCTION TO NMSTATE
/usr/share/doc/rhel-system-roles/network/ directory
/usr/share/doc/nmstate/examples/
353
Red Hat Enterprise Linux 9 Configuring and managing networking
You can use xdpdump to debug XDP programs that are already attached to an interface. Therefore, the
utility can capture packets before an XDP program is started and after it has finished. In the latter case,
xdpdump also captures the XDP action. By default, xdpdump captures incoming packets at the entry
of the XDP program.
IMPORTANT
On other architectures than AMD and Intel 64-bit, the xdpdump utility is provided as a
Technology Preview only. Technology Preview features are not supported with Red Hat
production Service Level Agreements (SLAs), might not be functionally complete, and
Red Hat does not recommend using them for production. These previews provide early
access to upcoming product features, enabling customers to test functionality and
provide feedback during the development process.
See Technology Preview Features Support Scope on the Red Hat Customer Portal for
information about the support scope for Technology Preview features.
Note that xdpdump has no packet filter or decode capabilities. However, you can use it in combination
with tcpdump for packet decoding.
Prerequisites
An XDP program is loaded to the enp1s0 interface. If no program is loaded, xdpdump captures
packets in a similar way tcpdump does, for backward compatibility.
Procedure
1. To capture packets on the enp1s0 interface and write them to the /root/capture.pcap file,
enter:
Additional resources
If you are a developer and you are interested in the source code of xdpdump, download and
354
CHAPTER 40. CAPTURING NETWORK PACKETS
If you are a developer and you are interested in the source code of xdpdump, download and
install the corresponding source RPM (SRPM) from the Red Hat Customer Portal.
355
Red Hat Enterprise Linux 9 Configuring and managing networking
In networking, you can use eBPF to complement or replace kernel packet processing. Depending on the
hook you use, eBPF programs have, for example:
eXpress Data Path (XDP): Provides early access to received packets before the kernel
networking stack processes them.
tc eBPF classifier with direct-action flag: Provides powerful packet processing on ingress and
egress.
Control Groups version 2 (cgroup v2): Enables filtering and overriding socket-based operations
performed by programs in a control group.
Socket filtering: Enables filtering of packets received from sockets. This feature was also
available in the classic Berkeley Packet Filter (cBPF), but has been extended to support eBPF
programs.
Stream parser: Enables splitting up streams to individual messages, filtering, and redirecting
them to sockets.
Flow dissector: Enables overriding the way the kernel parses packet headers in certain
situations.
TCP congestion control callbacks: Enables implementing a custom TCP congestion control
algorithm.
XDP
You can attach programs of the BPF_PROG_TYPE_XDP type to a network interface. The kernel then
executes the program on received packets before the kernel network stack starts processing them. This
allows fast packet forwarding in certain situations, such as fast packet dropping to prevent distributed
denial of service (DDoS) attacks and fast packet redirects for load balancing scenarios.
356
CHAPTER 41. UNDERSTANDING THE EBPF NETWORKING FEATURES IN RHEL 9
You can also use XDP for different forms of packet monitoring and sampling. The kernel allows XDP
programs to modify packets and to pass them for further processing to the kernel network stack.
Native (driver) XDP: The kernel executes the program from the earliest possible point during
packet reception. At this moment, the kernel did not parse the packet and, therefore, no
metadata provided by the kernel is available. This mode requires that the network interface
driver supports XDP but not all drivers support this native mode.
Generic XDP: The kernel network stack executes the XDP program early in the processing. At
that time, kernel data structures have been allocated, and the packet has been pre-processed. If
a packet should be dropped or redirected, it requires a significant overhead compared to the
native mode. However, the generic mode does not require network interface driver support and
works with all network interfaces.
Offloaded XDP: The kernel executes the XDP program on the network interface instead of on
the host CPU. Note that this requires specific hardware, and only certain eBPF features are
available in this mode.
On RHEL, load all XDP programs using the libxdp library. This library enables system-controlled usage
of XDP.
NOTE
Currently, there are some system configuration limitations for XDP programs. For
example, you must disable certain hardware offload features on the receiving interface.
Additionally, not all features are available with all drivers that support the native mode.
In RHEL 9, Red Hat supports the XDP features only if you use the libxdp library to load the program
into the kernel.
AF_XDP
Using an XDP program that filters and redirects packets to a given AF_XDP socket, you can use one or
more sockets from the AF_XDP protocol family to quickly copy packets from the kernel to the user
space.
Traffic Control
The Traffic Control (tc) subsystem offers the following types of eBPF programs:
BPF_PROG_TYPE_SCHED_CLS
BPF_PROG_TYPE_SCHED_ACT
These types enable you to write custom tc classifiers and tc actions in eBPF. Together with the parts of
the tc ecosystem, this provides the ability for powerful packet processing and is the core part of several
container networking orchestration solutions.
In most cases, only the classifier is used, as with the direct-action flag, the eBPF classifier can execute
actions directly from the same eBPF program. The clsact Queueing Discipline (qdisc) has been
designed to enable this on the ingress side.
Note that using a flow dissector eBPF program can influence operation of some other qdiscs and tc
classifiers, such as flower.
Socket filter
357
Red Hat Enterprise Linux 9 Configuring and managing networking
Several utilities use or have used the classic Berkeley Packet Filter (cBPF) for filtering packets received
on a socket. For example, the tcpdump utility enables the user to specify expressions, which tcpdump
then translates into cBPF code.
Control Groups
In RHEL, you can use multiple types of eBPF programs that you can attach to a cgroup. The kernel
executes these programs when a program in the given cgroup performs an operation. Note that you can
use only cgroups version 2.
BPF_PROG_TYPE_SOCK_OPS: The kernel calls this program on various TCP events. The
program can adjust the behavior of the kernel TCP stack, including custom TCP header options,
and so on.
Stream Parser
A stream parser operates on a group of sockets that are added to a special eBPF map. The eBPF
program then processes packets that the kernel receives or sends on those sockets.
BPF_PROG_TYPE_SK_SKB: An eBPF program parses packets received from the socket into
individual messages, and instructs the kernel to drop those messages or send them to another
socket in the group.
Flow dissector
When the kernel needs to process packet headers without going through the full protocol decode, they
358
CHAPTER 41. UNDERSTANDING THE EBPF NETWORKING FEATURES IN RHEL 9
are dissected. For example, this happens in the tc subsystem, in multipath routing, in bonding, or when
calculating a packet hash. In this situation the kernel parses the packet headers and fills internal
structures with the information from the packet headers. You can replace this internal parsing using the
BPF_PROG_TYPE_FLOW_DISSECTOR program. Note that you can only dissect TCP and UDP over
IPv4 and IPv6 in eBPF in RHEL.
BPF_PROG_TYPE_LWT_IN
BPF_PROG_TYPE_LWT_OUT
BPF_PROG_TYPE_LWT_XMIT
The functionality of such an eBPF program is limited to specific tunnel configurations and does not allow
creating a generic encapsulation or decapsulation solution.
Socket lookup
To bypass limitations of the bind system call, use an eBPF program of the
BPF_PROG_TYPE_SK_LOOKUP type. Such programs can select a listening socket for new incoming
TCP connections or an unconnected socket for UDP packets.
359
Red Hat Enterprise Linux 9 Configuring and managing networking
Intel® 10GbE PCI Express adapters ixgbe yes yes yes no yes yes
[a] [b]
Intel® Ethernet Connection E800 ice yes yes yes no yes yes
Series [a]
Intel® Ethernet Controller I225- igc yes yes yes no yes yes
LM/I225-V family [b]
Intel® PCI Express Gigabit adapters igb yes yes yes no no yes
[a] [b]
Mellanox 5th generation network mlx5_core yes yes yes no yes yes
adapters (ConnectX series) [c]
360
CHAPTER 41. UNDERSTANDING THE EBPF NETWORKING FEATURES IN RHEL 9
[b] Transmitting side only. Cannot receive large packets through XDP.
[c] Requires several XDP TX queues allocated that is larger or equal to the largest CPU index.
[d] Some of the listed features are not available for the Netronome® NFP3800 NIC.
Legend:
Basic: Supports basic return codes: DROP, PASS, ABORTED, and TX.
Zero-copy: Supports the zero-copy mode for the AF_XDP protocol family.
361
Red Hat Enterprise Linux 9 Configuring and managing networking
BCC removes the need for users to know deep technical details of eBPF, and provides many out-of-
the-box starting points, such as the bcc-tools package with pre-created eBPF programs.
NOTE
The eBPF programs are triggered on events, such as disk I/O, TCP connections, and
process creations. It is unlikely that the programs should cause the kernel to crash, loop or
become unresponsive because they run in a safe virtual machine in the kernel.
Procedure
1. Install bcc-tools.
# ll /usr/share/bcc/tools/
...
-rwxr-xr-x. 1 root root 4198 Dec 14 17:53 dcsnoop
-rwxr-xr-x. 1 root root 3931 Dec 14 17:53 dcstat
-rwxr-xr-x. 1 root root 20040 Dec 14 17:53 deadlock_detector
-rw-r--r--. 1 root root 7105 Dec 14 17:53 deadlock_detector.c
drwxr-xr-x. 3 root root 8192 Mar 11 10:28 doc
-rwxr-xr-x. 1 root root 7588 Dec 14 17:53 execsnoop
-rwxr-xr-x. 1 root root 6373 Dec 14 17:53 ext4dist
-rwxr-xr-x. 1 root root 10401 Dec 14 17:53 ext4slower
...
The doc directory in the listing above contains documentation for each tool.
The tcpaccept utility uses eBPF features to display all connections the kernel adds to the accept
362
CHAPTER 42. NETWORK TRACING USING THE BPF COMPILER COLLECTION
queue. The utility is lightweight because it traces the accept() function of the kernel instead of
capturing packets and filtering them. For example, use tcpaccept for general troubleshooting to display
new connections the server has accepted.
Procedure
1. Enter the following command to start the tracing the kernel accept queue:
# /usr/share/bcc/tools/tcpaccept
PID COMM IP RADDR RPORT LADDR LPORT
843 sshd 4 192.0.2.17 50598 192.0.2.1 22
1107 ns-slapd 4 198.51.100.6 38772 192.0.2.1 389
1107 ns-slapd 4 203.0.113.85 38774 192.0.2.1 389
...
Each time the kernel accepts a connection, tcpaccept displays the details of the connections.
Additional resources
/usr/share/bcc/tools/doc/tcpaccept_example.txt file
The tcpconnect utility is lightweight because it traces, for example, the connect() function of the kernel
instead of capturing packets and filtering them.
Procedure
1. Enter the following command to start the tracing process that displays all outgoing connections:
# /usr/share/bcc/tools/tcpconnect
PID COMM IP SADDR DADDR DPORT
31346 curl 4 192.0.2.1 198.51.100.16 80
31348 telnet 4 192.0.2.1 203.0.113.231 23
31361 isc-worker00 4 192.0.2.1 192.0.2.254 53
...
Each time the kernel processes an outgoing connection, tcpconnect displays the details of the
connections.
Additional resources
/usr/share/bcc/tools/doc/tcpconnect_example.txt file
363
Red Hat Enterprise Linux 9 Configuring and managing networking
The tcpconnlat utility uses eBPF features to measure the time between a sent SYN packet and the
received response packet.
Procedure
# /usr/share/bcc/tools/tcpconnlat
PID COMM IP SADDR DADDR DPORT LAT(ms)
32151 isc-worker00 4 192.0.2.1 192.0.2.254 53 0.60
32155 ssh 4 192.0.2.1 203.0.113.190 22 26.34
32319 curl 4 192.0.2.1 198.51.100.59 443 188.96
...
Each time the kernel processes an outgoing connection, tcpconnlat displays the details of the
connection after the kernel receives the response packet.
Additional resources
/usr/share/bcc/tools/doc/tcpconnlat_example.txt file
Instead of capturing and filtering packets, which is resource-intensive, the tcpdrop utility uses eBPF
features to retrieve the information directly from the kernel.
Procedure
1. Enter the following command to start displaying details about dropped TCP packets and
segments:
# /usr/share/bcc/tools/tcpdrop
TIME PID IP SADDR:SPORT > DADDR:DPORT STATE (FLAGS)
13:28:39 32253 4 192.0.2.85:51616 > 192.0.2.1:22 CLOSE_WAIT (FIN|ACK)
b'tcp_drop+0x1'
b'tcp_data_queue+0x2b9'
...
364
CHAPTER 42. NETWORK TRACING USING THE BPF COMPILER COLLECTION
b'tcp_drop+0x1'
b'tcp_rcv_state_process+0xe2'
...
Each time the kernel drops TCP packets and segments, tcpdrop displays the details of the
connection, including the kernel stack trace that led to the dropped package.
Additional resources
/usr/share/bcc/tools/doc/tcpdrop_example.txt file
For example, you can display connections to port 22 (SSH) to retrieve the following information:
Procedure
1. Enter the following command to start the tracing of connections to the local port 22:
/usr/share/bcc/tools/tcplife -L 22
PID COMM LADDR LPORT RADDR RPORT TX_KB RX_KB MS
19392 sshd 192.0.2.1 22 192.0.2.17 43892 53 52 6681.95
19431 sshd 192.0.2.1 22 192.0.2.245 43902 81 249381 7585.09
19487 sshd 192.0.2.1 22 192.0.2.121 43970 6998 7 16740.35
...
Each time a connection is closed, tcplife displays the details of the connections.
Additional resources
/usr/share/bcc/tools/doc/tcplife_example.txt file
365
Red Hat Enterprise Linux 9 Configuring and managing networking
The utility uses eBPF features and, therefore, has a very low overhead.
Procedure
# /usr/share/bcc/tools/tcpretrans
TIME PID IP LADDR:LPORT T> RADDR:RPORT STATE
00:23:02 0 4 192.0.2.1:22 R> 198.51.100.0:26788 ESTABLISHED
00:23:02 0 4 192.0.2.1:22 R> 198.51.100.0:26788 ESTABLISHED
00:45:43 0 4 192.0.2.1:22 R> 198.51.100.0:17634 ESTABLISHED
...
Each time the kernel calls the TCP retransmit function, tcpretrans displays the details of the
connection.
Additional resources
/usr/share/bcc/tools/doc/tcpretrans_example.txt file
Procedure
# /usr/share/bcc/tools/tcpstates
SKADDR C-PID C-COMM LADDR LPORT RADDR RPORT OLDSTATE ->
NEWSTATE MS
ffff9cd377b3af80 0 swapper/1 0.0.0.0 22 0.0.0.0 0 LISTEN -> SYN_RECV
0.000
ffff9cd377b3af80 0 swapper/1 192.0.2.1 22 192.0.2.45 53152 SYN_RECV ->
ESTABLISHED 0.067
ffff9cd377b3af80 818 sssd_nss 192.0.2.1 22 192.0.2.45 53152 ESTABLISHED ->
CLOSE_WAIT 65636.773
ffff9cd377b3af80 1432 sshd 192.0.2.1 22 192.0.2.45 53152 CLOSE_WAIT ->
LAST_ACK 24.409
ffff9cd377b3af80 1267 pulseaudio 192.0.2.1 22 192.0.2.45 53152 LAST_ACK ->
CLOSE 0.376
...
Each time a connection changes its state, tcpstates displays a new line with updated connection
366
CHAPTER 42. NETWORK TRACING USING THE BPF COMPILER COLLECTION
Each time a connection changes its state, tcpstates displays a new line with updated connection
details.
If multiple connections change their state at the same time, use the socket address in the first
column (SKADDR) to determine which entries belong to the same connection.
Additional resources
/usr/share/bcc/tools/doc/tcpstates_example.txt file
127.0.0.1/32
10.0.0.0/8
172.16.0.0/12
192.0.2.0/24/16
0.0.0.0/0
Note that the last subnet (0.0.0.0/0) is a catch-all option. The tcpsubnet utility counts all traffic for
subnets different than the first four in this catch-all entry.
Follow the procedure to count the traffic for the 192.0.2.0/24 and 198.51.100.0/24 subnets. Traffic to
other subnets will be tracked in the 0.0.0.0/0 catch-all subnet entry.
Procedure
1. Start monitoring the amount of traffic send to the 192.0.2.0/24, 198.51.100.0/24, and other
subnets:
# /usr/share/bcc/tools/tcpsubnet 192.0.2.0/24,198.51.100.0/24,0.0.0.0/0
Tracing... Output every 1 secs. Hit Ctrl-C to end
[02/21/20 10:04:50]
192.0.2.0/24 856
198.51.100.0/24 7467
[02/21/20 10:04:51]
192.0.2.0/24 1200
198.51.100.0/24 8763
0.0.0.0/0 673
...
367
Red Hat Enterprise Linux 9 Configuring and managing networking
This command displays the traffic in bytes for the specified subnets once per second.
Additional resources
/usr/share/bcc/tools/doc/tcpsubnet.txt file
Procedure
# /usr/share/bcc/tools/tcptop
13:46:29 loadavg: 0.10 0.03 0.01 1/215 3875
The output of the command includes only active TCP connections. If the local or remote system
closes a connection, the connection is no longer visible in the output.
Additional resources
/usr/share/bcc/tools/doc/tcptop.txt file
Procedure
# /usr/share/bcc/tools/tcptracer
Tracing TCP established connections. Ctrl-C to end.
T PID COMM IP SADDR DADDR SPORT DPORT
A 1088 ns-slapd 4 192.0.2.153 192.0.2.1 0 65535
368
CHAPTER 42. NETWORK TRACING USING THE BPF COMPILER COLLECTION
Each time the kernel connects, accepts, or closes a connection, tcptracer displays the details of
the connections.
Additional resources
/usr/share/bcc/tools/doc/tcptracer_example.txt file
Procedure
1. Enter the following command to start the tracing process that displays all listen TCP attempts:
# /usr/share/bcc/tools/solisten
PID COMM PROTO BACKLOG PORT ADDR
3643 nc TCPv4 1 4242 0.0.0.0
3659 nc TCPv6 1 4242 2001:db8:1::1
4221 redis-server TCPv6 128 6379 ::
4221 redis-server TCPv4 128 6379 0.0.0.0
....
Additional resources
/usr/share/bcc/tools/doc/solisten_example.txt file
Procedure
1. Enter the following command to start the tracing soft irq event time:
# /usr/share/bcc/tools/softirqs
Tracing soft irq event time... Hit Ctrl-C to end.
^C
369
Red Hat Enterprise Linux 9 Configuring and managing networking
SOFTIRQ TOTAL_usecs
tasklet 166
block 9152
net_rx 12829
rcu 53140
sched 182360
timer 306256
Additional resources
/usr/share/bcc/tools/doc/softirqs_example.txt file
To generate these statistics, netqtop traces the kernel functions that perform events of transmitted
packets net_dev_start_xmit and received packets netif_receive_skb.
Procedure
1. Display the number of packets within the range of bytes size of the time interval of 2 seconds:
# /usr/share/bcc/tools/netqtop -n enp1s0 -i 2
RX
QueueID avg_size [0, 64) [64, 512) [512, 2K) [2K, 16K) [16K, 64K)
0 38.0 1 0 0 0 0
Total 38.0 1 0 0 0 0
-----------------------------------------------------------------------------
Fri Jan 31 18:08:57 2023
TX
QueueID avg_size [0, 64) [64, 512) [512, 2K) [2K, 16K) [16K, 64K)
370
CHAPTER 42. NETWORK TRACING USING THE BPF COMPILER COLLECTION
0 0 0 0 0 0 0
Total 0 0 0 0 0 0
RX
QueueID avg_size [0, 64) [64, 512) [512, 2K) [2K, 16K) [16K, 64K)
0 38.0 1 0 0 0 0
Total 38.0 1 0 0 0 0
-----------------------------------------------------------------------------
Additional resources
/usr/share/bcc/tools/doc/netqtop_example.txt
371
Red Hat Enterprise Linux 9 Configuring and managing networking
You can enable this mode for any kind of network device, except InfiniBand.
Procedure
1. Optional: Display the network interfaces to identify the one for which you want to receive all
traffic:
# ip address show
1: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state
DOWN group default qlen 1000
link/ether 98:fa:9b:a4:34:09 brd ff:ff:ff:ff:ff:ff
...
Verification
372
CHAPTER 43. CONFIGURING NETWORK DEVICES TO ACCEPT TRAFFIC FROM ALL MAC ADDRESSES
The PROMISC flag in the device description indicates that the mode is enabled.
Procedure
1. Optional: Display the network interfaces to identify the one for which you want to receive all
traffic:
# ip address show
1: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state
DOWN group default qlen 1000
link/ether 98:fa:9b:a4:34:09 brd ff:ff:ff:ff:ff:ff
...
Verification
373
Red Hat Enterprise Linux 9 Configuring and managing networking
Prerequisites
The enp1s0.yml file that you used to configure the device is available.
Procedure
1. Edit the existing enp1s0.yml file for the enp1s0 connection and add the following content to it:
---
interfaces:
- name: enp1s0
type: ethernet
state: up
accept -all-mac-address: true
Verification
Additional resources
/usr/share/doc/nmstate/examples/ directory
374
CHAPTER 44. MIRRORING A NETWORK INTERFACE BY USING NMCLI
Network administrators can use port mirroring to replicate inbound and outbound network traffic being
communicated from one network device to another. Mirroring traffic of an interface can be helpful in the
following situations:
To detect an intrusion
Prerequisites
Procedure
1. Add a network connection profile that you want to mirror the network traffic from:
# nmcli connection add type ethernet ifname enp1s0 con-name enp1s0 autoconnect
no
2. Attach a prio qdisc to enp1s0 for the egress (outgoing) traffic with the 10: handle:
3. Add a qdisc for the ingress traffic, with the ffff: handle:
4. Add the following filters to match packets on the ingress and egress qdiscs, and to mirror them
to enp7s0:
# nmcli connection modify enp1s0 +tc.tfilter "parent ffff: matchall action mirred egress
mirror dev enp7s0"
# nmcli connection modify enp1s0 +tc.tfilter "parent 10: matchall action mirred egress
mirror dev enp7s0"
The matchall filter matches all packets, and the mirred action redirects packets to destination.
Verification
375
Red Hat Enterprise Linux 9 Configuring and managing networking
# tcpdump -i enp7s0
Additional resources
376
CHAPTER 45. USING NMSTATE-AUTOCONF TO AUTOMATICALLY CONFIGURE THE NETWORK STATE USING LLDP
IMPORTANT
See Technology Preview Features Support Scope on the Red Hat Customer Portal for
information about the support scope for Technology Preview features.
This procedure assumes the following scenario and that the switch broadcasts the VLAN settings using
LLDP:
The enp1s0 and enp2s0 interfaces of the RHEL server are connected to switch ports that are
configured with VLAN ID 100 and VLAN name prod-net.
The enp3s0 interface of the RHEL server is connected to a switch port that is configured with
VLAN ID 200 and VLAN name mgmt-net.
The nmstate-autoconf utility then uses this information to create the following interfaces on the server:
If you connect multiple network interfaces to different switch ports for which LLDP broadcasts the same
VLAN ID, nmstate-autoconf creates a bond with these interfaces and, additionally, configures the
common VLAN ID on top of it.
Prerequisites
377
Red Hat Enterprise Linux 9 Configuring and managing networking
Procedure
a. Create a YAML file, for example ~/enable-lldp.yml, with the following content:
interfaces:
- name: enp1s0
type: ethernet
lldp:
enabled: true
- name: enp2s0
type: ethernet
lldp:
enabled: true
- name: enp3s0
type: ethernet
lldp:
enabled: true
a. Optional, start a dry-run to display and verify the YAML configuration that nmstate-
autoconf generates:
# nmstate-autoconf -d enp1s0,enp2s0,enp3s0
---
interfaces:
- name: prod-net
type: vlan
state: up
vlan:
base-iface: bond100
id: 100
- name: mgmt-net
type: vlan
state: up
vlan:
base-iface: enp3s0
id: 200
- name: bond100
type: bond
state: up
link-aggregation:
mode: balance-rr
port:
- enp1s0
- enp2s0
378
CHAPTER 45. USING NMSTATE-AUTOCONF TO AUTOMATICALLY CONFIGURE THE NETWORK STATE USING LLDP
# nmstate-autoconf enp1s0,enp2s0,enp3s0
Next steps
If there is no DHCP server in your network that provides the IP settings to the interfaces,
configure them manual. For details, see:
Verification
Additional resources
379
Red Hat Enterprise Linux 9 Configuring and managing networking
NOTE
802-3-ethernet.auto-negotiate
802-3-ethernet.speed
802-3-ethernet.duplex
Procedure
You can use these values if you need to reset the parameters in case of any problems.
This command enables auto-negotiation and sets the speed of the connection to 10000 Mbit
full duplex.
Verification
Use the ethtool utility to verify the values of Ethernet interface enp1s0:
# ethtool enp1s0
380
CHAPTER 46. CONFIGURING 802.3 LINK SETTINGS
Additional resources
381
Red Hat Enterprise Linux 9 Configuring and managing networking
Administrators use DPDK, for example, in virtual machines to use Single Root I/O Virtualization (SR-
IOV) to reduce latencies and increase I/O throughput.
NOTE
Procedure
382
CHAPTER 48. GETTING STARTED WITH TIPC
Applications that are running in a high-available and dynamic cluster environment have special needs.
The number of nodes in a cluster can vary, routers can fail, and, due to load balancing considerations,
functionality can be moved to different nodes in the cluster. TIPC minimizes the effort by application
developers to deal with such situations, and maximizes the chance that they are handled in a correct and
optimal way. Additionally, TIPC provides a more efficient and fault-tolerant communication than general
protocols, such as TCP.
Ethernet
InfiniBand
UDP protocol
TIPC provides a reliable transfer of messages between TIPC ports, that are the endpoints of all TIPC
communication.
Procedure
383
Red Hat Enterprise Linux 9 Configuring and managing networking
tipc
2. Restart the systemd-modules-load service to load the module without rebooting the system:
Verification
1. Use the following command to verify that RHEL loaded the tipc module:
If the command shows no entry for the tipc module, RHEL failed to load it.
Additional resources
IMPORTANT
The commands configure the TIPC network only temporarily. To permanently configure
TIPC on a node, use the commands of this procedure in a script, and configure RHEL to
execute that script when the system boots.
Prerequisites
The tipc module has been loaded. For details, see Loading the tipc module when the system
boots
Procedure
1. Optional: Set a unique node identity, such as a UUID or the node’s host name:
The identity can be any unique string consisting of a maximum 16 letters and numbers.
2. Add a bearer. For example, to use Ethernet as media and enp0s1 device as physical bearer
device, enter:
3. Optional: For redundancy and better performance, attach further bearers using the command
from the previous step. You can configure up to three bearers, but not more than two on the
same media.
384
CHAPTER 48. GETTING STARTED WITH TIPC
4. Repeat all previous steps on each node that should join the TIPC network.
Verification
This output indicates that the link between bearer enp1s0 on node 5254006b74be and bearer
enp1s0 on node 525400df55d1 is up.
The two entries with service type 0 indicate that two nodes are members of this cluster.
The entry with service type 1 represents the built-in topology service tracking service.
The entry with service type 2 displays the link as seen from the issuing node. The range limit
3741353223 represents the peer endpoint’s address (a unique 32-bit hash value based on
the node identity) in decimal format.
Additional resources
For examples of how to use TIPC, clone the upstream GIT repository using the git clone
git://git.code.sf.net/p/tipc/tipcutils command. This repository contains the source code of
demos and test programs that use TIPC features. Note that this repository is not provided by
Red Hat.
/usr/share/doc/kernel-doc-<kernel_version>/Documentation/output/networking/tipc.html
provided by the kernel-doc package.
385
Red Hat Enterprise Linux 9 Configuring and managing networking
NOTE
On Red Hat Enterprise Linux On Demand and AWS golden images, nm-cloud-setup is
already enabled and no action is required.
Prerequisite
Procedure
2. Create and run the snap-in file for the nm-cloud-setup service:
It is important to either start the service explicitly or reboot the system to make
configuration settings effective.
b. Use the systemd snap-in file to configure the cloud provider in nm-cloud-setup. For
example, to use Amazon EC2, enter:
[Service]
Environment=NM_CLOUD_SETUP_EC2=yes
You can set the following environment variables to enable the cloud provide you use:
386
CHAPTER 49. AUTOMATICALLY CONFIGURING NETWORK INTERFACES IN PUBLIC CLOUDS USING NM-CLOUD-SETUP
# systemctl daemon-reload
Additional resources
IMDS runs on a link-local address 169.254.169.254 for providing access to native applications
on a RHEL EC2 instance.
After you have specified and configured IMDSv2 for each RHEL EC2 instance for applications
and users, you can no longer access IMDSv1.
By using IMDSv2, the RHEL EC2 instance maintains metadata without using the IAM role while
remaining accessible through the IAM role.
When the RHEL EC2 instance boots, the nm-cloud-setup utility automatically runs to fetch the
EC2 instance API access token for using the RHEL EC2 instance API.
NOTE
Use the IMDSv2 token as an HTTP header to check the details of the EC2 environment.
Additional resources
387
Red Hat Enterprise Linux 9 Configuring and managing networking
388