Networking Guide
Configuring and managing networks, network interfaces, and network services in RHEL 7
Abstract
Note
Part I. Before You Begin Copy linkLink copied to clipboard!
Chapter 1. Overview of Networking Topics Copy linkLink copied to clipboard!
1.1. Comparing IP to non-IP Networks Copy linkLink copied to clipboard!
Categories of Network Communication
- IP Networks
- Networks that communicate through Internet Protocol addresses. An IP network is implemented in the Internet and most internal networks. Ethernet, Cable Modems, DSL Modems, dial up modems, wireless networks, and VPN connections are typical examples.
- non-IP Networks
- Networks that are used to communicate through a lower layer rather than the transport layer. Note that these networks are rarely used. InfiniBand is a non-IP network, described in Chapter 13, Configure InfiniBand and RDMA Networks.
1.2. Comparing Static to Dynamic IP Addressing Copy linkLink copied to clipboard!
- Static IP addressing
- When a device is assigned a static IP address, the address does not change over time unless changed manually. It is recommended to use static
IPaddressing if you want:- To ensure network address consistency for servers such as
DNS, and authentication servers. - To use out-of-band management devices that work independently of other network infrastructure.
All the configuration tools listed in Section 3.1, “Selecting Network Configuration Methods” allow assigning staticIPaddresses manually. The nmcli tool is also suitable, described in Section 3.3.8, “Adding and Configuring a Static Ethernet Connection with nmcli” .For more information on automated configuration and management, see the OpenLMI chapter in the Red Hat Enterprise Linux 7 System Administrators Guide. The Red Hat Enterprise Linux 7 Installation Guide documents the use of a Kickstart file which can also be used for automating the assignment of network settings. - Dynamic IP addressing
- When a device is assigned a dynamic IP address, the address changes over time. For this reason, it is recommended for devices that connect to the network occasionally because IP address might be changed after rebooting the machine.Dynamic IP addresses are more flexible, easier to set up and administer. The dynamic host control protocol (DHCP) is a traditional method of dynamically assigning network configurations to hosts. See Section 14.1, “Why Use DHCP?” for more information. You can also use the nmcli tool, described in Section 3.3.7, “Adding and Configuring a Dynamic Ethernet Connection with nmcli” .
Note
There is no strict rule defining when to use static or dynamic IP address. It depends on user's needs, preferences and the network environment.By default, NetworkManager calls theDHCPclient, dhclient.
1.3. Configuring the DHCP Client Behavior Copy linkLink copied to clipboard!
DHCP client, dhclient by default.
Requesting an IP Address
DHCP connection is started, a dhcp client requests an IP address from a DHCP server. The time that a dhcp client waits for this request to be completed is 60 seconds by default. You can configure the ipv4.dhcp-timeout property using the nmcli tool or the IPV4_DHCP_TIMEOUT option in the /etc/sysconfig/network-scripts/ifcfg-ifname file. For example, using nmcli:
nmcli connection modify enp1s0 ipv4.dhcp-timeout 10
~]# nmcli connection modify enp1s0 ipv4.dhcp-timeout 10
ipv4.may-fail property:
- If
ipv4.may-failis set toyes(default), the state of the connection depends on IPv6 configuration:- If the IPv6 configuration is enabled and successful, the connection is activated, but the IPv4 configuration can never be retried again.
- If the IPv6 configuration is disabled or does not get configured, the connection fails.
- If
ipv4.may-failis set tonothe connection is deactivated. In this case:- If the
autoconnectproperty of the connection is enabled, NetworkManager retries to activate the connection as many times as set in theautoconnect-retriesproperty. The default is 4. - If the connection still cannot acquire the dhcp address, auto-activation fails.Note that after 5 minutes, the auto-connection process starts again and the dhcp client retries to acquire an address from the dhcp server.
Requesting a Lease Renewal
ipv4.dhcp-timeout property in seconds (default is 60) to get the lease. If you get a reply during your attempts, the process stops and you get your lease renewed.
- If
ipv4.may-failis set toyes(default) and IPv6 is successfully configured, the connection is activated and the dhcp client is restarted again every 2 minutes. - If
ipv4.may-failis set tono, the connection is deactivated. In this case, if the connection has theautoconnectproperty enabled, the connection is activated from scratch.
1.3.1. Making DHCPv4 Persistent Copy linkLink copied to clipboard!
ipv4.dhcp-timeout property either to the maximum for a 32-bit integer (MAXINT32), which is 2147483647, or to the infinity value:
nmcli connection modify enps1s0 ipv4.dhcp-timeout infinity
~]$ nmcli connection modify enps1s0 ipv4.dhcp-timeout infinity
IPADDR property in the /etc/sysconfig/network-scripts/ifcfg-enp1s0 configuration file or by using nmcli:
nmcli connection modify enp1s0 ipv4.address 192.168.122.88/24
~]$ nmcli connection modify enp1s0 ipv4.address 192.168.122.88/24
1.4. Setting the Wireless Regulatory Domain Copy linkLink copied to clipboard!
regulatory.bin file to keep its regulatory database information.
setregdomain utility sets the regulatory domain for your system. Setregdomain takes no arguments and is usually called through system script such as udev rather than manually by the administrator. If a country code look-up fails, the system administrator can define the COUNTRY environment variable in the /etc/sysconfig/regdomain file.
setregdomain(1)man page — Sets regulatory domain based on country code.crda(8)man page — Sends to the kernel a wireless regulatory domain for a given ISO or IEC 3166 alpha2.regulatory.bin(5)man page — Shows the Linux wireless regulatory database.iw(8)man page — Shows or manipulates wireless devices and their configuration.
1.5. Configuring netconsole Copy linkLink copied to clipboard!
netconsole kernel module enables to log kernel messages to another computer over the network.
netconsole, you need to have an rsyslog server that is properly configured on your network.
Procedure 1.1. Configuring an rsyslog server for netconsole
- Configure the
rsyslogddaemon to listen on the 514/udp port and receive messages from the network by uncommenting the following lines in theMODULESsection of the/etc/rsyslog.conffile:$ModLoad imudp $UDPServerRun 514
$ModLoad imudp $UDPServerRun 514Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the
rsyslogdservice for the changes to take effect:systemctl restart rsyslog
]# systemctl restart rsyslogCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that
rsyslogdis listening on the 514/udp port:netstat -l | grep syslog
]# netstat -l | grep syslog udp 0 0 0.0.0.0:syslog 0.0.0.0:* udp6 0 0 [::]:syslog [::]:*Copy to Clipboard Copied! Toggle word wrap Toggle overflow The0.0.0.0:syslogand[::]:syslogvalues in thenetstat -loutput mean thatrsyslogdis listening on defaultnetconsoleport defined in the/etc/servicesfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Netconsole is configured using the /etc/sysconfig/netconsole file, which is a part of the initscripts package. This package is installed by default and it also provides the netconsole service.
Procedure 1.2. Configuring a Sending Machine
- Set the value of the
SYSLOGADDRvariable in the/etc/sysconfig/netconsolefile to match the IP address of thesyslogdserver. For example:SYSLOGADDR=192.168.0.1
SYSLOGADDR=192.168.0.1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the
netconsoleservice for the changes to take effect:systemctl restart netconsole.service
]# systemctl restart netconsole.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Enable
netconsole.serviceto run after rebooting the system:systemctl enable netconsole.service
]# systemctl enable netconsole.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow - View the
netconsolemessages from the client in the/var/log/messagesfile (default) or in the file specified inrsyslog.conf.cat /var/log/messages
]# cat /var/log/messagesCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
rsyslogd and netconsole.service use port 514. To use a different port, change the following line in /etc/rsyslog.conf to the required port number:
$UDPServerRun <PORT>
$UDPServerRun <PORT>
/etc/sysconfig/netconsole file:
SYSLOGPORT=514
SYSLOGPORT=514
netconsole configuration and troubleshooting tips, see Netconsole Kernel Documentation.
1.6. Using Network Kernel Tunables with sysctl Copy linkLink copied to clipboard!
sysctl utility, you can adjust network configuration on a running system and directly affect the networking performance.
sysctl commands. For permanent changes that persist across system restarts, add lines to the /etc/sysctl.conf file.
sysctl parameters, enter as root:
sysctl -a
~]# sysctl -a
sysctl, see the Using PTP with Multiple Interfaces section in the System Administrator's Guide.
1.7. Managing Data Using the ncat utility Copy linkLink copied to clipboard!
IPv4 and IPv6, open connections, send packets, perform port scanning, and supports higher-level features such as SSL, and connection broker.
nc command can also be entered as ncat, using the identical options. For more information about the ncat options, see the New networking utility (ncat) section in the Migration Planning Guide and the ncat(1) man page.
Installing ncat
root:
yum install ncat
~]# yum install ncat
Brief Selection of ncat Use Cases
Example 1.1. Enabling Communication between a Client and a Server
- Set a client machine to listen for connections on TCP port 8080:
ncat -l 8080
~]$ ncat -l 8080Copy to Clipboard Copied! Toggle word wrap Toggle overflow - On a server machine, specify the IP address of the client and use the same port number:
ncat 10.0.11.60 8080
~]$ ncat 10.0.11.60 8080Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can send messages on either side of the connection and they appear on both local and remote machines. - Press
Ctrl+Dto close the TCP connection.
Note
nc commands with the –u option. For example:
ncat -u -l 8080
~]$ ncat -u -l 8080
Example 1.2. Sending Files
- On a client machine, to listen a specific port transferring a file to the server machine:
ncat -l 8080 > outputfile
~]$ ncat -l 8080 > outputfileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - On a server machine, specify the IP address of the client, the port and the file which is to be transferred:
ncat -l 10.0.11.60 8080 < inputfile
~]$ ncat -l 10.0.11.60 8080 < inputfileCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
ncat -l 8080 < inputfile
~]$ ncat -l 8080 < inputfile
ncat -l 10.0.11.60 8080 > outputfile
~]$ ncat -l 10.0.11.60 8080 > outputfile
Example 1.3. Creating an HTTP proxy server
ncat -l --proxy-type http localhost 8080
~]$ ncat -l --proxy-type http localhost 8080
Example 1.4. Port Scanning
–z option and specify a range of ports to scan:
ncat -z 10.0.11.60 80-90
~]$ ncat -z 10.0.11.60 80-90
Connection to 192.168.0.1 80 port [tcp/http] succeeded!
Example 1.5. Setting up Secure Client-Server Communication Using SSL
SSL on a server:
ncat -e /bin/bash -k -l 8080 --ssl
~]$ ncat -e /bin/bash -k -l 8080 --ssl
ncat --ssl 10.0.11.60 8080
~]$ ncat --ssl 10.0.11.60 8080
Note
SSL connection, the server requires the --ssl-cert and --ssl-key options, and the client requires the --ssl-verify and --ssl-trustfile options. For information on OpenSSL, see the Using OpenSSL section in the Security Guide.
Part II. Managing IP Networking Copy linkLink copied to clipboard!
Chapter 2. Getting Started with NetworkManager Copy linkLink copied to clipboard!
2.1. Overview of NetworkManager Copy linkLink copied to clipboard!
ifcfg type configuration files are still supported. See Section 2.6, “Using NetworkManager with Network Scripts” for more information.
2.1.1. Benefits of Using NetworkManager Copy linkLink copied to clipboard!
- Making Network management easier: NetworkManager ensures that network connectivity works. When it detects that there is no network configuration in a system but there are network devices, NetworkManager creates temporary connections to provide connectivity.
- Providing easy setup of connection to the user: NetworkManager offers management through different tools — GUI, nmtui, nmcli —. See Section 2.5, “NetworkManager Tools”.
- Supporting configuration flexibility. For example, configuring a WiFi interface, NetworkManager scans and shows the available wifi networks. You can select an interface, and NetworkManager displays the required credentials providing automatic connection after the reboot process. NetworkManager can configure network aliases, IP addresses, static routes, DNS information, and VPN connections, as well as many connection-specific parameters. You can modify the configuration options to reflect your needs.
- Offering an API through D-Bus which allows applications to query and control network configuration and state. In this way, applications can check or configure networking through D-BUS. For example, the
web consoleinterface, which monitors and configures servers through a web browser, uses the NetworkManager D-BUS interface to configure networking. - Maintaining the state of devices after the reboot process and taking over interfaces which are set into managed mode during restart.
- Handling devices which are not explicitly set unmanaged but controlled manually by the user or another network service.
2.2. Installing NetworkManager Copy linkLink copied to clipboard!
root:
yum install NetworkManager
~]# yum install NetworkManager
2.3. Checking the Status of NetworkManager Copy linkLink copied to clipboard!
systemctl status NetworkManager
~]$ systemctl status NetworkManager
NetworkManager.service - Network Manager
Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled)
Active: active (running) since Fri, 08 Mar 2013 12:50:04 +0100; 3 days ago
systemctl status command displays Active: inactive (dead) when NetworkManager is not running.
2.4. Starting NetworkManager Copy linkLink copied to clipboard!
systemctl start NetworkManager
~]# systemctl start NetworkManager
systemctl enable NetworkManager
~]# systemctl enable NetworkManager
2.5. NetworkManager Tools Copy linkLink copied to clipboard!
| Application or Tool | Description |
|---|---|
| nmcli | A command-line tool which enables users and scripts to interact with NetworkManager. Note that nmcli can be used on systems without a GUI such as servers to control all aspects of NetworkManager. It has the same functionality as GUI tools. |
| nmtui | A simple curses-based text user interface (TUI) for NetworkManager |
| nm-connection-editor | A graphical user interface tool for certain tasks not yet handled by the control-center utility such as configuring bonds and teaming connections. You can add, remove, and modify network connections stored by NetworkManager. To start it, enter nm-connection-editor in a terminal:
nm-connection-editor
|
| control-center | A graphical user interface tool provided by the GNOME Shell, available for desktop users. It incorporates a Network settings tool. To start it, press the Super key to enter the Activities Overview, type Network and then press Enter. The Network settings tool appears. |
| network connection icon | A graphical user interface tool provided by the GNOME Shell representing network connection states as reported by NetworkManager. The icon has multiple states that serve as visual indicators for the type of connection you are currently using. |
2.6. Using NetworkManager with Network Scripts Copy linkLink copied to clipboard!
network scripts refers to the script /etc/init.d/network and any other installed scripts it calls. Although NetworkManager provides the default networking service, scripts and NetworkManager can run in parallel and work together. Red Hat recommends to test them first.
Running Network Script
systemctl command: systemctl start|stop|restart|status network
systemctl start|stop|restart|status network
/etc/init.d/network checks with NetworkManager to avoid tampering with NetworkManager's connections. NetworkManager is intended to be the primary application using sysconfig configuration files, and /etc/init.d/network is intended to be secondary.
/etc/init.d/network script runs:
- manually - using one of the
systemctlcommands,start|stop|restartnetworkor - on boot and shutdown if the network service is enabled - as a result of the
systemctl enable networkcommand.
ifup and ifdown scripts manually.
Note
systemctl reload network.service command does not work due to technical limitations of initscripts. To apply a new configuration for the network service, use the restart command:
systemctl restart network.service
~]# systemctl restart network.service
Using Custom Commands in Network Scripts
/sbin/ifup-local, ifdown-pre-local, and ifdown-local scripts are only executed if these devices are controlled by the /etc/init.d/network service. The ifup-local file does not exist by default. If required, create it under the /sbin/ directory.
ifup-local script is readable only by the initscripts and not by NetworkManager. To run a custom script using NetworkManager, create it under the dispatcher.d/ directory. See the section called “Running Dispatcher scripts”.
Important
network scripts and with NetworkManager. If NetworkManager is enabled, the ifup and ifdown script will ask NetworkManager whether NetworkManager manages the interface in question, which is found from the “DEVICE=” line in the ifcfg file.
- calling ifup
- When you call
ifupand the device is managed by NetworkManager, there are two options:- If the device is not already connected, then
ifupasks NetworkManager to start the connection. - If the device is already connected, then nothing to do.
- calling ifdown
- When you call
ifdownand the device is managed by NetworkManager:ifdownasks NetworkManager to terminate the connection.
ifup or ifdown, the script starts the connection using the older, non-NetworkManager mechanism that it has used since the time before NetworkManager existed.
Running Dispatcher scripts
/etc/NetworkManager/dispatcher.d/ directory exists and NetworkManager runs scripts there, in alphabetical order. Each script must be an executable file owned by root and must have write permission only for the file owner. For more information about running NetworkManager dispatcher scripts, see the Red Hat Knowledgebase solution How to write a NetworkManager dispatcher script to apply ethtool commands.
2.7. Using NetworkManager with sysconfig files Copy linkLink copied to clipboard!
/etc/sysconfig/ directory is a location for configuration files and scripts. Most network configuration information is stored there, with the exception of VPN, mobile broadband and PPPoE configuration, which are stored in the /etc/NetworkManager/ subdirectories. For example, interface-specific information is stored in the ifcfg files in the /etc/sysconfig/network-scripts/ directory.
/etc/sysconfig/network file. Information for VPNs, mobile broadband and PPPoE connections is stored in /etc/NetworkManager/system-connections/.
ifcfg file, NetworkManager is not automatically aware of the change and has to be prompted to notice the change. If you use one of the tools to update NetworkManager profile settings, NetworkManager does not implement those changes until you reconnect using that profile. For example, if configuration files have been changed using an editor, NetworkManager must read the configuration files again.
root to reload all connection profiles:
nmcli connection reload
~]# nmcli connection reload
ifcfg-ifname:
nmcli con load /etc/sysconfig/network-scripts/ifcfg-ifname
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-ifname
nmcli dev disconnect interface-name
~]# nmcli dev disconnect interface-name
nmcli con up interface-name
~]# nmcli con up interface-name
ifup commands are used. See Section 2.6, “Using NetworkManager with Network Scripts” for the explanation of the network scripts.
ifup script is a generic script which does a few things and then calls interface-specific scripts such as ifup-device_name, ifup-wireless, ifup-ppp, and so on. When a user runs ifup enp1s0 manually:
ifuplooks for a file called/etc/sysconfig/network-scripts/ifcfg-enp1s0;- if the
ifcfgfile exists,ifuplooks for theTYPEkey in that file to determine which type-specific script to call; ifupcallsifup-wirelessorifup-device_namebased onTYPE;- the type-specific scripts do type-specific setup;
- the type-specific scripts let common functions perform
IP-related tasks likeDHCPor static setup.
/etc/init.d/network reads through all the ifcfg files and for each one that has ONBOOT=yes, it checks whether NetworkManager is already starting the DEVICE from that ifcfg file. If NetworkManager is starting that device or has already started it, nothing more is done for that file, and the next ONBOOT=yes file is checked. If NetworkManager is not yet starting that device, the initscripts continue with their traditional behavior and call ifup for that ifcfg file.
ifcfg file that has ONBOOT=yes is expected to be started on system bootup, either by NetworkManager or by the initscripts. This ensures that some legacy network types which NetworkManager does not handle (such as ISDN or analog dial-up modems) as well as any new application not yet supported by NetworkManager are still correctly started by the initscripts even though NetworkManager is unable to handle them.
Important
/etc directory, or in the same location as the live files, because the script literally does ifcfg-*. Only these extensions are excluded: .old, .orig, .rpmnew, .rpmorig, and .rpmsave.
2.8. Additional Resources Copy linkLink copied to clipboard!
man(1)man page — Describes man pages and how to find them.NetworkManager(8)man page — Describes the network management daemon.NetworkManager.conf(5)man page — Describes theNetworkManagerconfiguration file./usr/share/doc/initscripts-version/sysconfig.txt— Describesifcfgconfiguration files and their directives as understood by the legacy network service./usr/share/doc/initscripts-version/examples/networking/— A directory containing example configuration files.ifcfg(8)man page — Describes briefly theifcfgcommand.
Chapter 3. Configuring IP Networking Copy linkLink copied to clipboard!
3.1. Selecting Network Configuration Methods Copy linkLink copied to clipboard!
- To configure a network interface using NetworkManager, use one of the following tools:
- the text user interface tool, nmtui. For more details, see Section 3.2, “Configuring IP Networking with nmtui”.
- the command-line tool, nmcli. For more details, see Section 3.3, “Configuring IP Networking with nmcli”.
- the graphical user interface tools, GNOME GUI. For more details, see Section 3.4, “ Configuring IP Networking with GNOME GUI ”.
- To configure a network interface without using NetworkManager:
- edit the
ifcfgfiles manually. For more details, see Section 3.5, “Configuring IP Networking with ifcfg Files”. - use the
ipcommands. This can be used to assign IP addresses to an interface, but changes are not persistent across reboots; when you reboot, you will lose any changes. For more details, see Section 3.6, “Configuring IP Networking with ip Commands”.
- To configure the network settings when the root filesystem is not local:
- use the kernel command-line. For more details, see Section 3.7, “Configuring IP Networking from the Kernel Command line”.
3.2. Configuring IP Networking with nmtui Copy linkLink copied to clipboard!
Prerequisites
- The nmtui tool is used in a terminal window. It is contained in the NetworkManager-tui package, but it is not installed along with NetworkManager by default. To install NetworkManager-tui:
yum install NetworkManager-tui
~]# yum install NetworkManager-tuiCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To verify that NetworkManager is running, see Section 2.3, “Checking the Status of NetworkManager”.
Procedure
- Start the nmtui tool:The text user interface appears.
nmtui
~]$ nmtuiCopy to Clipboard Copied! Toggle word wrap Toggle overflow Figure 3.1. The NetworkManager Text User Interface starting menu
- To navigate, use the arrow keys or press Tab to step forwards and press Shift+Tab to step back through the options. Press Enter to select an option. The Space bar toggles the status of a check box.
Procedure
- Select the
Activate a connectionmenu entry.Figure 3.2. Activate a Connection
- Select the modified connection. On the right, click the
Deactivatebutton.Figure 3.3. Deactivate the Modified Connection
- Choose the connection again and click the
Activatebutton.Figure 3.4. Reactivate the Modified Connection
- If no connection name is supplied, the selection menu appears. If the connection name is supplied and correctly identified, the relevant Edit connection screen appears.
nmtui edit connection-name
nmtui edit connection-nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If no connection name is supplied, the selection menu appears. If the connection name is supplied and correctly identified, the relevant connection is activated. Any invalid command prints a usage message.
nmtui connect connection-name
nmtui connect connection-nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow
802.1X.
3.3. Configuring IP Networking with nmcli Copy linkLink copied to clipboard!
- For servers, headless machines, and terminals, nmcli can be used to control NetworkManager directly, without GUI, including creating, editing, starting and stopping network connections and viewing network status.
- For scripts, nmcli supports a terse output format which is better suited for script processing. It is a way to integrate network configuration instead of managing network connections manually.
nmcli [OPTIONS] OBJECT { COMMAND | help }
nmcli [OPTIONS] OBJECT { COMMAND | help }
general, networking, radio, connection, device, agent, and monitor. You can use any prefix of these options in your commands. For example, nmcli con help, nmcli c help, nmcli connection help generate the same output.
- -t, terse
- This mode can be used for computer script processing as you can see a terse output displaying only the values.
Example 3.1. Viewing a terse output
nmcli -t device ens3:ethernet:connected:Profile 1 lo:loopback:unmanaged:
nmcli -t device ens3:ethernet:connected:Profile 1 lo:loopback:unmanaged:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - -f, field
- This option specifies what fields can be displayed in output. For example, NAME,UUID,TYPE,AUTOCONNECT,ACTIVE,DEVICE,STATE. You can use one or more fields. If you want to use more, do not use space after comma to separate the fields.
Example 3.2. Specifying Fields in the output
or even better for scripting:nmcli -f DEVICE,TYPE device
~]$ nmcli -f DEVICE,TYPE device DEVICE TYPE ens3 ethernet lo loopbackCopy to Clipboard Copied! Toggle word wrap Toggle overflow nmcli -t -f DEVICE,TYPE device
~]$ nmcli -t -f DEVICE,TYPE device ens3:ethernet lo:loopbackCopy to Clipboard Copied! Toggle word wrap Toggle overflow - -p, pretty
- This option causes nmcli to produce human-readable output. For example, values are aligned and headers are printed.
Example 3.3. Viewing an output in pretty mode
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - -h, help
- Prints help information.
nmcli help- This command lists the available options and object names to be used in subsequent commands.
nmcli object help- This command displays the list of available actions related to a specified object. For example,
nmcli c help
nmcli c helpCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3.1. Brief Selection of nmcli Examples Copy linkLink copied to clipboard!
Example 3.4. Checking the overall status of NetworkManager
nmcli general status
~]$ nmcli general status
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
connected full enabled enabled enabled enabled
nmcli -t -f STATE general
~]$ nmcli -t -f STATE general
connected
Example 3.5. Viewing NetworkManager logging status
Example 3.6. Viewing all connections
nmcli connection show
~]$ nmcli connection show
NAME UUID TYPE DEVICE
Profile 1 db1060e9-c164-476f-b2b5-caec62dc1b05 ethernet ens3
ens3 aaf6eb56-73e5-4746-9037-eed42caa8a65 ethernet --
Example 3.7. Viewing only currently active connections
nmcli connection show --active
~]$ nmcli connection show --active
NAME UUID TYPE DEVICE
Profile 1 db1060e9-c164-476f-b2b5-caec62dc1b05 ethernet ens3
Example 3.8. Viewing only devices recognized by NetworkManager and their state
nmcli device status
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens3 ethernet connected Profile 1
lo loopback unmanaged --
| nmcli command | abbreviation | |
|---|---|---|
| nmcli general status | nmcli g | |
| nmcli general logging | nmcli g log | |
| nmcli connection show | nmcli con show | |
| nmcli connection show --active | nmcli con show -a | |
| nmcli device status | nmcli dev |
3.3.2. Starting and Stopping a Network Interface Using nmcli Copy linkLink copied to clipboard!
nmcli con up id bond0 nmcli con up id port0 nmcli dev disconnect bond0 nmcli dev disconnect ens3
nmcli con up id bond0
nmcli con up id port0
nmcli dev disconnect bond0
nmcli dev disconnect ens3
Note
nmcli connection down command, deactivates a connection from a device without preventing the device from further auto-activation. The nmcli device disconnect command, disconnects a device and prevent the device from automatically activating further connections without manual intervention.
3.3.3. Understanding the nmcli Options Copy linkLink copied to clipboard!
connection.type- A connection type. Allowed values are: adsl, bond, bond-slave, bridge, bridge-slave, bluetooth, cdma, ethernet, gsm, infiniband, olpc-mesh, team, team-slave, vlan, wifi, wimax. Each connection type has type-specific command options. You can see the
TYPE_SPECIFIC_OPTIONSlist in the nmcli(1) man page. For example:- A
gsmconnection requires the access point name specified in anapn.nmcli c add connection.type gsm apn access_point_name
nmcli c add connection.type gsm apn access_point_nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow - A
wifidevice requires the service set identifier specified in assid.nmcli c add connection.type wifi ssid My identifier
nmcli c add connection.type wifi ssid My identifierCopy to Clipboard Copied! Toggle word wrap Toggle overflow
connection.interface-name- A device name relevant for the connection.
nmcli con add connection.interface-name enp1s0 type ethernet
nmcli con add connection.interface-name enp1s0 type ethernetCopy to Clipboard Copied! Toggle word wrap Toggle overflow connection.id- A name used for the connection profile. If you do not specify a connection name, one will be generated as follows:
connection.type -connection.interface-name
connection.type -connection.interface-nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow Theconnection.idis the name of a connection profile and should not be confused with the interface name which denotes a device (wlp61s0,ens3,em1). However, users can name the connections after interfaces, but they are not the same thing. There can be multiple connection profiles available for a device. This is particularly useful for mobile devices or when switching a network cable back and forth between different devices. Rather than edit the configuration, create different profiles and apply them to the interface as needed. Theidoption also refers to the connection profile name.
show, up, down are:
id- An identification string assigned by the user to a connection profile. Id can be used in nmcli connection commands to identify a connection. The NAME field in the command output always denotes the connection id. It refers to the same connection profile name that the con-name does.
uuid- A unique identification string assigned by the system to a connection profile. The
uuidcan be used innmcli connectioncommands to identify a connection.
3.3.4. Using the nmcli Interactive Connection Editor Copy linkLink copied to clipboard!
nmcli con edit
~]$ nmcli con edit
type option to the nmcli con edit command and be taken straight to the nmcli prompt. The format is as follows for editing an existing connection profile: nmcli con edit [id | uuid | path] ID
nmcli con edit [id | uuid | path] ID
nmcli con edit [type new-connection-type] [con-name new-connection-name]
nmcli con edit [type new-connection-type] [con-name new-connection-name]
help at the nmcli prompt to see a list of valid commands. Use the describe command to get a description of settings and their properties: describe setting.property
describe setting.property
nmcli> describe team.config
nmcli> describe team.config
3.3.5. Creating and Modifying a Connection Profile with nmcli Copy linkLink copied to clipboard!
nmcli c add {ARGUMENTS}
nmcli c add {ARGUMENTS}
nmcli c add accepts two different types of parameters:
- Property names
- the names which NetworkManager uses to describe the connection internally. The most important are:
- connection.type
nmcli c add connection.type bond
nmcli c add connection.type bondCopy to Clipboard Copied! Toggle word wrap Toggle overflow - connection.interface-name
nmcli c add connection.interface-name enp1s0
nmcli c add connection.interface-name enp1s0Copy to Clipboard Copied! Toggle word wrap Toggle overflow - connection.id
nmcli c add connection.id "My Connection"
nmcli c add connection.id "My Connection"Copy to Clipboard Copied! Toggle word wrap Toggle overflow See thenm-settings(5)man page for more information on properties and their settings.
- Aliases names
- the human-readable names which are translated to properties internally. The most common are:
- type (the connection.type property)
nmcli c add type bond
nmcli c add type bondCopy to Clipboard Copied! Toggle word wrap Toggle overflow - ifname (the connection.interface-name property)
nmcli c add ifname enp1s0
nmcli c add ifname enp1s0Copy to Clipboard Copied! Toggle word wrap Toggle overflow - con-name (the connection.id property)
nmcli c add con-name "My Connection"
nmcli c add con-name "My Connection"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
nmcli, to create a connection required using the aliases. For example, ifname enp1s0 and con-name My Connection. A command in the following format could be used: nmcli c add type ethernet ifname enp1s0 con-name "My Connection"
nmcli c add type ethernet ifname enp1s0 con-name "My Connection"
property names and the aliases can be used interchangeably. The following examples are all valid and equivalent: nmcli c add type ethernet ifname enp1s0 con-name "My Connection" ethernet.mtu 1600
nmcli c add type ethernet ifname enp1s0 con-name "My Connection" ethernet.mtu 1600
nmcli c add connection.type ethernet ifname enp1s0 con-name "My Connection" ethernet.mtu 1600
nmcli c add connection.type ethernet ifname enp1s0 con-name "My Connection" ethernet.mtu 1600
nmcli c add connection.type ethernet connection.interface-name enps1s0 connection.id "My Connection" ethernet.mtu 1600
nmcli c add connection.type ethernet connection.interface-name enps1s0 connection.id "My Connection" ethernet.mtu 1600
type argument is mandatory for all connection types and ifname is mandatory for all types except bond, team, bridge and vlan.
- type type_name
- connection type. For example:
nmcli c add type bond
nmcli c add type bondCopy to Clipboard Copied! Toggle word wrap Toggle overflow - ifname interface_name
- interface to bind the connection to. For example:
nmcli c add ifname interface_name type ethernet
nmcli c add ifname interface_name type ethernetCopy to Clipboard Copied! Toggle word wrap Toggle overflow
nmcli c modify
nmcli c modify
connection.id from My Connection to My favorite connection and the connection.interface-name to enp1s0, issue the command as follows: nmcli c modify "My Connection" connection.id "My favorite connection" connection.interface-name enp1s0
nmcli c modify "My Connection" connection.id "My favorite connection" connection.interface-name enp1s0
Note
property names. The aliases are used only for compatibility reasons.
nmcli c modify "My favorite connection" ethernet.mtu 1600
nmcli c modify "My favorite connection" ethernet.mtu 1600
nmcli con up con-name
nmcli con up con-name
nmcli con up My-favorite-connection Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/16)
nmcli con up My-favorite-connection
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/16)
3.3.6. Connecting to a Network Using nmcli Copy linkLink copied to clipboard!
nmcli con show
~]$ nmcli con show
NAME UUID TYPE DEVICE
Auto Ethernet 9b7f2511-5432-40ae-b091-af2457dfd988 802-3-ethernet --
ens3 fb157a65-ad32-47ed-858c-102a48e064a2 802-3-ethernet ens3
MyWiFi 91451385-4eb8-4080-8b82-720aab8328dd 802-11-wireless wlp61s0
NAME field in the output always denotes the connection ID (name). It is not the interface name even though it might look the same. In the second connection shown above, ens3 in the NAME field is the connection ID given by the user to the profile applied to the interface ens3. In the last connection shown, the user has assigned the connection ID MyWiFi to the interface wlp61s0.
nmcli device status
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens3 ethernet disconnected --
ens9 ethernet disconnected --
lo loopback unmanaged --
3.3.7. Adding and Configuring a Dynamic Ethernet Connection with nmcli Copy linkLink copied to clipboard!
Adding a Dynamic Ethernet Connection
IP configuration, allowing DHCP to assign the network configuration: nmcli connection add type ethernet con-name connection-name ifname interface-name
nmcli connection add type ethernet con-name connection-name ifname interface-name
nmcli con add type ethernet con-name my-office ifname ens3
~]$ nmcli con add type ethernet con-name my-office ifname ens3
Connection 'my-office' (fb157a65-ad32-47ed-858c-102a48e064a2) successfully added.
nmcli con up my-office
~]$ nmcli con up my-office
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
nmcli device status
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens3 ethernet connected my-office
ens9 ethernet disconnected --
lo loopback unmanaged --
Configuring a Dynamic Ethernet Connection
DHCP server, modify the dhcp-hostname property:
nmcli con modify my-office my-office ipv4.dhcp-hostname host-name ipv6.dhcp-hostname host-name
~]$ nmcli con modify my-office my-office ipv4.dhcp-hostname host-name ipv6.dhcp-hostname host-name
IPv4 client ID sent by a host to a DHCP server, modify the dhcp-client-id property:
nmcli con modify my-office my-office ipv4.dhcp-client-id client-ID-string
~]$ nmcli con modify my-office my-office ipv4.dhcp-client-id client-ID-string
dhcp-client-id property for IPv6, dhclient creates an identifier for IPv6. See the dhclient(8) man page for details.
DNS servers sent to a host by a DHCP server, modify the ignore-auto-dns property:
nmcli con modify my-office my-office ipv4.ignore-auto-dns yes ipv6.ignore-auto-dns yes
~]$ nmcli con modify my-office my-office ipv4.ignore-auto-dns yes ipv6.ignore-auto-dns yes
nm-settings(5) man page for more information on properties and their settings.
Example 3.9. Configuring a Dynamic Ethernet Connection Using the Interactive Editor
save temporary command.
3.3.8. Adding and Configuring a Static Ethernet Connection with nmcli Copy linkLink copied to clipboard!
Adding a Static Ethernet Connection
IPv4 configuration: nmcli connection add type ethernet con-name connection-name ifname interface-name ip4 address gw4 address
nmcli connection add type ethernet con-name connection-name ifname interface-name ip4 address gw4 address
IPv6 address and gateway information can be added using the ip6 and gw6 options.
IPv4 address and gateway:
nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \ gw4 10.10.10.254
~]$ nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254
IPv6 address and gateway for the device:
nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \ gw4 10.10.10.254 ip6 abbe::cafe gw6 2001:db8::1
~]$ nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254 ip6 abbe::cafe gw6 2001:db8::1
Connection 'test-lab' (05abfd5e-324e-4461-844e-8501ba704773) successfully added.
IPv4 DNS server addresses:
nmcli con mod test-lab ipv4.dns "8.8.8.8 8.8.4.4"
~]$ nmcli con mod test-lab ipv4.dns "8.8.8.8 8.8.4.4"
DNS servers. To set two IPv6 DNS server addresses:
nmcli con mod test-lab ipv6.dns "2001:4860:4860::8888 2001:4860:4860::8844"
~]$ nmcli con mod test-lab ipv6.dns "2001:4860:4860::8888 2001:4860:4860::8844"
DNS servers. Alternatively, to add additional DNS servers to any previously set, use the + prefix:
nmcli con mod test-lab +ipv4.dns "8.8.8.8 8.8.4.4"
~]$ nmcli con mod test-lab +ipv4.dns "8.8.8.8 8.8.4.4"
nmcli con mod test-lab +ipv6.dns "2001:4860:4860::8888 2001:4860:4860::8844"
~]$ nmcli con mod test-lab +ipv6.dns "2001:4860:4860::8888 2001:4860:4860::8844"
nmcli con up test-lab ifname ens9
~]$ nmcli con up test-lab ifname ens9
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
nmcli device status
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens3 ethernet connected my-office
ens9 ethernet connected test-lab
lo loopback unmanaged --
-p, --pretty option adds a title banner and section breaks to the output.
Example 3.10. Configuring a Static Ethernet Connection Using the Interactive Editor
save temporary command.
connection.autoconnect to yes. NetworkManager will also write out settings to /etc/sysconfig/network-scripts/ifcfg-my-office where the corresponding BOOTPROTO will be set to none and ONBOOT to yes.
3.3.9. Locking a Profile to a Specific Device Using nmcli Copy linkLink copied to clipboard!
nmcli connection add type ethernet con-name connection-name ifname interface-name
nmcli connection add type ethernet con-name connection-name ifname interface-name
nmcli connection add type ethernet con-name connection-name ifname "*"
nmcli connection add type ethernet con-name connection-name ifname "*"
ifname argument even if you do not want to set a specific interface. Use the wildcard character * to specify that the profile can be used with any compatible device.
nmcli connection add type ethernet con-name "connection-name" ifname "*" mac 00:00:5E:00:53:00
nmcli connection add type ethernet con-name "connection-name" ifname "*" mac 00:00:5E:00:53:00
3.3.10. Adding a Wi-Fi Connection with nmcli Copy linkLink copied to clipboard!
IP configuration, but allowing automatic DNS address assignment:
nmcli con add con-name MyCafe ifname wlp61s0 type wifi ssid MyCafe \ ip4 192.168.100.101/24 gw4 192.168.100.1
~]$ nmcli con add con-name MyCafe ifname wlp61s0 type wifi ssid MyCafe \
ip4 192.168.100.101/24 gw4 192.168.100.1
nmcli con modify MyCafe wifi-sec.key-mgmt wpa-psk nmcli con modify MyCafe wifi-sec.psk caffeine
~]$ nmcli con modify MyCafe wifi-sec.key-mgmt wpa-psk
~]$ nmcli con modify MyCafe wifi-sec.psk caffeine
nmcli radio wifi [on | off ]
~]$ nmcli radio wifi [on | off ]
Changing a Specific Property Using nmcli
mtu:
nmcli connection show id 'MyCafe' | grep mtu
~]$ nmcli connection show id 'MyCafe' | grep mtu
802-11-wireless.mtu: auto
nmcli connection modify id 'MyCafe' 802-11-wireless.mtu 1350
~]$ nmcli connection modify id 'MyCafe' 802-11-wireless.mtu 1350
nmcli connection show id 'MyCafe' | grep mtu
~]$ nmcli connection show id 'MyCafe' | grep mtu
802-11-wireless.mtu: 1350
802-3-ethernet and 802-11-wireless as the setting, and mtu as a property of the setting. See the nm-settings(5) man page for more information on properties and their settings.
3.3.11. Configuring NetworkManager to Ignore Certain Devices Copy linkLink copied to clipboard!
lo (loopback) device. However, you can set certain devices as unmanaged to configure that NetworkManager ignores these devices. With this setting, you can manually manage these devices, for example, using a script.
3.3.11.1. Permanently Configuring a Device as Unmanaged in NetworkManager Copy linkLink copied to clipboard!
unmanaged based on several criteria, such as the interface name, MAC address, or device type. This procedure describes how to permanently set the enp1s0 interface as unmanaged in NetworkManager.
unmanaged, see Section 3.3.11.2, “Temporarily Configuring a Device as Unmanaged in NetworkManager”.
Procedure
- Optional: Display the list of devices to identify the device you want to set as
unmanaged:nmcli device status
# nmcli device status DEVICE TYPE STATE CONNECTION enp1s0 ethernet disconnected -- ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the
/etc/NetworkManager/conf.d/99-unmanaged-devices.conffile with the following content:[keyfile] unmanaged-devices=interface-name:enp1s0
[keyfile] unmanaged-devices=interface-name:enp1s0Copy to Clipboard Copied! Toggle word wrap Toggle overflow To set multiple devices as unmanaged, separate the entries in theunmanaged-devicesparameter with semicolon:[keyfile] unmanaged-devices=interface-name:interface_1;interface-name:interface_2;...
[keyfile] unmanaged-devices=interface-name:interface_1;interface-name:interface_2;...Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Reload the
NetworkManagerservice:systemctl reload NetworkManager
# systemctl reload NetworkManagerCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification Steps
- Display the list of devices:
nmcli device status
# nmcli device status DEVICE TYPE STATE CONNECTION enp1s0 ethernet unmanaged -- ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow Theunmanagedstate next to theenp1s0device indicates that NetworkManager does not manage this device.
Additional Resources
3.3.11.2. Temporarily Configuring a Device as Unmanaged in NetworkManager Copy linkLink copied to clipboard!
unmanaged based on several criteria, such as the interface name, MAC address, or device type. This procedure describes how to temporarily set the enp1s0 interface as unmanaged in NetworkManager.
unmanaged, see Section 3.3.11.1, “Permanently Configuring a Device as Unmanaged in NetworkManager”.
Procedure
- Optional: Display the list of devices to identify the device you want to set as
unmanaged:nmcli device status
# nmcli device status DEVICE TYPE STATE CONNECTION enp1s0 ethernet disconnected -- ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the
enp1s0device to theunmanagedstate:nmcli device set enp1s0 managed no
# nmcli device set enp1s0 managed noCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification Steps
- Display the list of devices:
nmcli device status
# nmcli device status DEVICE TYPE STATE CONNECTION enp1s0 ethernet unmanaged -- ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow Theunmanagedstate next to theenp1s0device indicates that NetworkManager does not manage this device.
Additional Resources
3.4. Configuring IP Networking with GNOME GUI Copy linkLink copied to clipboard!
- the GNOME control-center application
- the GNOME nm-connection-editor application
3.4.1. Connecting to a Network Using the control-center GUI Copy linkLink copied to clipboard!
- Press the Super key to enter the Activities Overview, type Settings and then press Enter. Then, select the
Networktab on the left-hand side, and the Network settings tool appears. Proceed to the section called “Configuring New Connections with control-center”. - Click on the GNOME Shell network connection icon in the top right-hand corner of the screen to open its menu.
Figure 3.5. Network Configuration using the control-center application
- A list of categorized networks you are currently connected to (such as Wired and Wi-Fi).
- A list of all Available Networks that NetworkManager has detected.
- Options for connecting to any configured Virtual Private Networks (VPNs)and
- An option for selecting the Network Settings menu entry.
3.4.2. Configuring New and Editing Existing Connections Using a GUI Copy linkLink copied to clipboard!
- the GNOME control-center application
- the GNOME nm-connection-editor application
3.4.2.1. Configuring New and Editing Existing Connections Using control-center Copy linkLink copied to clipboard!
Configuring New Connections with control-center
- Press the Super key to enter the Activities Overview, type Settings and then press Enter. Then, select the
Networktab on the left-hand side. The Network settings tool appears on the right-hand side menu:Figure 3.6. Opening the Network Settings Window
- Click the plus button to add a new connection.To configure:
- Wired connections, click the plus button next to Wired entry and proceed to Section 3.4.6, “Configuring a Wired (Ethernet) Connection with a GUI”.
- VPN connections, click the plus button next to VPN entry and proceed to Section 3.4.8.1, “Establishing a VPN Connection with control-center”
For Wi-Fi connections, click the Wi-fi entry in theSettingsmenu and proceed to Section 3.4.7, “Configuring a Wi-Fi Connection with a GUI”
Editing an Existing Connection with control-center
IP addressing, DNS, and routing configuration.
Figure 3.7. Configure Networks Using the Network Connection Details Window
3.4.2.2. Configuring New and Editing Existing Connections Using nm-connection-editor Copy linkLink copied to clipboard!
Configuring a New Connection with nm-connection-editor
Procedure
- Enter
nm-connection-editorin a terminal:Thenm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow Network Connectionswindow appears. - Click the plus button to choose a connection type:
Figure 3.8. Adding a connection type using nm-connection-editor
Figure 3.9. Choosing a connection type with nm-connection-editor
To create and configure:- Bond connections, click the Bond entry and proceed to Section 7.8.1, “Establishing a Bond Connection”;
- Bridge connections, click the Bridge entry and proceed to Section 9.4.1, “Establishing a Bridge Connection with a GUI”;
- VLAN connections, click the VLAN entry and proceed to Section 10.5.1, “Establishing a VLAN Connection”; or,
- Team connections, click the Team entry and proceed to Section 8.14, “Creating a Network Team Using a GUI”.
Editing an Existing Connection with nm-connection-editor
3.4.3. Common Configuration Options Using nm-connection-editor Copy linkLink copied to clipboard!
nm-connection-editor utility, there are five common configuration options to the most connection types (ethernet, wifi, mobile broadband, DSL) following the procedure below:
Procedure
- Enter
nm-connection-editorin a terminal:Thenm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow Network Connectionswindow appears. Click the plus button to choose a connection type or the gear wheel icon to edit an existing connection. - Select the General tab in the Editing dialog:
Figure 3.10. Configuration options in nm-connection-editor
- Connection name — Enter a descriptive name for your network connection. This name is used to list this connection in the menu of the Network window.
- Connection priority for auto-activation — If the connection is set to autoconnect, the number is activated (
0by default). The higher number means higher priority. - Automatically connect to this network when it is available — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See the section called “Editing an Existing Connection with control-center” for more information.
- All users may connect to this network — Select this box to create a connection available to all users on the system. Changing this setting may require root privileges. See Section 3.4.5, “Managing System-wide and Private Connection Profiles with a GUI” for details.
- Automatically connect to VPN when using this connection — Select this box if you want NetworkManager to auto-connect to a VPN connection when it is available. Select the VPN from the drop-down menu.
- Firewall Zone — Select the firewall zone from the drop-down menu. See the Red Hat Enterprise Linux 7 Security Guide for more information on firewall zones.
Note
3.4.4. Connecting to a Network Automatically with a GUI Copy linkLink copied to clipboard!
- the GNOME control-center application
- the GNOME nm-connection-editor application
3.4.4.1. Connecting to a Network Automatically with control-center Copy linkLink copied to clipboard!
Procedure
- Press the Super key to enter the Activities Overview, type
Settingsand then press Enter. Then, select the Network tab on the left-hand side. The Network settings tool appears on the right-hand side menu, see the section called “Configuring New Connections with control-center”. - Select the network interface from the right-hand-side menu.
- Click on the gear wheel icon of a connection profile on the right-hand side menu. The Network details window appears.
- Select the Details menu entry, see the section called “Editing an Existing Connection with control-center”.
- Select Connect automatically to cause NetworkManager to auto-connect to the connection whenever NetworkManager detects that it is available. Clear the check box if you do not want NetworkManager to connect automatically. If the check box is clear, you will have to select that connection manually in the network connection icon's menu to cause it to connect.
3.4.4.2. Connecting to a Network Automatically with nm-connection-editor Copy linkLink copied to clipboard!
Automatically connect to this network when it is available check box in the General tab.
3.4.5. Managing System-wide and Private Connection Profiles with a GUI Copy linkLink copied to clipboard!
nm-settings(5) man page for more information on the connection settings permissions property. You can control access to a connection profile using the following graphical user interface tools:
- the nm-connection-editor application
- the control-center application
3.4.5.1. Managing Permissions for a Connection Profile with nm-connection-editor Copy linkLink copied to clipboard!
3.4.5.2. Managing Permissions for a Connection Profile with control-center Copy linkLink copied to clipboard!
Details window.
Note
user-em2 with the Connect Automatically check box selected but with the Make available to other users not selected, then the connection will not be available at boot time.
- Clear the Make available to other users check box, which changes the connection to be modifiable and usable only by the user doing the changing.
- Use the polkit framework to restrict permissions of general network operations on a per-user basis.
polkit(8) man page for more information on polkit.
3.4.6. Configuring a Wired (Ethernet) Connection with a GUI Copy linkLink copied to clipboard!
- the control-center application
- the nm-connection-editor application
3.4.6.1. Configuring a Wired Connection Using control-center Copy linkLink copied to clipboard!
Procedure
- Press the Super key to enter the Activities Overview, type Settings and then press Enter. Then, select the
Networkmenu entry on the left-hand side, and the Network settings tool appears, see the section called “Configuring New Connections with control-center”. - Select the Wired network interface if it is not already highlighted.The system creates and configures a single wired connection profile called Wired by default. A profile is a named collection of settings that can be applied to an interface. More than one profile can be created for an interface and applied as needed. The default profile cannot be deleted but its settings can be changed.
- Edit the default Wired profile by clicking the gear wheel icon.
Basic Configuration Options
Figure 3.11. Basic Configuration options of a Wired Connection
- Name — Enter a descriptive name for your network connection. This name will be used to list this connection in the menu of the Network window.
- MAC Address — Select the MAC address of the interface this profile must be applied to.
- Cloned Address — If required, enter a different MAC address to use.
- MTU — If required, enter a specific maximum transmission unit (MTU) to use. The MTU value represents the size in bytes of the largest packet that the link layer will transmit. This value defaults to
1500and does not generally need to be specified or changed.
Making Further Wired Configurations
IPv4settings for the connection, click the IPv4 menu entry and proceed to Section 5.4, “Configuring IPv4 Settings”orIPv6settings for the connection, click the IPv6 menu entry and proceed to Section 5.5, “Configuring IPv6 Settings”.- port-based Network Access Control (PNAC), click the 802.1X Security menu entry and proceed to Section 5.2, “Configuring 802.1X Security”;
Saving Your New (or Modified) Wired Connection
Creating a New Wired Connection
3.4.6.2. Configuring a Wired Connection with nm-connection-editor Copy linkLink copied to clipboard!
- Enter the nm-connection-editor in a terminal.The
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow Network Connectionswindow appears. - Select the ethernet connection you want to edit and click the gear wheel icon:
Figure 3.12. Edit a wired connection
TheEditingdialog appears.- To connect to a network automatically and restrict connections, click the
Generaltab, see Section 3.4.3, “Common Configuration Options Using nm-connection-editor”. - To configure the networking settings, click the
Ethernettab, see the section called “Configuring 802.3 Link Settings with nm-connection-editor”. - To configure 802.1X Security for a wired connection, click the
802.1X Securitytab, see Section 5.2.4, “Configuring 802.1X Security for Wired with nm-connection-editor”. - To configure the IPV4 settings, click the
IPV4 Settingstab, see the section called “Setting the Method for IPV4 Using nm-connection-editor”. - To configure the IPV6 settings, click the
IPV6 Settingstab, see Section 5.5, “Configuring IPv6 Settings”.
3.4.7. Configuring a Wi-Fi Connection with a GUI Copy linkLink copied to clipboard!
Wi-Fi (also known as wireless or 802.11a/b/g/n) connection to an Access Point. An Access Point is a device that allows wireless devices to connect to a network.
Connecting Quickly to an Available Access Point
Procedure
- Click on the network connection icon to activate the network connection icon's menu, see Section 3.4.1, “Connecting to a Network Using the control-center GUI”.
- Locate the Service Set Identifier (SSID) of the access point in the list of Wi-Fi networks.
- Click on the SSID of the network. A padlock symbol indicates the access point requires authentication. If the access point is secured, a dialog prompts you for an authentication key or password.NetworkManager tries to auto-detect the type of security used by the access point. If there are multiple possibilities, NetworkManager guesses the security type and presents it in the Wi-Fi security drop-down menu.
- For WPA-PSK security (WPA with a passphrase) no choice is necessary.
- For WPA Enterprise (802.1X) you have to specifically select the security, because that cannot be auto-detected.Note that if you are unsure, try connecting to each type in turn.
- Enter the key or passphrase in the Password field. Certain password types, such as a 40-bit WEP or 128-bit WPA key, are invalid unless they are of a requisite length. The Connect button will remain inactive until you enter a key of the length required for the selected security type. To learn more about wireless security, see Section 5.2, “Configuring 802.1X Security”.
Connecting to a Hidden Wi-Fi Network
Procedure
- Press the Super key to enter the Activities Overview, type Settings and then press Enter. Then, select the
Wi-Fimenu entry on the left-hand side. - Select Connect to Hidden Network. There are two options:
- If you have connected to the hidden network before:
- Use the Connection drop-down to select the network.
- Click .
- If not, proceed as follows:
- Leave the Connection drop-down as .
- Enter the SSID of the hidden network.
- Select its Wi-Fi security method.
- Enter the correct authentication secrets.
- Click .
Configuring a New Wi-Fi Connection
Procedure
- Select the Wi-Fi menu entry of Settings.
- Click the Wi-Fi connection name that you want to connect to (by default, the same as the SSID).
- If the SSID is not in range, see the section called “Connecting to a Hidden Wi-Fi Network” for more information.
- If the SSID is in range, click the
Wi-Ficonnection profile on the right-hand side menu. A padlock symbol indicates a key or password is required. If requested, enter the authentication details.
Editing an Existing Wi-Fi Connection
Procedure
- Press the Super key to enter the Activities Overview, type Settings and press Enter.
- Select Wi-Fi from the left-hand-side menu entry.
- Select the gear wheel icon to the right of the Wi-Fi connection name that you want to edit, and the editing connection dialog appears. Note that if the network is not currently in range, click History to display past connections. The Details window shows the connection details.
Basic Configuration Options for a Wi-Fi Connection
Figure 3.13. Basic Configuration Options for a Wi-Fi Connection
- SSID
- The Service Set Identifier (SSID) of the access point (AP).
- BSSID
- The Basic Service Set Identifier (BSSID) is the MAC address, also known as a hardware address, of the specific wireless access point you are connecting to when in Infrastructure mode. This field is blank by default, and you are able to connect to a wireless access point by SSID without having to specify its BSSID. If the BSSID is specified, it will force the system to associate to a specific access point only.For ad-hoc networks, the BSSID is generated randomly by the mac80211 subsystem when the ad-hoc network is created. It is not displayed by NetworkManager
- MAC address
- Select the MAC address, also known as a hardware address, of the Wi-Fi interface to use.A single system could have one or more wireless network adapters connected to it. The MAC address field therefore allows you to associate a specific wireless adapter with a specific connection (or connections).
- Cloned Address
- A cloned MAC address to use in place of the real hardware address. Leave blank unless required.
- Connect automatically — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See the section called “Editing an Existing Connection with control-center” for more information.
- Make available to other users — Select this box to create a connection available to all users on the system. Changing this setting may require root privileges. See Section 3.4.5, “Managing System-wide and Private Connection Profiles with a GUI” for details.
Making Further Wi-Fi Configurations
- security authentication for the wireless connection, click Security and proceed to Section 5.2, “Configuring 802.1X Security”.
IPv4settings for the connection, click IPv4 and proceed to Section 5.4, “Configuring IPv4 Settings”orIPv6settings for the connection, click IPv6 and proceed to Section 5.5, “Configuring IPv6 Settings”.
Saving Your New (or Modified) Connection
3.4.8. Configuring a VPN Connection with a GUI Copy linkLink copied to clipboard!
IPsec, provided by Libreswan, is the preferred method for creating a VPN. Libreswan is an open-source, user-space IPsec implementation for VPN. Configuring an IPsec VPN using the command line is documented in the Red Hat Enterprise Linux 7 Security Guide.
3.4.8.1. Establishing a VPN Connection with control-center Copy linkLink copied to clipboard!
IPsec, provided by Libreswan, is the preferred method for creating a VPN in Red Hat Enterprise Linux 7. For more information, see Section 3.4.8, “Configuring a VPN Connection with a GUI”.
root:
yum install NetworkManager-libreswan-gnome
~]# yum install NetworkManager-libreswan-gnome
- it adds an Authentication Header for routing and authentication purposes;
- it encrypts the packet data; and,
- it encloses the data in packets according to the Encapsulating Security Payload (ESP) protocol, which constitutes the decryption and handling instructions.
Adding a New IPsec VPN Connection
Procedure
- Press the Super key to enter the Activities Overview, type Settings and press Enter. Then, select the Network menu entry and the Network settings tool appears, see the section called “Configuring New Connections with control-center”.
- Click the plus button in the VPN entry.
- The Add VPN window appears. For manually configuration, select IPsec based VPN.
Figure 3.14. Configuring VPN on IPsec mode
- In the
Identityconfiguration form, you can specify the fields in theGeneralandAdvancedsections:Figure 3.15. General and Advanced sections
- In
Generalsection, you can specify:
- Gateway
- The name or
IPaddress of the remote VPN gateway. - User name
- If required, enter the user name associated with the VPN user's identity for authentication.
- User password
- If required, enter the password associated with the VPN user's identity for authentication.
- Group name
- The name of a VPN group configured on the remote gateway. In case it is blank, the IKEv1 Main mode is used instead of the default Aggressive mode.
- Secret
- It is a pre-shared key which is used to initialize the encryption before the user's authentication. If required, enter the password associated with the group name.
- The following configuration settings are available under the
Advancedsection:
- Phase1 Algorithms
- If required, enter the algorithms to be used to authenticate and set up an encrypted channel.
- Phase2 Algorithms
- If required, enter the algorithms to be used for the
IPsecnegotiations. - Domain
- If required, enter the Domain Name.
Note
IPsec VPN without using NetworkManager, see Section 3.4.8, “Configuring a VPN Connection with a GUI”.
Editing an Existing VPN Connection
Procedure
- Press the Super key to enter the Activities Overview, type Settings and press Enter. Then, select the Network menu entry and the Network settings tool appears, see the section called “Configuring New Connections with control-center”.
- Select the VPN connection you want to edit and click the gear wheel icon and edit the
GeneralandAdvancedsections, see Section 3.4.8.1, “Establishing a VPN Connection with control-center”.
Saving Your New (or Modified) Connection and Making Further Configurations
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”.
3.4.8.2. Configuring a VPN Connection with nm-connection-editor Copy linkLink copied to clipboard!
Procedure
- Enter nm-connection-editor in a terminal. The Network Connections window appears, see Section 3.4.3, “Common Configuration Options Using nm-connection-editor”.
- Click the plus button. The Choose a Connection Type menu opens.
- Select from the menu entry, the
IPsec based VPNoption. - Click
Createto open theEditingdialog and proceed to the section called “Adding a New IPsec VPN Connection” to edit theGeneralandAdvancedsections.
3.4.9. Configuring a Mobile Broadband Connection with a GUI Copy linkLink copied to clipboard!
- 2G — GPRS (General Packet Radio Service), EDGE (Enhanced Data Rates for GSM Evolution), or CDMA (Code Division Multiple Access).
- 3G — UMTS (Universal Mobile Telecommunications System), HSPA (High Speed Packet Access), or EVDO (EVolution Data-Only).
3.4.9.1. Configuring a Mobile Broadband Connection with nm-connection-editor Copy linkLink copied to clipboard!
Adding a New Mobile Broadband Connection
Procedure
- Enter nm-connection-editor in a terminal. The Network Connections window appears, see Section 3.4.3, “Common Configuration Options Using nm-connection-editor”.
- Click the plus button. The Choose a Connection Type menu opens.
- Select the menu entry.
- Click to open the Set up a Mobile Broadband Connection assistant.
- Under Create a connection for this mobile broadband device, choose the 2G- or 3G-capable device you want to use with the connection. If the drop-down menu is inactive, this indicates that the system was unable to detect a device capable of mobile broadband. In this case, click Cancel, ensure that you do have a mobile broadband-capable device attached and recognized by the computer and then retry this procedure. Click the Continue button.
- Select the country where your service provider is located from the list and click the Continue button.
- Select your provider from the list or enter it manually. Click the Continue button.
- Select your payment plan from the drop-down menu and confirm the Access Point Name (APN) is correct. Click the Continue button.
- Review and confirm the settings and then click the Apply button.
- Edit the mobile broadband-specific settings by referring to the section called “Configuring the Mobile Broadband Tab”
Editing an Existing Mobile Broadband Connection
Procedure
- Enter
nm-connection-editorin a terminal. The Network Connections window appears. - Select the Mobile Broadband tab.
- Select the connection you want to edit and click the gear wheel icon. See Section 3.4.3, “Common Configuration Options Using nm-connection-editor” for more information.
- Edit the mobile broadband-specific settings by referring to the section called “Configuring the Mobile Broadband Tab”
Configuring the Mobile Broadband Tab
- Number
- The number that is dialed to establish a PPP connection with the GSM-based mobile broadband network. This field may be automatically populated during the initial installation of the broadband device. You can usually leave this field blank and enter the APN instead.
- Username
- Enter the user name used to authenticate with the network. Some providers do not provide a user name, or accept any user name when connecting to the network.
- Password
- Enter the password used to authenticate with the network. Some providers do not provide a password, or accept any password.
- APN
- Enter the Access Point Name (APN) used to establish a connection with the GSM-based network. Entering the correct APN for a connection is important because it often determines:
- how the user is billed for their network usage;
- whether the user has access to the Internet, an intranet, or a subnetwork.
- Network ID
- Entering a Network ID causes NetworkManager to force the device to register only to a specific network. This can be used to ensure the connection does not roam when it is not possible to control roaming directly.
- Type
- Any — The default value of Any leaves the modem to select the fastest network.3G (UMTS/HSPA) — Force the connection to use only 3G network technologies.2G (GPRS/EDGE) — Force the connection to use only 2G network technologies.Prefer 3G (UMTS/HSPA) — First attempt to connect using a 3G technology such as HSPA or UMTS, and fall back to GPRS or EDGE only upon failure.Prefer 2G (GPRS/EDGE) — First attempt to connect using a 2G technology such as GPRS or EDGE, and fall back to HSPA or UMTS only upon failure.
- Allow roaming if home network is not available
- Uncheck this box if you want NetworkManager to terminate the connection rather than transition from the home network to a roaming one, thereby avoiding possible roaming charges. If the box is checked, NetworkManager will attempt to maintain a good connection by transitioning from the home network to a roaming one, and vice versa.
- PIN
- If your device's SIM (Subscriber Identity Module) is locked with a PIN (Personal Identification Number), enter the PIN so that NetworkManager can unlock the device. NetworkManager must unlock the SIM if a PIN is required in order to use the device for any purpose.
APN, Network ID, or Type options.
Saving Your New (or Modified) Connection and Making Further Configurations
- Point-to-point settings for the connection, click the PPP Settings tab and proceed to Section 5.6, “Configuring PPP (Point-to-Point) Settings”;
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”; or,IPv6settings for the connection, click the IPv6 Settings tab and proceed to Section 5.5, “Configuring IPv6 Settings”.
3.4.10. Configuring a DSL Connection with a GUI Copy linkLink copied to clipboard!
3.4.10.1. Configuring a DSL Connection with nm-connection-editor Copy linkLink copied to clipboard!
Adding a New DSL Connection
Procedure
- Enter nm-connection-editor in a terminal. The Network Connections window appears, see Section 3.4.3, “Common Configuration Options Using nm-connection-editor”.
- Click the plus button.
- The Choose a Connection Type list appears.
- Select and press the button.
- The Editing DSL Connection 1 window appears.
Editing an Existing DSL Connection
Procedure
- Enter nm-connection-editor in a terminal. The Network Connections window appears.
- Select the connection you want to edit and click the gear wheel icon. See Section 3.4.3, “Common Configuration Options Using nm-connection-editor” for more information.
Configuring the DSL Tab
- Username
- Enter the user name used to authenticate with the service provider.
- Service
- Leave blank unless otherwise directed by your service provider.
- Password
- Enter the password supplied by the service provider.
Saving Your New (or Modified) Connection and Making Further Configurations
- The MAC address and MTU settings, click the Wired tab and proceed to the section called “Basic Configuration Options ”.
- Point-to-point settings for the connection, click the PPP Settings tab and proceed to Section 5.6, “Configuring PPP (Point-to-Point) Settings”.
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”.
3.5. Configuring IP Networking with ifcfg Files Copy linkLink copied to clipboard!
ifcfg files.
ifcfg-name, where the suffix name refers to the name of the device that the configuration file controls. By convention, the ifcfg file's suffix is the same as the string given by the DEVICE directive in the configuration file itself.
Configuring an Interface with Static Network Settings Using ifcfg Files
ifcfg files, for an interface with the name enp1s0, create a file with the name ifcfg-enp1s0 in the /etc/sysconfig/network-scripts/ directory, that contains:
- For
IPv4configurationCopy to Clipboard Copied! Toggle word wrap Toggle overflow - For
IPv6configurationYou do not need to specify the network or broadcast address as this is calculated automatically by ipcalc.Copy to Clipboard Copied! Toggle word wrap Toggle overflow For moreIPv6ifcfg configuration options, see nm-settings-ifcfg-rh(5) man page.
Important
HWADDR directive can influence the device naming procedure.
Configuring an Interface with Dynamic Network Settings Using ifcfg Files
ifcfg files:
- Create a file with the name
ifcfg-em1in the/etc/sysconfig/network-scripts/directory, that contains:DEVICE=em1 BOOTPROTO=dhcp ONBOOT=yes
DEVICE=em1 BOOTPROTO=dhcp ONBOOT=yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To configure an interface to send a different host name to the
DHCPserver, add the following line to theifcfgfile:DHCP_HOSTNAME=hostname
DHCP_HOSTNAME=hostnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow To configure an interface to send a different fully qualified domain name (FQDN) to theDHCPserver, add the following line to theifcfgfile:DHCP_FQDN=fully.qualified.domain.name
DHCP_FQDN=fully.qualified.domain.nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note
Only one directive, eitherDHCP_HOSTNAMEorDHCP_FQDN, should be used in a givenifcfgfile. In case bothDHCP_HOSTNAMEandDHCP_FQDNare specified, only the latter is used. - To configure an interface to use particular
DNSservers, add the following lines to theifcfgfile:where ip-address is the address of aPEERDNS=no DNS1=ip-address DNS2=ip-address
PEERDNS=no DNS1=ip-address DNS2=ip-addressCopy to Clipboard Copied! Toggle word wrap Toggle overflow DNSserver. This will cause the network service to update/etc/resolv.confwith the specifiedDNSservers specified. Only oneDNSserver address is necessary, the other is optional. - To configure static routes in the
ifcfgfile, see Section 4.5, “Configuring Static Routes in ifcfg files”.By default, NetworkManager calls theDHCPclient, dhclient, when a profile has been set to obtain addresses automatically by settingBOOTPROTOtodhcpin an interface configuration file. IfDHCPis required, an instance of dhclient is started for every Internet protocol,IPv4andIPv6, on an interface. If NetworkManager is not running, or is not managing an interface, then the legacy network service will call instances of dhclient as required. For more details on dynamic IP addresses, see Section 1.2, “Comparing Static to Dynamic IP Addressing”. - To apply the configuration:
- Reload the updated connection files:
nmcli connection reload
# nmcli connection reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Re-activate the connection:
nmcli connection up connection_name
# nmcli connection up connection_nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.5.1. Managing System-wide and Private Connection Profiles with ifcfg Files Copy linkLink copied to clipboard!
USERS directive in the ifcfg files. If the USERS directive is not present, the network profile will be available to all users. As an example, the following command in an ifcfg file will make the connection available only to the users listed: USERS="joe bob alice"
USERS="joe bob alice"
USERCTL directive to manage the device:
- If you set yes, non-
rootusers are allowed to control this device. - If you set no, non-
rootusers are not allowed to control this device.
3.6. Configuring IP Networking with ip Commands Copy linkLink copied to clipboard!
ip command, but but changes are not persistent across reboots; when you reboot, you will lose any changes.
man ip(8) page. The package name in Red Hat Enterprise Linux 7 is iproute. If necessary, you can check that the ip utility is installed by checking its version number as follows:
ip -V
~]$ ip -V
ip utility, iproute2-ss130716
ip link set ifname down
ip link set ifname down
Note
ip link set ifname command sets a network interface in IFF_UP state and enables it from the kernel's scope. This is different from the ifup ifname command for initscripts or NetworkManager's activation state of a device. In fact, NetworkManager always sets an interface up even if it is currently disconnected. Disconnecting the device through the nmcli tool, does not remove the IFF_UP flag. In this way, NetworkManager gets notifications about the carrier state.
ifconfig utility because the net-tools package (which provides ifconfig) does not support InfiniBand addresses.
ip help command. For example: ip link help and ip addr help.
Note
ifcfg files) or add the commands to a script.
IP addresses to an interface with the following form: ip addr [ add | del ] address dev ifname
ip addr [ add | del ] address dev ifname
Assigning a Static Address Using ip Commands
IP address to an interface:
ip-address(8) manual page.
Configuring Multiple Addresses Using ip Commands
ip(8) manual page.
Note
3.7. Configuring IP Networking from the Kernel Command line Copy linkLink copied to clipboard!
- Install the dracut utility. For information on using dracut, see Red Hat Enterprise Linux System Administrator's Guide
- Set the configuration using the
ipoption on the kernel command line:ip<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{dhcp|dhcp6|auto6|on|any|none|off}ip<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{dhcp|dhcp6|auto6|on|any|none|off}Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:dhcp- DHCP configurationdhpc6- DHCP IPv6 configurationauto6- automatic IPv6 configurationon,any- any protocol available in the kernel (default)none,off- no autoconfiguration, static network configuration
ip=192.168.180.120:192.168.180.100:192.168.180.1:255.255.255.0::enp1s0:off
ip=192.168.180.120:192.168.180.100:192.168.180.1:255.255.255.0::enp1s0:offCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the name server configuration:
nameserver=srv1 [nameserver=srv2 [nameserver=srv3 […]]]
nameserver=srv1 [nameserver=srv2 [nameserver=srv3 […]]]Copy to Clipboard Copied! Toggle word wrap Toggle overflow
ifcfg files that can be copied to the /etc/sysconfig/network-scripts/ file.
3.8. Enabling IP Multicast with IGMP Copy linkLink copied to clipboard!
ip maddr show subcommand, for example:
MULTICAST string in the ip link show command output, for example:
ip link show br0
~]$ ip link show br0
8: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
link/ether 6c:0b:84:67:fe:63 brd ff:ff:ff:ff:ff:ff
ip link set multicast off dev br0 ip link show br0
~]# ip link set multicast off dev br0
~]$ ip link show br0
8: br0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
link/ether 6c:0b:84:67:fe:63 brd ff:ff:ff:ff:ff:ff
MULTICAST string indicates that multicast is disabled.
ip link set multicast on dev br0 ip link show br0
~]# ip link set multicast on dev br0
~]$ ip link show br0
8: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
link/ether 6c:0b:84:67:fe:63 brd ff:ff:ff:ff:ff:ff
ip(8) man page for more information.
/proc/net/igmp file:
cat /proc/net/igmp
~]$ cat /proc/net/igmp
Note
firewalld by default. To enable IGMP for a zone:
firewall-cmd --zone=zone-name --add-protocol=igmp
~]# firewall-cmd --zone=zone-name --add-protocol=igmp
3.9. Additional Resources Copy linkLink copied to clipboard!
Installed Documentation
- ip(8) man page — Describes the ip utility's command syntax.
- nmcli(1) man page — Describes NetworkManager's command‐line tool.
- nmcli-examples(5) man page — Gives examples of nmcli commands.
- nm-settings(5) man page — Describes NetworkManager properties and their settings.
- nm-settings-ifcfg-rh(5) man page — Describes ifcfg-rh settings plug-in.
Online Documentation
- Red Hat Enterprise Linux 7 Security Guide
- Describes
IPsecbased VPN and its configuration. Describes the use of authenticatedDNSqueries using DNSSEC. - RFC 1518 — Classless Inter-Domain Routing (CIDR)
- Describes the CIDR Address Assignment and Aggregation Strategy, including variable-length subnetting.
- RFC 1918 — Address Allocation for Private Internets
- Describes the range of
IPv4addresses reserved for private use. - RFC 3330 — Special-Use IPv4 Addresses
- Describes the global and other specialized
IPv4address blocks that have been assigned by the Internet Assigned Numbers Authority (IANA).
Chapter 4. Configuring Static Routes and the Default Gateway Copy linkLink copied to clipboard!
4.1. Introduction to Understanding Routing and Gateway Copy linkLink copied to clipboard!
DHCP, an address of a gateway that leads to an upstream network or the Internet is usually assigned. This gateway is usually referred to as the default gateway as it is the gateway to use if no better route is known to the system (and present in the routing table). Network administrators often use the first or last host IP address in the network as the gateway address; for example, 192.168.10.1 or 192.168.10.254. Not to be confused by the address which represents the network itself; in this example, 192.168.10.0, or the subnet's broadcast address; in this example 192.168.10.255. The default gateway is traditionally a network router. The default gateway is for any and all traffic which is not destined for the local network and for which no preferred route is specified in the routing table.
Note
4.2. Configuring Static Routes Using nmcli Copy linkLink copied to clipboard!
- the nmcli command line
- the nmcli interactive editor
Example 4.1. Configuring Static Routes Using nmcli
nmcli connection modify enp1s0 +ipv4.routes "192.168.122.0/24 10.10.10.1"
~]# nmcli connection modify enp1s0 +ipv4.routes "192.168.122.0/24 10.10.10.1"
192.168.122.0/24 subnet to the gateway at 10.10.10.1
Example 4.2. Configuring Static Routes with nmcli Editor
4.3. Configuring Static Routes with GUI Copy linkLink copied to clipboard!
- Routes
- — Enter the
IPaddress of a remote network, sub-net, or host.— The netmask or prefix length of theIPaddress entered above.— TheIPaddress of the gateway leading to the remote network, sub-net, or host entered above.— A network cost, a preference value to give to this route. Lower values will be preferred over higher values. - When Automatic is ON, routes from
RAorDHCPare used, but you can also add additional static routes. When OFF, only static routes you define are used. - Use this connection only for resources on its network
- Select this check box to prevent the connection from becoming the default route. Typical examples are where a connection is a VPN tunnel or a leased line to a head office and you do not want any Internet-bound traffic to pass over the connection. Selecting this option means that only traffic specifically destined for routes learned automatically over the connection or entered here manually will be routed over the connection.
4.4. Configuring Static Routes with ip commands Copy linkLink copied to clipboard!
ip route command.
IP routing table, use the ip route command. For example:
ip route
~]$ ip route
default via 192.168.122.1 dev ens9 proto static metric 1024
192.168.122.0/24 dev ens9 proto kernel scope link src 192.168.122.107
192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.126
ip route commands take the following form: ip route [ add | del | change | append | replace ] destination-address
ip route [ add | del | change | append | replace ] destination-address
ip-route(8) man page for more details on the options and formats.
ip route add 192.0.2.1 via 10.0.0.1 [dev interface]
~]# ip route add 192.0.2.1 via 10.0.0.1 [dev interface]
IP address of the host in dotted decimal notation, 10.0.0.1 is the next hop address and interface is the exit interface leading to the next hop.
IP address representing a range of IP addresses:
ip route add 192.0.2.0/24 via 10.0.0.1 [dev interface]
~]# ip route add 192.0.2.0/24 via 10.0.0.1 [dev interface]
IP address of the destination network in dotted decimal notation and /24 is the network prefix. The network prefix is the number of enabled bits in the subnet mask. This format of network address slash network prefix length is sometimes referred to as classless inter-domain routing (CIDR) notation.
ip route del 192.0.2.1
~]# ip route del 192.0.2.1
ip route do not persist across system reboots. To permanently configure static routes, you can configure them by creating a route-interface file in the /etc/sysconfig/network-scripts/ directory for the interface. For example, static routes for the enp1s0 interface would be stored in the /etc/sysconfig/network-scripts/route-enp1s0 file. Any changes that you make to a route-interface file do not take effect until you restart either the network service or the interface. The route-interface file has two formats:
- ip command arguments, see the section called “Static Routes Using the IP Command Arguments Format”.and
- network/netmask directives, see the section called “Static Routes Using the Network/Netmask Directives Format”.
ip-route(8) man page for more information on the ip route command.
4.5. Configuring Static Routes in ifcfg files Copy linkLink copied to clipboard!
/etc/sysconfig/network-scripts/ directory. The file name should be of the format route-interface. There are two types of commands to use in the configuration files:
Static Routes Using the IP Command Arguments Format
/etc/sysconfig/network-scripts/route-enp1s0, define a route to a default gateway on the first line. This is only required if the gateway is not set through DHCP and is not set globally in the /etc/sysconfig/network file:
default via 192.168.1.1 dev interface
default via 192.168.1.1 dev interface
IP address of the default gateway. The interface is the interface that is connected to, or can reach, the default gateway. The dev option can be omitted, it is optional. Note that this setting takes precedence over a setting in the /etc/sysconfig/network file.
10.10.10.0/24 via 192.168.1.1 [dev interface]
10.10.10.0/24 via 192.168.1.1 [dev interface]
IP address leading to the remote network. It is preferably the next hop address but the address of the exit interface will work. The “next hop” means the remote end of a link, for example a gateway or router. The dev option can be used to specify the exit interface interface but it is not required. Add as many static routes as required.
route-interface file using the ip command arguments format. The default gateway is 192.168.0.1, interface enp1s0 and a leased line or WAN connection is available at 192.168.0.10. The two static routes are for reaching the 10.10.10.0/24 network and the 172.16.1.10/32 host:
default via 192.168.0.1 dev enp1s0 10.10.10.0/24 via 192.168.0.10 dev enp1s0 172.16.1.10/32 via 192.168.0.10 dev enp1s0
default via 192.168.0.1 dev enp1s0
10.10.10.0/24 via 192.168.0.10 dev enp1s0
172.16.1.10/32 via 192.168.0.10 dev enp1s0
192.168.0.0/24 network will be directed out the interface attached to that network. Packets going to the 10.10.10.0/24 network and 172.16.1.10/32 host will be directed to 192.168.0.10. Packets to unknown, remote, networks will use the default gateway therefore static routes should only be configured for remote networks or hosts if the default route is not suitable. Remote in this context means any networks or hosts that are not directly attached to the system.
IPv6 configuration, an example of a route6-interface file in ip route format:
2001:db8:1::/48 via 2001:db8::1 metric 2048 2001:db8:2::/48
2001:db8:1::/48 via 2001:db8::1 metric 2048
2001:db8:2::/48
ip route format can be used to specify a source address. For example:
10.10.10.0/24 via 192.168.0.10 src 192.168.0.2
10.10.10.0/24 via 192.168.0.10 src 192.168.0.2
Important
DHCP and if the same gateway with the same metric is specified in a configuration file, an error during start-up, or when bringing up an interface, will occur. The follow error message may be shown: "RTNETLINK answers: File exists". This error may be ignored.
Static Routes Using the Network/Netmask Directives Format
route-interface files. The following is a template for the network/netmask format, with instructions following afterwards:
ADDRESS0=10.10.10.0 NETMASK0=255.255.255.0 GATEWAY0=192.168.1.1
ADDRESS0=10.10.10.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.1.1
ADDRESS0=10.10.10.0is the network address of the remote network or host to be reached.NETMASK0=255.255.255.0is the netmask for the network address defined withADDRESS0=10.10.10.0.GATEWAY0=192.168.1.1is the default gateway, or anIPaddress that can be used to reachADDRESS0=10.10.10.0
route-interface file using the network/netmask directives format. The default gateway is 192.168.0.1 but a leased line or WAN connection is available at 192.168.0.10. The two static routes are for reaching the 10.10.10.0/24 and 172.16.1.0/24 networks:
ADDRESS0, ADDRESS1, ADDRESS2, and so on.
4.5.1. Understanding Policy-routing Copy linkLink copied to clipboard!
Policy-routing also known as source-routing, is a mechanism for more flexible routing configurations. Routing decisions are commonly made based on the destination IP address of a package. Policy-routing allows more flexibility to select routes based on other routing properties, such as source IP address, source port, protocol type. Routing tables stores route information about networks. They are identified by either numeric values or names, which can be configured in the /etc/iproute2/rt_tables file. The default table is identified with 254. Using policy-routing, you also need rules. Rules are used to select a routing table, based on certain properties of packets.
ip route format can be used to define an existing policy-based routing configuration, which specifies multiple routing tables:
10.10.10.0/24 via 192.168.0.10 table 1 10.10.10.0/24 via 192.168.0.10 table 2
10.10.10.0/24 via 192.168.0.10 table 1
10.10.10.0/24 via 192.168.0.10 table 2
/etc/sysconfig/network-scripts/rule-enp1s0 file for IPv4 or to the /etc/sysconfig/network-scripts/rule6-enp1s0 file for IPv6.
ipv4.route-tableforIPv4andipv6.route-tableforIPv6.
DHCP, autoconf6, DHCP6 are placed in that specific table. In addition, all routes for subnets that have already configured addresses, are placed in the corresponding routing table. For example, if you configure the 192.168.1.10/24 address, the 192.168.1.0/24 subnet is contained in ipv4.route-table.
policy-routing rules, see the ip-rule(8) man page. For routing tables, see the ip-route(8) man page.
4.6. Configuring the Default Gateway Copy linkLink copied to clipboard!
/etc/sysconfig/network file first and then the network interface ifcfg files for interfaces that are “up”. The ifcfg files are parsed in numerically ascending order, and the last GATEWAY directive to be read is used to compose a default route in the routing table.
/etc/sysconfig/network file is deprecated, and specifying the gateway should now only be done in per-interface configuration files.
DHCP. In special cases where it is necessary to influence NetworkManager's selection of the exit interface to be used to reach a gateway, make use of the DEFROUTE=no command in the ifcfg files for those interfaces which do not lead to the default gateway.
Chapter 5. Configuring Network Connection Settings Copy linkLink copied to clipboard!
5.1. Configuring 802.3 Link Settings Copy linkLink copied to clipboard!
802-3-ethernet.auto-negotiate802-3-ethernet.speed802-3-ethernet.duplex
- Ignore link negotiation
- Enforce auto-negotiation activation
- Manually set the
speedandduplexlink settings
Ignoring link negotiation
802-3-ethernet.auto-negotiate = no 802-3-ethernet.speed = 0 802-3-ethernet.duplex = NULL
802-3-ethernet.auto-negotiate = no
802-3-ethernet.speed = 0
802-3-ethernet.duplex = NULL
Important
auto-negotiate parameter is set to no, but the speed and duplex values are not set, that does not mean that auto-negotiation is disabled.
Enforcing auto-negotiation activation
802-3-ethernet.auto-negotiate = yes 802-3-ethernet.speed = 0 802-3-ethernet.duplex = NULL
802-3-ethernet.auto-negotiate = yes
802-3-ethernet.speed = 0
802-3-ethernet.duplex = NULL
Manually setting the link speed and duplex
speed and duplex settings on the link.
speed and duplex link settings, set the aforementioned parameters as follows:
802-3-ethernet.auto-negotiate = no 802-3-ethernet.speed = [speed in Mbit/s] 802-3-ethernet.duplex = [half |full]
802-3-ethernet.auto-negotiate = no
802-3-ethernet.speed = [speed in Mbit/s]
802-3-ethernet.duplex = [half |full]
Important
speed and the duplex values, otherwise NetworkManager does not update the link configuration.
- the nmcli tool
- the nm-connection-editor utility
Configuring 802.3 Link Settings with the nmcli Tool
Procedure
- Create a new ethernet connection for the enp1s0 device.
- Set the 802.3 link setting to a configuration of your choice. For details, see Section 5.1, “Configuring 802.3 Link Settings”For example, to manually set the
speedoption 100 Mbit/s andduplexto full:nmcli connection add con-name MyEthernet type ethernet ifname enp1s0 \ 802-3-ethernet.auto-negotiate no \ 802-3-ethernet.speed 100 \ 802-3-ethernet.duplex full
nmcli connection add con-name MyEthernet type ethernet ifname enp1s0 \ 802-3-ethernet.auto-negotiate no \ 802-3-ethernet.speed 100 \ 802-3-ethernet.duplex fullCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Configuring 802.3 Link Settings with nm-connection-editor
Procedure
- Enter nm-connection-editor in a terminal.
- Select the ethernet connection you want to edit and click the gear wheel icon to move to the editing dialog. See Section 3.4.3, “Common Configuration Options Using nm-connection-editor” for more information.
- Select the link negotiation of your choice.
Ignore: link configuration is skipped (default).Automatic: link auto-negotiation is enforced on the device.Manual: theSpeedandDuplexoptions can be specified to enforce the link negotiation.
Figure 5.1. Configure 802.3 link settings using nm-connection-editor
5.2. Configuring 802.1X Security Copy linkLink copied to clipboard!
DHCP servers were configured not to lease IP addresses to unauthorized users, but for various reasons this practice is both impractical and insecure, and thus is no longer recommended. Instead, 802.1X security is used to ensure a logically-secure network through port-based authentication.
5.2.1. Configuring 802.1X Security for Wi-Fi with nmcli Copy linkLink copied to clipboard!
Procedure
- Set the authenticated
key-mgmt(key management) protocol. It configures the keying mechanism for a securewificonnection. See the nm-settings(5) man page for more details on properties. - Configure the 802-1x authentication settings. For the Transport Layer Security (TLS) authentication, see the section called “Configuring TLS Settings”.
| 802-1x authentication setting | Name | |
|---|---|---|
| 802-1x.identity | Identity | |
| 802-1x.ca-cert | CA certificate | |
| 802-1x.client-cert | User certificate | |
| 802-1x.private-key | Private key | |
| 802-1x.private-key-password | Private key password |
5.2.2. Configuring 802.1X Security for Wired with nmcli Copy linkLink copied to clipboard!
wired connection using the nmcli tool, follow the same procedure as for a wireless connection, except the 802-11-wireless.ssid and 802-11-wireless-security.key-mgmt settings.
5.2.3. Configuring 802.1X Security for Wi-Fi with a GUI Copy linkLink copied to clipboard!
Procedure
- Open the Network window (see Section 3.4.1, “Connecting to a Network Using the control-center GUI”).
- Select a Wireless network interface from the right-hand-side menu. If necessary, set the symbolic power button to ON and check that your hardware switch is on.
- Either select the connection name of a new connection, or click the gear wheel icon of an existing connection profile, for which you want to configure 802.1X security. In the case of a new connection, complete any authentication steps to complete the connection and then click the gear wheel icon.
- Select Security.The following configuration options are available:
- Security
- — Do not encrypt the Wi-Fi connection.— Wired Equivalent Privacy (WEP), from the IEEE 802.11 standard. Uses a single pre-shared key (PSK).— An MD5 hash of the passphrase will be used to derive a WEP key.— Lightweight Extensible Authentication Protocol, from Cisco Systems.— WEP keys are changed dynamically. Use with the section called “Configuring TLS Settings”— Wi-Fi Protected Access (WPA), from the draft IEEE 802.11i standard. A replacement for WEP. Wi-Fi Protected Access II (WPA2), from the 802.11i-2004 standard. Personal mode uses a pre-shared key (WPA-PSK).— WPA for use with a RADIUS authentication server to provide IEEE 802.1X network access control. Use with the section called “Configuring TLS Settings”
- Password
- Enter the password to be used in the authentication process.
- From the drop-down menu select one of the following security methods: , , or .
5.2.4. Configuring 802.1X Security for Wired with nm-connection-editor Copy linkLink copied to clipboard!
Procedure
- Enter the nm-connection-editor in a terminal.The
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow Network Connectionswindow appears. - Select the ethernet connection you want to edit and click the gear wheel icon, see Section 3.4.6.2, “Configuring a Wired Connection with nm-connection-editor”.
- Select Security and set the symbolic power button to ON to enable settings configuration.
- Select from one of following authentication methods:
- Select TLS for Transport Layer Security and proceed to the section called “Configuring TLS Settings”;
- Select FAST for Flexible Authentication through Secure Tunneling and proceed to the section called “Configuring Tunneled TLS Settings”;
- Select Tunneled TLS for Tunneled Transport Layer Security, otherwise known as TTLS, or EAP-TTLS and proceed to the section called “Configuring Tunneled TLS Settings”;
- Select Protected EAP (PEAP) for Protected Extensible Authentication Protocol and proceed to the section called “Configuring Protected EAP (PEAP) Settings”.
Configuring TLS Settings
- Identity
- Provide the identity of this server.
- User certificate
- Click to browse for, and select, a personal X.509 certificate file encoded with Distinguished Encoding Rules (DER) or Privacy Enhanced Mail (PEM).
- CA certificate
- Click to browse for, and select, an X.509 certificate authority certificate file encoded with Distinguished Encoding Rules (DER) or Privacy Enhanced Mail (PEM).
- Private key
- Click to browse for, and select, a private key file encoded with Distinguished Encoding Rules (DER), Privacy Enhanced Mail (PEM), or the Personal Information Exchange Syntax Standard (PKCS #12).
- Private key password
- Enter the password for the private key in the Private key field. Select Show password to make the password visible as you type it.
Configuring FAST Settings
- Anonymous Identity
- Provide the identity of this server.
- PAC provisioning
- Select the check box to enable and then select from , , and .
- PAC file
- Click to browse for, and select, a protected access credential (PAC) file.
- Inner authentication
- — Generic Token Card.— Microsoft Challenge Handshake Authentication Protocol version 2.
- Username
- Enter the user name to be used in the authentication process.
- Password
- Enter the password to be used in the authentication process.
Configuring Tunneled TLS Settings
- Anonymous identity
- This value is used as the unencrypted identity.
- CA certificate
- Click to browse for, and select, a Certificate Authority's certificate.
- Inner authentication
- — Password Authentication Protocol.— Challenge Handshake Authentication Protocol.— Microsoft Challenge Handshake Authentication Protocol version 2.— Challenge Handshake Authentication Protocol.
- Username
- Enter the user name to be used in the authentication process.
- Password
- Enter the password to be used in the authentication process.
Configuring Protected EAP (PEAP) Settings
- Anonymous Identity
- This value is used as the unencrypted identity.
- CA certificate
- Click to browse for, and select, a Certificate Authority's certificate.
- PEAP version
- The version of Protected EAP to use. Automatic, 0 or 1.
- Inner authentication
- — Microsoft Challenge Handshake Authentication Protocol version 2.— Message Digest 5, a cryptographic hash function.— Generic Token Card.
- Username
- Enter the user name to be used in the authentication process.
- Password
- Enter the password to be used in the authentication process.
5.3. Using MACsec with wpa_supplicant and NetworkManager Copy linkLink copied to clipboard!
Media Access Control Security (MACsec, IEEE 802.1AE) encrypts and authenticates all traffic in LANs with the GCM-AES-128 algorithm. MACsec can protect not only IP but also Address Resolution Protocol (ARP), Neighbor Discovery (ND), or DHCP. While IPsec operates on the network layer (layer 3) and SSL or TLS on the application layer (layer 7), MACsec operates in the data link layer (layer 2). Combine MACsec with security protocols for other networking layers to take advantage of different security features that these standards provide.
MACsec with a switch that performs authentication using a pre-shared Connectivity Association Key/CAK Name (CAK/CKN) pair:
Procedure
- Create a CAK/CKN pair. For example, the following command generates a 16-byte key in hexadecimal notation:
dd if=/dev/urandom count=16 bs=1 2> /dev/null | hexdump -e '1/2 "%02x"'
~]$ dd if=/dev/urandom count=16 bs=1 2> /dev/null | hexdump -e '1/2 "%02x"'Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the
wpa_supplicant.confconfiguration file and add the following lines to it:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the values from the previous step to complete themka_cakandmka_cknlines in thewpa_supplicant.confconfiguration file.See thewpa_supplicant.conf(5)man page for more information. - Assuming you are using wlp61s0 to connect to your network, start wpa_supplicant using the following command:
wpa_supplicant -i wlp61s0 -Dmacsec_linux -c wpa_supplicant.conf
~]# wpa_supplicant -i wlp61s0 -Dmacsec_linux -c wpa_supplicant.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow
wpa_supplicant.conf file, Red Hat recommends using the nmcli command to configure wpa_supplicant equivalently as in the previous steps. The following example assumes that you already have a 16-byte hexadecimal CAK ($MKA_CAK) and a 32-byte hexadecimal CKN ($MKA_CKN):
MACsec network, use case scenarios, and configuration examples.
5.4. Configuring IPv4 Settings Copy linkLink copied to clipboard!
Configuring IPv4 Settings with control-center
Procedure
- Press the Super key to enter the Activities Overview, type Settings and then press Enter. Then, select the
Networktab on the left-hand side, and the Network settings tool appears. Proceed to the section called “Configuring New Connections with control-center”. - Select the connection that you want to edit and click on the gear wheel icon. The
Editingdialog appears. - Click the IPv4 menu entry.
IP address,DNS and route information as required. The IPv4 menu entry is available when you create and modify one of the following connection types: wired, wireless, mobile broadband, VPN or DSL.
DHCP to obtain a dynamic IP address from a DHCP server, you can simply set Addresses to .
Setting the Method for IPV4 Using nm-connection-editor
IPv4 settings:
Procedure
- Enter nm-connection-editor in a terminal.
- For an existing connection type, click the gear wheel icon.
Figure 5.2. Editing a connection
- Click IPv4 Settings.
Figure 5.3. Configuring IPv4 Settings
Available IPv4 Methods by Connection Type
IPv4 connection methods. All of the methods are listed here according to which connection type, or types, they are associated with:
- Wired, Wireless and DSL Connection Methods
- — Choose this option if the network you are connecting to uses a
DHCPserver to assignIPaddresses. You do not need to fill in the DHCP client ID field.— Choose this option if the network you are connecting to uses aDHCPserver to assignIPaddresses but you want to assignDNSservers manually.— Choose this option if you want to assignIPaddresses manually.— Choose this option if the network you are connecting to does not have aDHCPserver and you do not want to assignIPaddresses manually. Random addresses will be assigned as per RFC 3927 with prefix169.254/16.— Choose this option if the interface you are configuring is for sharing an Internet or WAN connection. The interface is assigned an address in the10.42.x.1/24range, aDHCPserver andDNSserver are started, and the interface is connected to the default network connection on the system with network address translation (NAT).—IPv4is disabled for this connection. - Mobile Broadband Connection Methods
- — Choose this option if the network you are connecting to assigns your
IPaddress andDNSservers automatically.— Choose this option if the network you are connecting to assigns yourIPaddress automatically, but you want to manually specifyDNSservers. - VPN Connection Methods
- — Choose this option if the network you are connecting to assigns your
IPaddress andDNSservers automatically.— Choose this option if the network you are connecting to assigns yourIPaddress automatically, but you want to manually specifyDNSservers. - DSL Connection Methods
- — Choose this option if the network you are connecting to assigns your
IPaddress andDNSservers automatically.— Choose this option if the network you are connecting to assigns yourIPaddress automatically, but you want to manually specifyDNSservers.
DHCP to obtain a dynamic IP address from a DHCP server, you can simply set Method to .
5.5. Configuring IPv6 Settings Copy linkLink copied to clipboard!
IPv6 settings, follow the procedure described in Section 5.4, “Configuring IPv4 Settings” and click the IPv6 menu entry.
- Method
- — Choose this option if you want to ignore
IPv6settings for this connection.— Choose this option to use SLAAC to create an automatic, stateless configuration based on the hardware address and router advertisements (RA).— Choose this option if the network you are connecting to uses router advertisements (RA) to create an automatic, stateless configuration, but you want to assignDNSservers manually.— Choose this option to not use RA, but request information fromDHCPv6directly to create a stateful configuration.— Choose this option if you want to assignIPaddresses manually.— Choose this option if the network you are connecting to does not have aDHCPserver and you do not want to assignIPaddresses manually. Random addresses will be assigned as per RFC 4862 with prefixFE80::0. - Addresses
- — Enter a comma separated list of
DNSservers.— Enter a comma separated list of domain controllers.
5.6. Configuring PPP (Point-to-Point) Settings Copy linkLink copied to clipboard!
Authentication Methods
- Use point-to-point encryption (MPPE)
- Microsoft Point-To-Point Encryption protocol (RFC 3078).
- Allow BSD data compression
- PPP BSD Compression Protocol (RFC 1977).
- Allow Deflate data compression
- PPP Deflate Protocol (RFC 1979).
- Use TCP header compression
- Compressing TCP/IP Headers for Low-Speed Serial Links (RFC 1144).
- Send PPP echo packets
- LCP Echo-Request and Echo-Reply Codes for loopback tests (RFC 1661).
Note
Chapter 6. Configure Host Names Copy linkLink copied to clipboard!
6.1. Understanding Host Names Copy linkLink copied to clipboard!
hostname: static, pretty, and transient.
hostname, which can be chosen by the user, and is stored in the /etc/hostname file. The “transient” hostname is a dynamic host name maintained by the kernel. It is initialized to the static host name by default, whose value defaults to “localhost”. It can be changed by DHCP or mDNS at runtime. The “pretty” hostname is a free-form UTF8 host name for presentation to the user.
Note
DNS, such as host.example.com. It is also recommended that the static and transient names consists only of 7 bit ASCII lower-case characters, no spaces or dots, and limits itself to the format allowed for DNS domain name labels, even though this is not a strict requirement. Older specifications do not permit the underscore, and so their use is not recommended.
a-z, A-Z, 0-9, “-”, “_” and “.” only, to not begin or end in a dot, and to not have two dots immediately following each other. The size limit of 64 characters is enforced.
6.1.1. Recommended Naming Practices Copy linkLink copied to clipboard!
.yourcompany) to the public register. Therefore, Red Hat strongly recommends that you do not use a domain name that is not delegated to you, even on a private network, as this can result in a domain name that resolves differently depending on network configuration. As a result, network resources can become unavailable. Using domain names that are not delegated to you also makes DNSSEC more difficult to deploy and maintain, as domain name collisions require manual configuration to enable DNSSEC validation. See the ICANN FAQ on domain name collision for more information on this issue.
6.2. Configuring Host Names Using Text User Interface, nmtui Copy linkLink copied to clipboard!
nmtui
~]$ nmtui
Figure 6.1. The NetworkManager Text User Interface starting menu
/etc/hostname file.
Important
systemd-hostnamed service to read and write the static host name, which is stored in the /etc/hostname file. Due to this, manual modifications done to the /etc/hostname file are no longer picked up automatically by NetworkManager; you should change the system host name through the hostnamectl utility. Also, the use of the HOSTNAME variable in the /etc/sysconfig/network file is now deprecated.
6.3. Configuring Host Names Using hostnamectl Copy linkLink copied to clipboard!
6.3.1. View All the Host Names Copy linkLink copied to clipboard!
hostnamectl status
~]$ hostnamectl status
status option is implied by default if no option is given.
6.3.2. Set All the Host Names Copy linkLink copied to clipboard!
root:
hostnamectl set-hostname name
~]# hostnamectl set-hostname name
-” and special characters will be removed.
6.3.3. Set a Particular Host Name Copy linkLink copied to clipboard!
root with the relevant option:
hostnamectl set-hostname name [option...]
~]# hostnamectl set-hostname name [option...]
--pretty, --static, and --transient.
--static or --transient options are used together with the --pretty option, the static and transient host names will be simplified forms of the pretty host name. Spaces will be replaced with “-” and special characters will be removed. If the --pretty option is not given, no simplification takes place.
hostnamectl set-hostname "Stephen's notebook" --pretty
~]# hostnamectl set-hostname "Stephen's notebook" --pretty
6.3.4. Clear a Particular Host Name Copy linkLink copied to clipboard!
root with the relevant option:
hostnamectl set-hostname "" [option...]
~]# hostnamectl set-hostname "" [option...]
--pretty, --static, and --transient.
6.3.5. Changing Host Names Remotely Copy linkLink copied to clipboard!
hostnamectl command on a remote system, use the -H, --host option as follows:
hostnamectl set-hostname -H [username]@hostname
~]# hostnamectl set-hostname -H [username]@hostname
SSH to connect to the remote system.
6.4. Configuring Host Names Using nmcli Copy linkLink copied to clipboard!
/etc/hostname file.
nmcli general hostname
~]$ nmcli general hostname
root:
nmcli general hostname my-server
~]# nmcli general hostname my-server
6.5. Additional Resources Copy linkLink copied to clipboard!
hostnamectl(1)man page — Describes hostnamectl including the commands and command options.hostname(1)man page — Contains an explanation of thehostnameanddomainnamecommands.hostname(5)man page — Contains an explanation of the host name file, its contents, and use.hostname(7)man page — Contains an explanation of host name resolution.machine-info(5)man page — Describes the local machine information file and the environment variables it contains.machine-id(5)man page — Describes the local machine ID configuration file.systemd-hostnamed.service(8)man page — Describes thesystemd-hostnamedsystem service used by hostnamectl.
Chapter 7. Configure Network Bonding Copy linkLink copied to clipboard!
Warning
Note
7.1. Understanding the Default Behavior of Controller and Port Interfaces Copy linkLink copied to clipboard!
NetworkManager daemon, and especially when fault finding, keep the following in mind:
- Starting the controller interface does not automatically start the port interfaces.
- Starting a port interface always starts the controller interface.
- Stopping the controller interface also stops the port interfaces.
- A controller without ports can start static
IPconnections. - A controller without ports waits for ports when starting
DHCPconnections. - A controller with a
DHCPconnection waiting for ports completes when a port with a carrier is added. - A controller with a
DHCPconnection waiting for ports continues waiting when a port without a carrier is added.
7.2. Configure Bonding Using the Text User Interface, nmtui Copy linkLink copied to clipboard!
nmtui
~]$ nmtui
- From the starting menu, select Edit a connection. Select Add, the New Connection screen opens.
Figure 7.1. The NetworkManager Text User Interface Add a Bond Connection menu
- Select Bond and then Create; the Edit connection screen for the bond will open.
Figure 7.2. The NetworkManager Text User Interface Configuring a Bond Connection menu
- At this point port interfaces will need to be added to the bond; to add these select Add, the New Connection screen opens. Once the type of Connection has been chosen select the Create button.
Figure 7.3. The NetworkManager Text User Interface Configuring a New Bond Slave Connection menu
- The port's Edit Connection display appears; enter the required port's device name or MAC address in the Device section. If required, enter a clone MAC address to be used as the bond's MAC address by selecting Show to the right of the Ethernet label. Select the OK button to save the port.
Note
If the device is specified without a MAC address the Device section will be automatically populated once the Edit Connection window is reloaded, but only if it successfully finds the device.Figure 7.4. The NetworkManager Text User Interface Configuring a Bond Slave Connection menu
- The name of the bond port appears in the Slaves section. Repeat the above steps to add further port connections.
- Review and confirm the settings before selecting the OK button.
Figure 7.5. The NetworkManager Text User Interface Completed Bond
7.3. Network Bonding Using the NetworkManager Command Line Tool, nmcli Copy linkLink copied to clipboard!
Note
bond connection with the nmcli tool, issue the following command:
nmcli con add type bond ifname mybond0
~]$ nmcli con add type bond ifname mybond0
Connection 'bond-mybond0' (5f739690-47e8-444b-9620-1895316a28ba) successfully added.
con-name was given for the bond, the connection name was derived from the interface name by prepending the type.
nmcli con add type bond ifname mybond0 bond.options "mode=balance-rr,miimon=100"
~]$ nmcli con add type bond ifname mybond0 bond.options "mode=balance-rr,miimon=100"
Connection 'bond-mybond0' (5f739690-47e8-444b-9620-1895316a28ba) successfully added.
- Create a new connection, see Section 3.3.5, “Creating and Modifying a Connection Profile with nmcli” for details.
- Set the controller property to the
bondinterface name, or to the name of the controller connection:
nmcli con add type ethernet ifname ens3 master mybond0
~]$ nmcli con add type ethernet ifname ens3 master mybond0
Connection 'bond-slave-ens3' (220f99c6-ee0a-42a1-820e-454cbabc2618) successfully added.
port interface, repeat the previous command with the new interface. For example:
nmcli con add type ethernet ifname ens7 master mybond0
~]$ nmcli con add type ethernet ifname ens7 master mybond0
Connection 'bond-slave-ens7' (ecc24c75-1c89-401f-90c8-9706531e0231) successfully added.
nmcli con up bond-slave-ens7
~]$ nmcli con up bond-slave-ens7
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/14)
nmcli con up bond-slave-ens3
~]$ nmcli con up bond-slave-ens3
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/15)
active_slave option and the primary option of the bond at runtime, without deactivating the connection. For example to change the active_slave option, issue the following command:
nmcli dev mod bond0 +bond.options "active_slave=ens7"
~]$ nmcli dev mod bond0 +bond.options "active_slave=ens7"
Connection successfully reapplied to device 'bond0'.
primary option:
nmcli dev mod bond0 +bond.options "primary=ens3"
~]$ nmcli dev mod bond0 +bond.options "primary=ens3"
Connection successfully reapplied to device 'bond0'.
Note
active_slave option sets the currently active port whereas the primary option of the bond specifies the active port to be automatically selected by kernel when a new port is added or a failure of the active port occurs.
7.4. Using the Command Line Interface (CLI) Copy linkLink copied to clipboard!
bonding kernel module and a special network interface called a channel bonding interface.
7.4.1. Check if Bonding Kernel Module is Installed Copy linkLink copied to clipboard!
root:
modprobe --first-time bonding
~]# modprobe --first-time bonding
BONDING_OPTS directive, the bonding module will be loaded as required and therefore does not need to be loaded separately.
modinfo bonding
~]$ modinfo bonding
modprobe(8) man page for more command options.
7.4.2. Create a Channel Bonding Interface Copy linkLink copied to clipboard!
/etc/sysconfig/network-scripts/ directory called ifcfg-bondN, replacing N with the number for the interface, such as 0.
DEVICE directive is bondN, replacing N with the number for the interface, and TYPE=Bond. In addition, set BONDING_MASTER=yes.
Example 7.1. Example ifcfg-bond0 Interface Configuration File
Important
BONDING_OPTS="bonding parameters" directive in the ifcfg-bondN interface file. Do not specify options for the bonding device in /etc/modprobe.d/bonding.conf, or in the deprecated /etc/modprobe.conf file.
max_bonds parameter is not interface specific and should not be set when using ifcfg-bondN files with the BONDING_OPTS directive as this directive will cause the network scripts to create the bond interfaces as required.
NM_CONTROLLED="no" setting is not present, NetworkManager might override settings in this configuration file.
7.4.3. Creating Port Interfaces Copy linkLink copied to clipboard!
master) and the interfaces to be bonded are referred to as the ports (slaves). After the channel bonding interface is created, the network interfaces to be bound together must be configured by adding the MASTER and SLAVE directives to the configuration files of the ports. The configuration files for each of the port interfaces can be nearly identical.
Example 7.2. Example Port Interface Configuration File
enp1s0 and enp2s0, they can both look like the following example:
ONBOOT=yes for an interface, they may race with each other and a plain TYPE=Ethernet profile may be activated instead of a bond port.
Note
NM_CONTROLLED="no" setting is not present, NetworkManager might override settings in this configuration file.
7.4.4. Activating a Channel Bond Copy linkLink copied to clipboard!
root, issue the following commands:
ifup ifcfg-enp1s0
~]# ifup ifcfg-enp1s0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
ifup ifcfg-enp2s0
~]# ifup ifcfg-enp2s0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
ifdown device_name
ifdown device_name
root:
nmcli con load /etc/sysconfig/network-scripts/ifcfg-device
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-device
nmcli con reload
~]# nmcli con reload
monitor-connection-files option in the NetworkManager.conf file. See the NetworkManager.conf(5) manual page for more information.
7.4.5. Creating Multiple Bonds Copy linkLink copied to clipboard!
BONDING_OPTS directive. This configuration method is used so that multiple bonding devices can have different configurations. To create multiple channel bonding interfaces, proceed as follows:
- Create multiple
ifcfg-bondNfiles with theBONDING_OPTSdirective; this directive will cause the network scripts to create the bond interfaces as required. - Create, or edit existing, interface configuration files to be bonded and include the
SLAVEdirective. - Assign the interfaces to be bonded, the port interfaces, to the channel bonding interfaces by means of the
MASTERdirective.
Example 7.3. Example multiple ifcfg-bondN interface configuration files
ifcfg-bond0 and ifcfg-bond1, with appropriate IP addresses.
MASTER=bondN directive. For example, continuing on from the example above, if two interfaces per bond are required, then for two bonds create four interface configuration files and assign the first two using MASTER=bond0 and the next two using MASTER=bond1.
7.5. Verifying Network Configuration Bonding for Redundancy Copy linkLink copied to clipboard!
Procedure
- Ping the destination IP from the bond interface. For example:
ping -I bond0 DSTADDR
~]# ping -I bond0 DSTADDRCopy to Clipboard Copied! Toggle word wrap Toggle overflow - View which interface is in
activemode:enp1s0 is the~]# cat /sys/class/net/bond0/bonding/active_slave enp1s0
~]# cat /sys/class/net/bond0/bonding/active_slave enp1s0Copy to Clipboard Copied! Toggle word wrap Toggle overflow activeport interface. - Set the
activeport interface down:ip link set enp1s0 down
~]# ip link set enp1s0 downCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Check if the
backupinterface is up:enp2s0 is now the~]# cat /sys/class/net/bond0/bonding/active_slave enp2s0
~]# cat /sys/class/net/bond0/bonding/active_slave enp2s0Copy to Clipboard Copied! Toggle word wrap Toggle overflow activeport interface. - Check if you can still ping the destination IP from the bond interface:
ping -I bond0 DSTADDR
~]# ping -I bond0 DSTADDRCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.6. Overview of Bonding Modes and the Required Settings on the Switch Copy linkLink copied to clipboard!
| Bonding Mode | Configuration on the Switch |
|---|---|
0 - balance-rr | Requires static Etherchannel enabled (not LACP-negotiated) |
1 - active-backup | Requires autonomous ports |
2 - balance-xor | Requires static Etherchannel enabled (not LACP-negotiated) |
3 - broadcast | Requires static Etherchannel enabled (not LACP-negotiated) |
4 - 802.3ad | Requires LACP-negotiated Etherchannel enabled |
5 - balance-tlb | Requires autonomous ports |
6 - balance-alb | Requires autonomous ports |
7.7. Using Channel Bonding Copy linkLink copied to clipboard!
miimon or arp_interval and the arp_ip_target parameters. See Section 7.7.1, “Bonding Module Directives” for a list of available options and how to quickly determine the best ones for your bonded interface.
7.7.1. Bonding Module Directives Copy linkLink copied to clipboard!
BONDING_OPTS="bonding parameters" directive in your bonding interface configuration file (ifcfg-bond0 for example). Parameters to bonded interfaces can be configured without unloading (and reloading) the bonding module by manipulating files in the sysfs file system.
sysfs is a virtual file system that represents kernel objects as directories, files and symbolic links. sysfs can be used to query for information about kernel objects, and can also manipulate those objects through the use of normal file system commands. The sysfs virtual file system is mounted under the /sys/ directory. All bonding interfaces can be configured dynamically by interacting with and manipulating files under the /sys/class/net/ directory.
ifcfg-bond0 by following the instructions in Section 7.4.2, “Create a Channel Bonding Interface”. Insert the SLAVE=yes and MASTER=bond0 directives in the configuration files for each interface bonded to bond0. Once this is completed, you can proceed to testing the parameters.
ifup bondN as root:
ifup bond0
~]# ifup bond0
ifcfg-bond0 bonding interface file, you will be able to see bond0 listed in the output of running ip link show as root:
~]$ cat /sys/class/net/bonding_masters bond0
~]$ cat /sys/class/net/bonding_masters
bond0
/sys/class/net/bondN/bonding/ directory. First, the bond you are configuring must be taken down:
ifdown bond0
~]# ifdown bond0
root:
echo 1000 > /sys/class/net/bond0/bonding/miimon
~]# echo 1000 > /sys/class/net/bond0/bonding/miimon
balance-alb mode, run either:
echo 6 > /sys/class/net/bond0/bonding/mode
~]# echo 6 > /sys/class/net/bond0/bonding/mode
echo balance-alb > /sys/class/net/bond0/bonding/mode
~]# echo balance-alb > /sys/class/net/bond0/bonding/mode
ifup bondN. If you decide to change the options, take the interface down, modify its parameters using sysfs, bring it back up, and re-test.
BONDING_OPTS= directive of the /etc/sysconfig/network-scripts/ifcfg-bondN file for the bonding interface you are configuring. Whenever that bond is brought up (for example, by the system during the boot sequence if the ONBOOT=yes directive is set), the bonding options specified in the BONDING_OPTS will take effect for that bond.
parm in modinfo bonding output, or for more detailed information, see https://www.kernel.org/doc/Documentation/networking/bonding.txt.
Bonding Interface Parameters
-
ad_select=value - Specifies the 802.3ad aggregation selection logic to use. Possible values are:The
stableor0— Default setting. The active aggregator is chosen by largest aggregate bandwidth. Reselection of the active aggregator occurs only when all ports of the active aggregator are down or if the active aggregator has no ports.bandwidthor1— The active aggregator is chosen by largest aggregate bandwidth. Reselection occurs if:- A port is added to or removed from the bond;
- Any port's link state changes;
- Any port's 802.3ad association state changes;
- The bond's administrative state changes to up.
countor2— The active aggregator is chosen by the largest number of ports. Reselection occurs as described for thebandwidthsetting above.
bandwidthandcountselection policies permit failover of 802.3ad aggregations when partial failure of the active aggregator occurs. This keeps the aggregator with the highest availability, either in bandwidth or in number of ports, active at all times. -
arp_interval=time_in_milliseconds - Specifies, in milliseconds, how often
ARPmonitoring occurs.Important
It is essential that botharp_intervalandarp_ip_targetparameters are specified, or, alternatively, themiimonparameter is specified. Failure to do so can cause degradation of network performance in the event that a link fails.If using this setting while inmode=0ormode=2(the two load-balancing modes), the network switch must be configured to distribute packets evenly across the NICs. For more information on how to accomplish this, see https://www.kernel.org/doc/Documentation/networking/bonding.txt.The value is set to0by default, which disables it. -
arp_ip_target=ip_address[,ip_address_2,…ip_address_16] - Specifies the target
IPaddress ofARPrequests when thearp_intervalparameter is enabled. Up to 16IPaddresses can be specified in a comma separated list. -
arp_validate=value - Validate source/distribution of
ARPprobes; default isnone. Other valid values areactive,backup, andall. -
downdelay=time_in_milliseconds - Specifies (in milliseconds) how long to wait after link failure before disabling the link. The value must be a multiple of the value specified in the
miimonparameter. The value is set to0by default, which disables it. -
fail_over_mac=value - Specifies whether active-backup mode should set all ports to the same MAC address at the point of assignment (the traditional behavior), or, when enabled, perform special handling of the bond's MAC address in accordance with the selected policy. Possible values are:
noneor0— Default setting. This setting disablesfail_over_mac, and causes bonding to set all ports of an active-backup bond to the same MAC address at the point of assignment.activeor1— The “active”fail_over_macpolicy indicates that the MAC address of the bond should always be the MAC address of the currently active port. The MAC address of the ports is not changed; instead, the MAC address of the bond changes during a failover.This policy is useful for devices that cannot ever alter their MAC address, or for devices that refuse incoming broadcasts with their own source MAC (which interferes with the ARP monitor). The disadvantage of this policy is that every device on the network must be updated by gratuitous ARP, as opposed to the normal method of switches snooping incoming traffic to update their ARP tables. If the gratuitous ARP is lost, communication may be disrupted.When this policy is used in conjunction with the MII monitor, devices which assert link up prior to being able to actually transmit and receive are particularly susceptible to loss of the gratuitous ARP, and an appropriate updelay setting may be required.followor2— The “follow”fail_over_macpolicy causes the MAC address of the bond to be selected normally (normally the MAC address of the first port added to the bond). However, the second and subsequent ports are not set to this MAC address while they are in a backup role; a port is programmed with the bond's MAC address at failover time (and the formerly active port receives the newly active port's MAC address).This policy is useful for multiport devices that either become confused or incur a performance penalty when multiple ports are programmed with the same MAC address.
- lacp_rate=value
- Specifies the rate at which link partners should transmit LACPDU packets in 802.3ad mode. Possible values are:
slowor0— Default setting. This specifies that partners should transmit LACPDUs every 30 seconds.fastor1— Specifies that partners should transmit LACPDUs every 1 second.
-
miimon=time_in_milliseconds - Specifies (in milliseconds) how often MII link monitoring occurs. This is useful if high availability is required because MII is used to verify that the NIC is active. To verify that the driver for a particular NIC supports the MII tool, type the following command as root:
ethtool interface_name | grep "Link detected:"
~]# ethtool interface_name | grep "Link detected:"Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this command, replace interface_name with the name of the device interface, such asenp1s0, not the bond interface. If MII is supported, the command returns:Link detected: yes
Link detected: yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow If using a bonded interface for high availability, the module for each NIC must support MII. Setting the value to0(the default), turns this feature off. When configuring this setting, a good starting point for this parameter is100.Important
It is essential that botharp_intervalandarp_ip_targetparameters are specified, or, alternatively, themiimonparameter is specified. Failure to do so can cause degradation of network performance in the event that a link fails. -
mode=value - Allows you to specify the bonding policy. The value can be one of:
balance-rror0— Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded port interface beginning with the first one available.active-backupor1— Sets an active-backup policy for fault tolerance. Transmissions are received and sent out through the first available bonded port interface. Another bonded port interface is only used if the active bonded port interface fails.balance-xoror2— Transmissions are based on the selected hash policy. The default is to derive a hash by XOR of the source and destination MAC addresses multiplied by the modulo of the number of port interfaces. In this mode traffic destined for specific peers will always be sent over the same interface. As the destination is determined by the MAC addresses this method works best for traffic to peers on the same link or local network. If traffic has to pass through a single router then this mode of traffic balancing will be suboptimal.broadcastor3— Sets a broadcast policy for fault tolerance. All transmissions are sent on all port interfaces.802.3ador4— Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all ports in the active aggregator. Requires a switch that is 802.3ad compliant.balance-tlbor5— Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each port interface. Incoming traffic is received by the current port. If the receiving port fails, another port takes over the MAC address of the failed port. This mode is only suitable for local addresses known to the kernel bonding module and therefore cannot be used behind a bridge with virtual machines.balance-albor6— Sets an Adaptive Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing forIPv4traffic. Receive load balancing is achieved throughARPnegotiation. This mode is only suitable for local addresses known to the kernel bonding module and therefore cannot be used behind a bridge with virtual machines.
For details about required settings on the upstream switch, see Section 7.6, “Overview of Bonding Modes and the Required Settings on the Switch”. -
primary=interface_name - Specifies the interface name, such as
enp1s0, of the primary device. Theprimarydevice is the first of the bonding interfaces to be used and is not abandoned unless it fails. This setting is particularly useful when one NIC in the bonding interface is faster and, therefore, able to handle a bigger load.This setting is only valid when the bonding interface is inactive-backupmode. See https://www.kernel.org/doc/Documentation/networking/bonding.txt for more information. -
primary_reselect=value - Specifies the reselection policy for the primary port. This affects how the primary port is chosen to become the active port when failure of the active port or recovery of the primary port occurs. This parameter is designed to prevent flip-flopping between the primary port and other ports. Possible values are:
alwaysor0(default) — The primary port becomes the active port whenever it comes back up.betteror1— The primary port becomes the active port when it comes back up, if the speed and duplex of the primary port is better than the speed and duplex of the current active port.failureor2— The primary port becomes the active port only if the current active port fails and the primary port is up.
Theprimary_reselectsetting is ignored in two cases:- If no ports are active, the first port to recover is made the active port.
- When initially assigned to a bond, the primary port is always made the active port.
Changing theprimary_reselectpolicy throughsysfswill cause an immediate selection of the best active port according to the new policy. This may or may not result in a change of the active port, depending upon the circumstances -
resend_igmp=range - Specifies the number of IGMP membership reports to be issued after a failover event. One membership report is issued immediately after the failover, subsequent packets are sent in each 200ms interval.The valid range is
0to255; the default value is1. A value of0prevents the IGMP membership report from being issued in response to the failover event.This option is useful for bonding modesbalance-rr(mode 0),active-backup(mode 1),balance-tlb(mode 5) andbalance-alb(mode 6), in which a failover can switch the IGMP traffic from one port to another. Therefore a fresh IGMP report must be issued to cause the switch to forward the incoming IGMP traffic over the newly selected port. -
updelay=time_in_milliseconds - Specifies (in milliseconds) how long to wait before enabling a link. The value must be a multiple of the value specified in the
miimonparameter. The value is set to0by default, which disables it. -
use_carrier=number - Specifies whether or not
miimonshould use MII/ETHTOOL ioctls ornetif_carrier_ok()to determine the link state. Thenetif_carrier_ok()function relies on the device driver to maintains its state withnetif_carrier_on/off; most device drivers support this function.The MII/ETHTOOL ioctls tools utilize a deprecated calling sequence within the kernel. However, this is still configurable in case your device driver does not supportnetif_carrier_on/off.Valid values are:1— Default setting. Enables the use ofnetif_carrier_ok().0— Enables the use of MII/ETHTOOL ioctls.
Note
If the bonding interface insists that the link is up when it should not be, it is possible that your network device driver does not supportnetif_carrier_on/off. -
xmit_hash_policy=value - Selects the transmit hash policy used for port selection in
balance-xorand802.3admodes. Possible values are:0orlayer2— Default setting. This parameter uses the XOR of hardware MAC addresses to generate the hash. The formula used is:(source_MAC_address XOR destination_MAC) MODULO slave_count
(source_MAC_address XOR destination_MAC) MODULO slave_countCopy to Clipboard Copied! Toggle word wrap Toggle overflow This algorithm will place all traffic to a particular network peer on the same port, and is 802.3ad compliant.1orlayer3+4— Uses upper layer protocol information (when available) to generate the hash. This allows for traffic to a particular network peer to span multiple ports, although a single connection will not span multiple ports.The formula for unfragmented TCP and UDP packets used is:((source_port XOR dest_port) XOR ((source_IP XOR dest_IP) AND 0xffff) MODULO slave_count((source_port XOR dest_port) XOR ((source_IP XOR dest_IP) AND 0xffff) MODULO slave_countCopy to Clipboard Copied! Toggle word wrap Toggle overflow For fragmented TCP or UDP packets and all otherIPprotocol traffic, the source and destination port information is omitted. For non-IPtraffic, the formula is the same as thelayer2transmit hash policy.This policy intends to mimic the behavior of certain switches; particularly, Cisco switches with PFC2 as well as some Foundry and IBM products.The algorithm used by this policy is not 802.3ad compliant.2orlayer2+3— Uses a combination of layer2 and layer3 protocol information to generate the hash.Uses XOR of hardware MAC addresses andIPaddresses to generate the hash. The formula is:(((source_IP XOR dest_IP) AND 0xffff) XOR ( source_MAC XOR destination_MAC )) MODULO slave_count(((source_IP XOR dest_IP) AND 0xffff) XOR ( source_MAC XOR destination_MAC )) MODULO slave_countCopy to Clipboard Copied! Toggle word wrap Toggle overflow This algorithm will place all traffic to a particular network peer on the same port. For non-IPtraffic, the formula is the same as for the layer2 transmit hash policy.This policy is intended to provide a more balanced distribution of traffic than layer2 alone, especially in environments where a layer3 gateway device is required to reach most destinations.This algorithm is 802.3ad compliant.
7.8. Creating a Bond Connection Using a GUI Copy linkLink copied to clipboard!
7.8.1. Establishing a Bond Connection Copy linkLink copied to clipboard!
Procedure 7.1. Adding a New Bond Connection_Using nm-connection-editor
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Add button. The Choose a Connection Type window appears. Select Bond and click Create. The Editing Bond connection 1 window appears.
Figure 7.6. The NetworkManager Graphical User Interface Add a Bond menu
- On the Bond tab, click and select the type of interface you want to use with the bond connection. Click the button. Note that the dialog to select the port type only comes up when you create the first port; after that, it will automatically use that same type for all further ports.
- The Editing bond0 slave 1 window appears. Use the Device MAC address drop-down menu to select the MAC address of the interface to be bonded. The first port's MAC address will be used as the MAC address for the bond interface. If required, enter a clone MAC address to be used as the bond's MAC address. Click the button.
Figure 7.7. The NetworkManager Graphical User Interface Add a Bond Connection menu
- The name of the bonded port appears in the Bonded connections window. Click the button to add further port connections.
- Review and confirm the settings and then click the Save button.
- Edit the bond-specific settings by referring to Section 7.8.1.1, “Configuring the Bond Tab” below.
Procedure 7.2. Editing an Existing Bond Connection
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Select the connection you want to edit and click the Edit button.
- Select the General tab.
- Configure the connection name, auto-connect behavior, and availability settings.Five settings in the Editing dialog are common to all connection types, see the General tab:
- Connection name — Enter a descriptive name for your network connection. This name will be used to list this connection in the menu of the Network window.
- Automatically connect to this network when it is available — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See the section called “Editing an Existing Connection with control-center” for more information.
- All users may connect to this network — Select this box to create a connection available to all users on the system. Changing this setting may require root privileges. See Section 3.4.5, “Managing System-wide and Private Connection Profiles with a GUI” for details.
- Automatically connect to VPN when using this connection — Select this box if you want NetworkManager to auto-connect to a VPN connection when it is available. Select the VPN from the drop-down menu.
- Firewall Zone — Select the firewall zone from the drop-down menu. See the Red Hat Enterprise Linux 7 Security Guide for more information on firewall zones.
- Edit the bond-specific settings by referring to Section 7.8.1.1, “Configuring the Bond Tab” below.
Saving Your New (or Modified) Connection and Making Further Configurations
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”orIPv6settings for the connection, click the IPv6 Settings tab and proceed to Section 5.5, “Configuring IPv6 Settings”.
7.8.1.1. Configuring the Bond Tab Copy linkLink copied to clipboard!
- Mode
- The mode that is used to share traffic over the port connections which make up the bond. The default is Round-robin. Other load sharing modes, such as
802.3ad, can be selected by means of the drop-down list. - Link Monitoring
- The method of monitoring the ports ability to carry network traffic.
- Round-robin
- Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded port interface beginning with the first one available. This mode might not work behind a bridge with virtual machines without additional switch configuration.
- Active backup
- Sets an active-backup policy for fault tolerance. Transmissions are received and sent out through the first available bonded port interface. Another bonded port interface is only used if the active bonded port interface fails. Note that this is the only mode available for bonds of InfiniBand devices.
- XOR
- Sets an XOR (exclusive-or) policy. Transmissions are based on the selected hash policy. The default is to derive a hash by XOR of the source and destination MAC addresses multiplied by the modulo of the number of port interfaces. In this mode traffic destined for specific peers will always be sent over the same interface. As the destination is determined by the MAC addresses this method works best for traffic to peers on the same link or local network. If traffic has to pass through a single router then this mode of traffic balancing will be suboptimal.
- Broadcast
- Sets a broadcast policy for fault tolerance. All transmissions are sent on all port interfaces. This mode might not work behind a bridge with virtual machines without additional switch configuration.
- 802.3ad
- Sets an IEEE
802.3addynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all ports in the active aggregator. Requires a network switch that is802.3adcompliant. - Adaptive transmit load balancing
- Sets an adaptive Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each port interface. Incoming traffic is received by the current port. If the receiving port fails, another port takes over the MAC address of the failed port. This mode is only suitable for local addresses known to the kernel bonding module and therefore cannot be used behind a bridge with virtual machines.
- Adaptive load balancing
- Sets an Adaptive Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for
IPv4traffic. Receive load balancing is achieved throughARPnegotiation. This mode is only suitable for local addresses known to the kernel bonding module and therefore cannot be used behind a bridge with virtual machines.
- MII (Media Independent Interface)
- The state of the carrier wave of the interface is monitored. This can be done by querying the driver, by querying MII registers directly, or by using ethtool to query the device. Three options are available:
- Monitoring Frequency
- The time interval, in milliseconds, between querying the driver or MII registers.
- Link up delay
- The time in milliseconds to wait before attempting to use a link that has been reported as up. This delay can be used if some gratuitous
ARPrequests are lost in the period immediately following the link being reported as “up”. This can happen during switch initialization for example. - Link down delay
- The time in milliseconds to wait before changing to another link when a previously active link has been reported as “down”. This delay can be used if an attached switch takes a relatively long time to change to backup mode.
- ARP
- The address resolution protocol (
ARP) is used to probe one or more peers to determine how well the link-layer connections are working. It is dependent on the device driver providing the transmit start time and the last receive time.Two options are available:- Monitoring Frequency
- The time interval, in milliseconds, between sending
ARPrequests. - ARP targets
- A comma separated list of
IPaddresses to sendARPrequests to.
7.9. Additional Resources Copy linkLink copied to clipboard!
Installed Documentation
nmcli(1)man page — Describes NetworkManager's command‐line tool.nmcli-examples(5)man page — Gives examples of nmcli commands.nm-settings(5)man page — Description of settings and parameters of NetworkManager connections.
Online Documentation
- Red Hat Enterprise Linux System Administrator's Guide
- Explains the use of kernel module capabilities.
- https://access.redhat.com/site/node/28421/Configuring_VLAN_devices_over_a_bonded_interface
- A Red Hat Knowledgebase article about Configuring VLAN devices over a bonded interface.
Chapter 8. Configure Network Teaming Copy linkLink copied to clipboard!
8.1. Understanding Network Teaming Copy linkLink copied to clipboard!
bonding. The term Network Teaming has been chosen to refer to this new implementation of the concept. The existing bonding driver is unaffected, Network Teaming is offered as an alternative and does not replace bonding in Red Hat Enterprise Linux 7.
Note
teamd, which uses the libteam library is also available. One instance of teamd can control one instance of the Team driver. The daemon implements the load-balancing and active-backup logic, such as round-robin, by using additional code referred to as “runners”. By separating the code in this way, the Network Teaming implementation presents an easily extensible and scalable solution for load-balancing and redundancy requirements. For example, custom runners can be relatively easily written to implement new logic through teamd, and even teamd is optional, users can write their own application to use libteam.
teamd using D-bus. teamdctl provides a D-Bus wrapper around the teamd D-Bus API. By default, teamd listens and communicates using Unix Domain Sockets but still monitors D-Bus. This is to ensure that teamd can be used in environments where D-Bus is not present or not yet loaded. For example, when booting over teamd links, D-Bus would not yet be loaded. The teamdctl utility can be used during run time to read the configuration, the state of link-watchers, check and change the state of ports, add and remove ports, and to change ports between active and backup states.
libteam user-space library does not directly interact with the API, but uses libnl or teamnl to interact with the driver API.
Note
port is also known as slave. Port is preferred when using teamd directly while slave is used when using NetworkManager to refer to interfaces which create a team.
8.2. Understanding the Default Behavior of Controller and Port Interfaces Copy linkLink copied to clipboard!
NetworkManager daemon, and especially when fault finding, keep the following in mind:
- Starting the controller interface does not automatically start the port interfaces.
- Starting a port interface always starts the controller interface.
- Stopping the controller interface also stops the port interfaces.
- A controller without ports can start static
IPconnections. - A controller without ports waits for ports when starting
DHCPconnections. - A controller with a
DHCPconnection waiting for ports completes when a port with a carrier is added. - A controller with a
DHCPconnection waiting for ports continues waiting when a port without a carrier is added.
Warning
8.3. Comparison of Network Teaming to Bonding Copy linkLink copied to clipboard!
| Feature | Bonding | Team |
|---|---|---|
| broadcast Tx policy | Yes | Yes |
| round-robin Tx policy | Yes | Yes |
| active-backup Tx policy | Yes | Yes |
| LACP (802.3ad) support | Yes (active only) | Yes |
| Hash-based Tx policy | Yes | Yes |
| User can set hash function | No | Yes |
| Tx load-balancing support (TLB) | Yes | Yes |
| LACP hash port select | Yes | Yes |
| load-balancing for LACP support | No | Yes |
| Ethtool link monitoring | Yes | Yes |
| ARP link monitoring | Yes | Yes |
| NS/NA (IPv6) link monitoring | No | Yes |
| ports up/down delays | Yes | Yes |
| port priorities and stickiness (“primary” option enhancement) | No | Yes |
| separate per-port link monitoring setup | No | Yes |
| multiple link monitoring setup | Limited | Yes |
| lockless Tx/Rx path | No (rwlock) | Yes (RCU) |
| VLAN support | Yes | Yes |
| user-space runtime control | Limited | Full |
| Logic in user-space | No | Yes |
| Extensibility | Hard | Easy |
| Modular design | No | Yes |
| Performance overhead | Low | Very Low |
| D-Bus interface | No | Yes |
| multiple device stacking | Yes | Yes |
| zero config using LLDP | No | (in planning) |
| NetworkManager support | Yes | Yes |
8.4. Understanding the Network Teaming Daemon and the "Runners" Copy linkLink copied to clipboard!
teamd, uses libteam to control one instance of the team driver. This instance of the team driver adds instances of a hardware device driver to form a “team” of network links. The team driver presents a network interface, team0 for example, to the other parts of the kernel. The interfaces created by instances of the team driver are given names such as team0, team1, and so forth in the documentation. This is for ease of understanding and other names can be used. The logic common to all methods of teaming is implemented by teamd; those functions that are unique to the different load sharing and backup methods, such as round-robin, are implemented by separate units of code referred to as “runners”. Because words such as “module” and “mode” already have specific meanings in relation to the kernel, the word “runner” was chosen to refer to these units of code. The user specifies the runner in the JSON format configuration file and the code is then compiled into an instance of teamd when the instance is created. A runner is not a plug-in because the code for a runner is compiled into an instance of teamd as it is being created. Code could be created as a plug-in for teamd should the need arise.
- broadcast (data is transmitted over all ports)
- round-robin (data is transmitted over all ports in turn)
- active-backup (one port or link is used while others are kept as a backup)
- loadbalance (with active Tx load balancing and BPF-based Tx port selectors)
- lacp (implements the 802.3ad Link Aggregation Control Protocol)
- ethtool (Libteam lib uses ethtool to watch for link state changes). This is the default if no other link-watcher is specified in the configuration file.
- arp_ping (The arp_ping utility is used to monitor the presence of a far-end hardware address using ARP packets.)
- nsna_ping (Neighbor Advertisements and Neighbor Solicitation from the
IPv6Neighbor Discovery protocol are used to monitor the presence of a neighbor's interface)
8.5. Install the Network Teaming Daemon Copy linkLink copied to clipboard!
teamd, is not installed by default. To install teamd, issue the following command as root:
yum install teamd
~]# yum install teamd
8.6. Converting a Bond to a Team Copy linkLink copied to clipboard!
ifcfg format to team configuration files in either ifcfg or JSON format. Note that firewall rules, alias interfaces, and anything that might be tied to the original interface name can break after the renaming because the tool will only change the ifcfg file, nothing else.
bond2team --examples
~]$ bond2team --examples
/tmp/bond2team.XXXXXX/, where XXXXXX is a random string. After creating the new configuration files, move the old bonding files to a backup folder and then move the new files to the /etc/sysconfig/network-scripts/ directory.
Example 8.1. Convert a Bond to a Team
bond0 configuration to team ifcfg, issue a command as root:
/usr/bin/bond2team --master bond0
~]# /usr/bin/bond2team --master bond0
bond0. To use a new name to save the configuration, use the --rename as follows:
/usr/bin/bond2team --master bond0 --rename team0
~]# /usr/bin/bond2team --master bond0 --rename team0
--json option to output JSON format files instead of ifcfg files. See the teamd.conf(5) man page for examples of JSON format.
Example 8.2. Convert a Bond to a Team and Specify the File Path
bond0 configuration to team ifcfg, and to manually specify the path to the ifcfg file, issue a command as root:
/usr/bin/bond2team --master bond0 --configdir /path/to/ifcfg-file
~]# /usr/bin/bond2team --master bond0 --configdir /path/to/ifcfg-file
--json option to output JSON format files instead of ifcfg files.
Example 8.3. Create a Team Configuration Using Bond2team
/usr/bin/bond2team --bonding_opts "mode=1 miimon=500"
~]# /usr/bin/bond2team --bonding_opts "mode=1 miimon=500"
/usr/bin/bond2team --bonding_opts "mode=1 miimon=500 primary=enp1s0 \ primary_reselect-0" --port enp1s0 --port enp2s0 --port enp3s0 --port enp4s0
~]# /usr/bin/bond2team --bonding_opts "mode=1 miimon=500 primary=enp1s0 \
primary_reselect-0" --port enp1s0 --port enp2s0 --port enp3s0 --port enp4s0
bond2team(1) man page for further details. For an explanation of bonding parameters, see Section 7.7, “Using Channel Bonding”
8.7. Selecting Interfaces to Use as Ports for a Network Team Copy linkLink copied to clipboard!
8.8. Selecting Network Team Configuration Methods Copy linkLink copied to clipboard!
teamd, proceed to Section 8.10.2, “Creating a Network Team Using teamd”.
8.9. Configure a Network Team Using the Text User Interface, nmtui Copy linkLink copied to clipboard!
nmtui
~]$ nmtui
- From the starting menu, select Edit a connection. Select Add, the New Connection screen opens.
Figure 8.1. The NetworkManager Text User Interface Add a Team Connection menu
- Select Team, the Edit connection screen opens.
Figure 8.2. The NetworkManager Text User Interface Configuring a Team Connection menu
- To add port interfaces to the team select Add, the New Connection screen opens. Once the type of Connection has been chosen select the Create button to cause the team's Edit Connection display to appear.
Figure 8.3. The NetworkManager Text User Interface Configuring a new Team Port Interface Connection menu
- Enter the required port's device name or MAC address in the Device section. If required, enter a clone MAC address to be used as the team's MAC address by selecting Show to the right of the Ethernet label. Select the OK button.
Note
If the device is specified without a MAC address the Device section will be automatically populated once the Edit Connection window is reloaded, but only if it successfully finds the device.Figure 8.4. The NetworkManager Text User Interface Configuring a Team's Port Interface Connection menu
- The name of the teamed port appears in the Slaves section. Repeat the above steps to add further port connections.
- If custom port settings are to be applied select the Edit button under the JSON configuration section. This will launch a vim console where changes may be applied. Once finished write the changes from vim and then confirm that the displayed JSON string under JSON configuration matches what is intended.
- Review and confirm the settings before selecting the OK button.
Figure 8.5. The NetworkManager Text User Interface Configuring a Team Connection menu
8.10. Configure a Network Team Using the Command Line Copy linkLink copied to clipboard!
8.10.1. Configure Network Teaming Using nmcli Copy linkLink copied to clipboard!
nmcli connection show
~]$ nmcli connection show
NAME UUID TYPE DEVICE
enp2s0 0e8185a1-f0fd-4802-99fb-bedbb31c689b 802-3-ethernet --
enp1s0 dfe1f57b-419d-4d1c-aaf5-245deab82487 802-3-ethernet --
nmcli device status
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
virbr0 bridge connected virbr0
ens3 ethernet connected ens3
nmcli connection add type team ifname ServerA
~]$ nmcli connection add type team ifname ServerA
Connection 'team-ServerA' (b954c62f-5fdd-4339-97b0-40efac734c50) successfully added.
connection.autoconnect to yes and as no IP address was given ipv4.method will be set to auto. NetworkManager will also write a configuration file to /etc/sysconfig/network-scripts/ifcfg-team-ServerA where the corresponding ONBOOT will be set to yes and BOOTPROTO will be set to dhcp.
teamd.conf(5) man page for more information on the team JSON parameters and their default values. Notice that the name was derived from the interface name by prepending the type. Alternatively, specify a name with the con-name option as follows:
nmcli connection add type team con-name Team0 ifname ServerB
~]$ nmcli connection add type team con-name Team0 ifname ServerB
Connection 'Team0' (5f7160a1-09f6-4204-8ff0-6d96a91218a7) successfully added.
nmcli con mod old-team-name connection.id new-team-name
nmcli con mod old-team-name connection.id new-team-name
nmcli connection modify team-name team.config JSON-config
nmcli connection modify team-name team.config JSON-config
team.config property is the JSON string. In the case of a JSON string, use single quotes around the string and paste the entire string to the command line.
team.config property: nmcli con show team-name | grep team.config
nmcli con show team-name | grep team.config
team.config property is set, all the other team properties are updated accordingly.
team.config property is updated to match the new values.
team.link-watchers property which allows to specify one or multiple link-watchers, enter a command in the following format: nmcli connection modify team-name team.link-watchers "name=ethtool delay-up=5, name=nsna_ping target-host=target.host"
nmcli connection modify team-name team.link-watchers "name=ethtool delay-up=5, name=nsna_ping target-host=target.host"
link-watchers are separated by comma and the attributes which belong to the same link-watcher are separated by space.
team.runner and the team.link-watchers properties, enter a command in the following format: nmcli connection modify team-name team.runner activebackup team.link-watchers "name=ethtool delay-up=5, name=nsna_ping target-host=target.host"
nmcli connection modify team-name team.runner activebackup team.link-watchers "name=ethtool delay-up=5, name=nsna_ping target-host=target.host"
team.config property to the corresponding JSON string: nmcli connection modify team-name team.config '{"runner": {"name": "activebackup"}, "link_watch": [{"name": "ethtool", "delay_up": 5},{"name": "nsna_ping", "target_host ": "target.host"}]'
nmcli connection modify team-name team.config '{"runner": {"name": "activebackup"}, "link_watch": [{"name": "ethtool", "delay_up": 5},{"name": "nsna_ping", "target_host ": "target.host"}]'
Team0, with the name Team0-port1, issue a command as follows:
nmcli con add type ethernet con-name Team0-port1 ifname enp1s0 slave-type team master Team0
~]$ nmcli con add type ethernet con-name Team0-port1 ifname enp1s0 slave-type team master Team0
Connection 'Team0-port1' (ccd87704-c866-459e-8fe7-01b06cf1cffc) successfully added.
nmcli con add type ethernet con-name Team0-port2 ifname enp2s0 slave-type team master Team0
~]$ nmcli con add type ethernet con-name Team0-port2 ifname enp2s0 slave-type team master Team0
Connection 'Team0-port2' (a89ccff8-8202-411e-8ca6-2953b7db52dd) successfully added.
nmcli connection up Team0-port1
~]$ nmcli connection up Team0-port1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
nmcli connection up Team0-port2
~]$ nmcli connection up Team0-port2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
ip link
~]$ ip link
3: Team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 52:54:00:76:6f:f0 brd ff:ff:ff:ff:ff:f
nmcli connection up Team0
~]$ nmcli connection up Team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
8.10.2. Creating a Network Team Using teamd Copy linkLink copied to clipboard!
Note
root privileges. To list the available example configurations, enter the following command:
activebackup_ethtool_1.conf, enter the following command:
teamd configuration files. For example, as normal user, enter a command with the following format:
mkdir ~/teamd_working_configs
~]$ mkdir ~/teamd_working_configs
cp /usr/share/doc/teamd-*/example_configs/activebackup_ethtool_1.conf \ ~/teamd_working_configs/activebackup_ethtool_1.conf
~]$ cp /usr/share/doc/teamd-*/example_configs/activebackup_ethtool_1.conf \ ~/teamd_working_configs/activebackup_ethtool_1.conf
vi ~/teamd_working_configs/activebackup_ethtool_1.conf
~]$ vi ~/teamd_working_configs/activebackup_ethtool_1.conf
vi(1) man page for help on using the vi editor or use your preferred editor.
root in the following format:
ip link set down em1
~]# ip link set down em1
root user, change to the working configurations directory (teamd_working_configs in this example):
cd /home/userteamd_working_configs
~]# cd /home/userteamd_working_configs
teamd -g -f activebackup_ethtool_1.conf -d
~]# teamd -g -f activebackup_ethtool_1.conf -d
Using team device "team0".
Using PID file "/var/run/teamd/team0.pid"
Using config file "/home/user/teamd_working_configs/activebackup_ethtool_1.conf"
-g option is for debug messages, -f option is to specify the configuration file to load, and the -d option is to make the process run as a daemon after startup. See the teamd(8) man page for other options.
root:
root in the following format:
ip addr add 192.168.23.2/24 dev team0
~]# ip addr add 192.168.23.2/24 dev team0
root in the following format:
ip link set dev team0 up
~]# ip link set dev team0 up
root in the following format:
ip link set dev team0 down
~]# ip link set dev team0 down
root user, issue a command in the following format:
teamd -t team0 -k
~]# teamd -t team0 -k
-k option is to specify that the instance of the daemon associated with the device team0 is to be killed. See the teamd(8) man page for other options.
teamd, issue the following command:
teamd -h
~]$ teamd -h
teamd(8) man page.
8.10.3. Creating a Network Team Using ifcfg Files Copy linkLink copied to clipboard!
ifcfg files, create a file in the /etc/sysconfig/network-scripts/ directory as follows:
master.
/etc/sysconfig/network-scripts/ directory as follows:
prio it defaults to 0; it accepts negative and positive values in the range -32,767 to +32,767.
HWADDR directive will influence the device naming procedure. This is explained in Chapter 11, Consistent Network Device Naming.
root:
ifup team0
~]# ifup team0
ip link show
~]$ ip link show
8.10.4. Add a Port to a Network Team Using iputils Copy linkLink copied to clipboard!
root:
ip link set dev em1 down ip link set dev em1 master team0
~]# ip link set dev em1 down
~]# ip link set dev em1 master team0
8.10.5. Listing the ports of a Team Using teamnl Copy linkLink copied to clipboard!
root:
teamnl team0 ports
~]# teamnl team0 ports
em2: up 100 fullduplex
em1: up 100 fullduplex
8.10.6. Configuring Options of a Team Using teamnl Copy linkLink copied to clipboard!
root:
teamnl team0 options
~]# teamnl team0 options
root:
teamnl team0 setoption mode activebackup
~]# teamnl team0 setoption mode activebackup
8.10.7. Add an Address to a Network Team Using iputils Copy linkLink copied to clipboard!
root:
ip addr add 192.168.252.2/24 dev team0
~]# ip addr add 192.168.252.2/24 dev team0
8.10.8. open an Interface to a Network Team Using iputils Copy linkLink copied to clipboard!
root:
ip link set team0 up
~]# ip link set team0 up
8.10.9. Viewing the Active Port Options of a Team Using teamnl Copy linkLink copied to clipboard!
activeport option in a network team, using the teamnl utility, issue the following command as root:
teamnl team0 getoption activeport
~]# teamnl team0 getoption activeport
0
8.10.10. Setting the Active Port Options of a Team Using teamnl Copy linkLink copied to clipboard!
activeport option in a network team, using the teamnl utility, issue the following command as root:
teamnl team0 setoption activeport 5
~]# teamnl team0 setoption activeport 5
root:
teamnl team0 getoption activeport
~]# teamnl team0 getoption activeport
5
8.11. Controlling teamd with teamdctl Copy linkLink copied to clipboard!
teamd for statistics or configuration information, or to make changes, the control tool teamdctl is used.
root:
teamdctl team0 state view
~]# teamdctl team0 state view
teamdctl team0 state view -v
~]# teamdctl team0 state view -v
teamdctl team0 state dump
~]# teamdctl team0 state dump
teamdctl team0 config dump
~]# teamdctl team0 config dump
teamdctl team0 port config dump em1
~]# teamdctl team0 port config dump em1
8.11.1. Add a Port to a Network Team Copy linkLink copied to clipboard!
root:
teamdctl team0 port add em1
~]# teamdctl team0 port add em1
Important
teamdctl directly to add a port, the port must be set to down. Otherwise the teamdctl team0 port add em1 command will fail.
8.11.2. Remove a Port From a Network Team Copy linkLink copied to clipboard!
root:
teamdctl team0 port remove em1
~]# teamdctl team0 port remove em1
8.11.3. Applying a Sticky Setting to a Port in a Network Team Copy linkLink copied to clipboard!
teamdctl command to apply a sticky setting to ensure that a specific port is used as an active link when it is available.
Prerequisites
- You already created a team of network interfaces. As a result, you have a port (em1) that you want to update the configuration of.
Procedure
- Update the configuration of the sticky setting for em1:
teamdctl team0 port config update em1 '{ "prio": 100, "sticky": true }'~]# teamdctl team0 port config update em1 '{ "prio": 100, "sticky": true }'Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Remove em1:
teamdctl team0 port remove em1
~]# teamdctl team0 port remove em1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add em1 again so that the sticky setting takes effect:
teamdctl team0 port add em1
~]# teamdctl team0 port add em1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that the old configuration will be overwritten and that any options omitted will be reset to the default values. See theteamdctl(8)man page for more team daemon control tool command examples.
8.11.4. View the Configuration of a Port in a Network Team Copy linkLink copied to clipboard!
root:
teamdctl team0 port config dump em1
~]# teamdctl team0 port config dump em1
8.12. Verifying Network Configuration Teaming for Redundancy Copy linkLink copied to clipboard!
Procedure
- Ping the destination IP from the team interface. For example:
ping -I team0 DSTADDR
~]# ping -I team0 DSTADDRCopy to Clipboard Copied! Toggle word wrap Toggle overflow - View which interface is in
activemode:enp1s0 is theCopy to Clipboard Copied! Toggle word wrap Toggle overflow activeinterface. - Temporarily remove the network cable from the host.
Note
There is no method to properly test link failure events using software utilities. Tools that deactivate connections, such asipornmcli, show only the driver’s ability to handle port configuration changes and not actual link failure events. - Check if the
backupinterface is up:enp2s0 is now theCopy to Clipboard Copied! Toggle word wrap Toggle overflow activeinterface. - Check if you can still ping the destination IP from the team interface:
ping -I team0 DSTADDR
~]# ping -I team0 DSTADDRCopy to Clipboard Copied! Toggle word wrap Toggle overflow
8.13. Configure teamd Runners Copy linkLink copied to clipboard!
teamd runners, see Section 8.4, “Understanding the Network Teaming Daemon and the "Runners"”.
8.13.1. Configure the broadcast Runner Copy linkLink copied to clipboard!
root, add the following to the team JSON format configuration file:
{
"device": "team0",
"runner": {"name": "broadcast"},
"ports": {"em1": {}, "em2": {}}
}
{
"device": "team0",
"runner": {"name": "broadcast"},
"ports": {"em1": {}, "em2": {}}
}
teamd.conf(5) man page for more information.
8.13.2. Configure the random Runner Copy linkLink copied to clipboard!
root, add the following to the team JSON format configuration file:
{
"device": "team0",
"runner": {"name": "random"},
"ports": {"em1": {}, "em2": {}}
}
{
"device": "team0",
"runner": {"name": "random"},
"ports": {"em1": {}, "em2": {}}
}
teamd.conf(5) man page for more information.
8.13.3. Configure the Round-robin Runner Copy linkLink copied to clipboard!
root, add the following to the team JSON format configuration file:
{
"device": "team0",
"runner": {"name": "roundrobin"},
"ports": {"em1": {}, "em2": {}}
}
{
"device": "team0",
"runner": {"name": "roundrobin"},
"ports": {"em1": {}, "em2": {}}
}
teamd.conf(5) man page for more information.
8.13.4. Configure the activebackup Runner Copy linkLink copied to clipboard!
4. It uses active-backup runner with ethtool as the link watcher. Port em2 has higher priority. But the sticky flag ensures that if em1 becomes active, it will stay active as long as the link remains up.
root, add the following to the team JSON format configuration file:
teamd.conf(5) man page for more information.
8.13.5. Configure the loadbalance Runner Copy linkLink copied to clipboard!
teamd.
root, add the following to the team JSON format configuration file:
root, add the following to the team JSON format configuration file:
teamd.conf(5) man page for more information.
8.13.6. Configure the LACP (802.3ad) Runner Copy linkLink copied to clipboard!
root, add the following to the team JSON format configuration file:
"tx_balancer": {
"name": "basic"
}
"tx_balancer": {
"name": "basic"
}
teamd.conf(5) man page for more information.
8.13.7. Configure Monitoring of the Link State Copy linkLink copied to clipboard!
root privileges.
8.13.7.1. Configure Ethtool for link-state Monitoring Copy linkLink copied to clipboard!
"link_watch": {
"name": "ethtool",
"delay_up": 2500
}
"link_watch": {
"name": "ethtool",
"delay_up": 2500
}
"link_watch": {
"name": "ethtool",
"delay_down": 1000
}
"link_watch": {
"name": "ethtool",
"delay_down": 1000
}
8.13.7.2. Configure ARP Ping for Link-state Monitoring Copy linkLink copied to clipboard!
teamd sends an ARP REQUEST to an address at the remote end of the link in order to determine if the link is up. The method used is the same as the arping utility but it does not use that utility.
missed_max option is a limit value of the maximum allowed number of missed replies (ARP replies for example). It should be chosen in conjunction with the interval option in order to determine the total time before a link is reported as down.
root:
teamdctl port config update em2 JSON-config-file
~]# teamdctl port config update em2 JSON-config-file
teamdctl(8) man page for more team daemon control tool command examples.
8.13.7.3. Configure IPv6 NA/NS for Link-state Monitoring Copy linkLink copied to clipboard!
"link_watch": {
"name": "nsna_ping",
"interval": 200
}
"link_watch": {
"name": "nsna_ping",
"interval": 200
}
missed_max option in order to determine the total time before a link is reported as down.
"link_watch": {
"name": "nsna_ping",
"missed_max": 15
}
"link_watch": {
"name": "nsna_ping",
"missed_max": 15
}
missed_max option is a limit value of the maximum allowed number of missed replies (ARP replies for example). It should be chosen in conjunction with the interval option in order to determine the total time before a link is reported as down.
IPv6 address target address for the NS/NA packets, add or edit a section as follows:
"link_watch": {
"name": "nsna_ping",
"target_host": "MyStorage"
}
"link_watch": {
"name": "nsna_ping",
"target_host": "MyStorage"
}
IPv6 address which will be used as the target address for the NS/NA packets. An IPv6 address can be used in place of a host name.
teamd.conf(5) man page for more information.
8.13.8. Configure Port Selection Override Copy linkLink copied to clipboard!
teamd runner). On occasion however, it is helpful to direct certain classes of outgoing traffic to certain physical interfaces to implement slightly more complex policies. By default the team driver is multiqueue aware and 16 queues are created when the driver initializes. If more or less queues are required, the Netlink attribute tx_queues can be used to change this value during the team driver instance creation.
queue_id as follows:
{
"queue_id": 3
}
{
"queue_id": 3
}
192.168.1.100 to use enp1s0 in the team as its output device, issue commands as root in the following format:
tc qdisc add dev team0 handle 1 root multiq tc filter add dev team0 protocol ip parent 1: prio 1 u32 match ip dst \ 192.168.1.100 action skbedit queue_mapping 3
~]# tc qdisc add dev team0 handle 1 root multiq
~]# tc filter add dev team0 protocol ip parent 1: prio 1 u32 match ip dst \
192.168.1.100 action skbedit queue_mapping 3
8.13.9. Configure BPF-based Tx Port Selectors Copy linkLink copied to clipboard!
eth— Uses source and destination MAC addresses.vlan— Uses VLAN ID.ipv4— Uses source and destinationIPv4addresses.ipv6— Uses source and destinationIPv6addresses.ip— Uses source and destinationIPv4andIPv6addresses.l3— Uses source and destinationIPv4andIPv6addresses.tcp— Uses source and destinationTCPports.udp— Uses source and destinationUDPports.sctp— Uses source and destinationSCTPports.l4— Uses source and destinationTCPandUDPandSCTPports.
"tx_hash": ["eth", "ipv4", "ipv6"]
"tx_hash": ["eth", "ipv4", "ipv6"]
8.14. Creating a Network Team Using a GUI Copy linkLink copied to clipboard!
8.14.1. Establishing a Team Connection Copy linkLink copied to clipboard!
Procedure 8.1. Adding a New Team Connection Using nm-connection-editor
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Add button. The Choose a Connection Type window appears. Select Team and click Create. The Editing Team connection 1 window appears.
Figure 8.6. The NetworkManager Graphical User Interface Add a menu
- On the Team tab, click and select the type of interface you want to use with the team connection. Click the button. Note that the dialog to select the port type only comes up when you create the first port; after that, it will automatically use that same type for all further ports.
- The Editing team0 slave 1 window appears.
Figure 8.7. The NetworkManager Graphical User Interface Add a
SlaveConnection - If custom port settings are to be applied, click on the Team Port tab and enter a JSON configuration string or import it from a file.
- Click the button.
- The name of the teamed port appears in the Teamed connections window. Click the button to add further port connections.
- Review and confirm the settings and then click the Save button.
- Edit the team-specific settings by referring to Section 8.14.1.1, “Configuring the Team Tab” below.
Procedure 8.2. Editing an Existing Team Connection
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Select the connection you want to edit and click the Edit button.
- Select the General tab.
- Five settings in the Editing dialog are common to the most connection types. See the General tab:
- Connection name — Enter a descriptive name for your network connection. This name is used to list this connection in the menu of the Network window.
- Connection priority for auto-activation — If the connection is set to autoconnect, the number is activated (
0by default). The higher number means higher priority. - Automatically connect to this network when it is available — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See the section called “Editing an Existing Connection with control-center” for more information.
- All users may connect to this network — Select this box to create a connection available to all users on the system. Changing this setting may require root privileges. See Section 3.4.5, “Managing System-wide and Private Connection Profiles with a GUI” for details.
- Automatically connect to VPN when using this connection — Select this box if you want NetworkManager to auto-connect to a VPN connection when it is available. Select the VPN from the drop-down menu.
- Firewall Zone — Select the firewall zone from the drop-down menu. See the Red Hat Enterprise Linux 7 Security Guide for more information on firewall zones.
- Edit the team-specific settings by referring to Section 8.14.1.1, “Configuring the Team Tab” below.
Saving Your New (or Modified) Connection and Making Further Configurations
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”orIPv6settings for the connection, click the IPv6 Settings tab and proceed to Section 5.5, “Configuring IPv6 Settings”.
8.14.1.1. Configuring the Team Tab Copy linkLink copied to clipboard!
8.15. Additional Resources Copy linkLink copied to clipboard!
Installed Documentation
teamd(8)man page — Describes theteamdservice.teamdctl(8)man page — Describes theteamdcontrol tool.teamd.conf(5)man page — Describes theteamdconfiguration file.teamnl(8)man page — Describes theteamdNetlink library.bond2team(1)man page — Describes a tool to convert bonding options to team.
Online Documentation
- http://www.w3schools.com/js/js_json_syntax.asp
- An explanation of JSON syntax.
Chapter 9. Configure Network Bridging Copy linkLink copied to clipboard!
9.1. Configure Bridging Using the Text User Interface, nmtui Copy linkLink copied to clipboard!
nmtui
~]$ nmtui
- From the starting menu, select Edit a connection. Select Add, the New Connection screen opens.
Figure 9.1. The NetworkManager Text User Interface Add a Bridge Connection menu
- Select Bridge, the Edit connection screen opens.
- To add port interfaces to the bridge select Add, the New Connection screen opens. Once the type of Connection has been chosen select the Create button to cause the bridge's Edit Connection display to appear.
Figure 9.2. The NetworkManager Text User Interface Adding a new Bridge
SlaveConnection menu - Enter the required port's device name or MAC address in the Device section. If required, enter a clone MAC address to be used as the bridge's MAC address by selecting Show to the right of the Ethernet label. Select the OK button.
Note
If the device is specified without a MAC address the Device section will be automatically populated once the Edit Connection window is reloaded, but only if it successfully finds the device.Figure 9.3. The NetworkManager Text User Interface Configuring a Bridge
SlaveConnection menu - The name of the bridge port appears in the Slaves section. Repeat the above steps to add further port connections.
- Review and confirm the settings before selecting the OK button.
Figure 9.4. The NetworkManager Text User Interface Configuring a Bridge menu
9.2. Using the NetworkManager Command Line Tool, nmcli Copy linkLink copied to clipboard!
root:
nmcli con add type bridge ifname br0
~]# nmcli con add type bridge ifname br0
Connection 'bridge-br0' (6ad5bba6-98a0-4f20-839d-c997ba7668ad) successfully added.
nmcli con show
~]$ nmcli con show
NAME UUID TYPE DEVICE
bridge-br0 79cf6a3e-0310-4a78-b759-bda1cc3eef8d bridge br0
enp1s0 4d5c449a-a6c5-451c-8206-3c9a4ec88bca 802-3-ethernet enp1s0
STP for this bridge, issue a command as follows as root:
nmcli con modify bridge-br0 bridge.stp no
~]# nmcli con modify bridge-br0 bridge.stp no
802.1D STP for this bridge, issue a command as follows as root:
nmcli con modify bridge-br0 bridge.stp yes
~]# nmcli con modify bridge-br0 bridge.stp yes
802.1D STP is 32768. The lower number is preferred in root bridge selection. For example, a bridge with priority of 28672 would be selected as the root bridge in preference to a bridge with priority value of 32768 (the default). To create a bridge with a non-default value, issue a command as follows:
nmcli con add type bridge ifname br5 stp yes priority 28672
~]$ nmcli con add type bridge ifname br5 stp yes priority 28672
Connection 'bridge-br5' (86b83ad3-b466-4795-aeb6-4a66eb1856c7) successfully added.
0 to 65535.
nmcli connection modify bridge-br5 bridge.priority 36864
~]$ nmcli connection modify bridge-br5 bridge.priority 36864
0 to 65535.
01:80:C2:00:00:00 to 01:80:C2:00:00:0F, change the group-forward-mask property. This property is a mask of 16 bits. Each bit corresponds to a group address in the above-mentioned range that must be forwarded. For example:
nmcli connection modify bridge-br5 bridge.group-forward-mask 8
~]$ nmcli connection modify bridge-br5 bridge.group-forward-mask 8
Important
group-forward-mask property cannot have any of the 0, 1, 2 bits set to 1 because those addresses are used for Spanning tree protocol (STP), Link Aggregation Control Protocol (LACP) and Ethernet MAC pause frames.
nmcli -f bridge con show bridge-br0
~]$ nmcli -f bridge con show bridge-br0
802.1D STP are listed in the bridge section of the nmcli(1) man page.
nmcli con add type ethernet ifname enp1s0 master bridge-br0
~]$ nmcli con add type ethernet ifname enp1s0 master bridge-br0
Connection 'bridge-slave-enp1s0' (70ffae80-7428-4d9c-8cbd-2e35de72476e) successfully added.
- Change its controller and port-type properties. For example to assign an existing VLAN connection named vlan100:
nmcli connection modify vlan100 master bridge-br0 slave-type bridge
~]$ nmcli connection modify vlan100 master bridge-br0 slave-type bridgeCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Reactivate the connection to apply the changes:
nmcli connection up vlan100
~]$ nmcli connection up vlan100Copy to Clipboard Copied! Toggle word wrap Toggle overflow
nmcli connection edit bridge-br0
~]$ nmcli connection edit bridge-br0
nmcli> set bridge.priority 4096 nmcli> save Connection 'bridge-br0' (79cf6a3e-0310-4a78-b759-bda1cc3eef8d) successfully saved. nmcli> quit
nmcli> set bridge.priority 4096
nmcli> save
Connection 'bridge-br0' (79cf6a3e-0310-4a78-b759-bda1cc3eef8d) successfully saved.
nmcli> quit
9.3. Using the Command Line Interface (CLI) Copy linkLink copied to clipboard!
9.3.1. Check if Bridging Kernel Module is Installed Copy linkLink copied to clipboard!
root:
modprobe --first-time bridge
~]# modprobe --first-time bridge
modprobe: ERROR: could not insert 'bridge': Module already in kernel
modinfo bridge
~]$ modinfo bridge
modprobe(8) man page for more command options.
9.3.2. Create a Network Bridge Copy linkLink copied to clipboard!
/etc/sysconfig/network-scripts/ directory called ifcfg-brN, replacing N with the number for the interface, such as 0.
- The
DEVICEdirective is given an interface name as its argument in the formatbrN, where N is replaced with the number of the interface. - The
TYPEdirective is given an argumentBridge. This directive determines the device type and the argument is case sensitive. - The bridge interface configuration file is given an
IPaddress whereas the physical interface configuration file must only have a MAC address (see below). - An extra directive,
DELAY=0, is added to prevent the bridge from waiting while it monitors traffic, learns where hosts are located, and builds a table of MAC addresses on which to base its filtering decisions. The default delay of 15 seconds is not needed if no routing loops are possible.
Example 9.1. Example ifcfg-br0 Interface Configuration File
IP address:
Example 9.2. Example ifcfg-enp1s0 Interface Configuration File
/etc/sysconfig/network-scripts/ifcfg-device_name, where device_name is the name of the interface
ifcfg-rh, will create a name for the connection profile in the form “Type Interface”. In this example, this means the bridge will be named Bridge br0. Alternately, if NAME=bridge-br0 is added to the ifcfg-br0 file the connection profile will be named bridge-br0.
Note
DEVICE directive, almost any interface name could be used as it does not determine the device type. TYPE=Ethernet is not strictly required. If the TYPE directive is not set, the device is treated as an Ethernet device (unless its name explicitly matches a different interface configuration file).
HWADDR directive will influence the device naming procedure as explained in Chapter 11, Consistent Network Device Naming.
Warning
root in the following format: ifup device
ifup device
nmcli con load UUID and then call nmcli con up UUID.
root:
systemctl restart network
~]# systemctl restart network
ifup for all ifcfg files with ONBOOT=yes.
Note
monitor-connection-files option in the NetworkManager.conf file. See the NetworkManager.conf(5) manual page for more information.
9.3.3. Network Bridge with Bond Copy linkLink copied to clipboard!
Note
interface_name as the interface name is common practice but almost any name could be used.
/etc/sysconfig/network-scripts/ifcfg-bond0, as follows:
DEVICE=bond0 ONBOOT=yes BONDING_OPTS='mode=1 miimon=100' BRIDGE=brbond0
DEVICE=bond0
ONBOOT=yes
BONDING_OPTS='mode=1 miimon=100'
BRIDGE=brbond0
/etc/sysconfig/network-scripts/ifcfg-brbond0, as follows:
DEVICE=brbond0 ONBOOT=yes TYPE=Bridge IPADDR=192.168.1.1 PREFIX=24
DEVICE=brbond0
ONBOOT=yes
TYPE=Bridge
IPADDR=192.168.1.1
PREFIX=24
MASTER=bond0 directive. These point to the configuration file named /etc/sysconfig/network-scripts/ifcfg-bond0, which contains the DEVICE=bond0 directive. This ifcfg-bond0 in turn points to the /etc/sysconfig/network-scripts/ifcfg-brbond0 configuration file, which contains the IP address, and acts as an interface to the virtual networks inside the host.
root in the following format: ifup device
ifup device
nmcli con load UUID and then call nmcli con up UUID.
root:
systemctl restart network
~]# systemctl restart network
ifup for all ifcfg files with ONBOOT=yes.
Note
monitor-connection-files option in the NetworkManager.conf file. See the NetworkManager.conf(5) manual page for more information.
9.4. Configure Network Bridging Using a GUI Copy linkLink copied to clipboard!
IP configuration such as DHCP or IPv6 autoconfiguration. Static IP addressing is allowed to proceed before any ports or ports are connected or begin forwarding packets.
9.4.1. Establishing a Bridge Connection with a GUI Copy linkLink copied to clipboard!
Procedure 9.1. Adding a New Bridge Connection Using nm-connection-editor
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Add button. The Choose a Connection Type window appears. Select Bridge and click Create. The Editing Bridge connection 1 window appears.
Figure 9.5. Editing Bridge Connection 1
- Add port devices by referring to Procedure 9.3, “Adding a Port Interface to a Bridge” below.
Procedure 9.2. Editing an Existing Bridge Connection
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Select the Bridge connection you want to edit.
- Click the Edit button.
Configuring the Connection Name, Auto-Connect Behavior, and Availability Settings
- Connection name — Enter a descriptive name for your network connection. This name will be used to list this connection in the menu of the Network window.
- Automatically connect to this network when it is available — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See the section called “Editing an Existing Connection with control-center” for more information.
- All users may connect to this network — Select this box to create a connection available to all users on the system. Changing this setting may require root privileges. See Section 3.4.5, “Managing System-wide and Private Connection Profiles with a GUI” for details.
- Automatically connect to VPN when using this connection — Select this box if you want NetworkManager to auto-connect to a VPN connection when it is available. Select the VPN from the dropdown menu.
- Firewall Zone — Select the Firewall Zone from the dropdown menu. See the Red Hat Enterprise Linux 7 Security Guide for more information on Firewall Zones.
9.4.1.1. Configuring the Bridge Tab Copy linkLink copied to clipboard!
- Interface name
- The name of the interface to the bridge.
- Bridged connections
- One or more port interfaces.
- Aging time
- The time, in seconds, a MAC address is kept in the MAC address forwarding database.
- Enable IGMP snooping
- If required, select the check box to enable IGMP snooping on the device.
- Enable STP (Spanning Tree Protocol)
- If required, select the check box to enable
STP. - Priority
- The bridge priority; the bridge with the lowest priority will be elected as the root bridge.
- Forward delay
- The time, in seconds, spent in both the Listening and Learning states before entering the Forwarding state. The default is 15 seconds.
- Hello time
- The time interval, in seconds, between sending configuration information in bridge protocol data units (BPDU).
- Max age
- The maximum time, in seconds, to store the configuration information from BPDUs. This value should be twice the Hello Time plus 1 but less than twice the Forwarding delay minus 1.
- Group forward mask
- This property is a mask of group addresses that allows group addresses to be forwarded. In most cases, group addresses in the range from
01:80:C2:00:00:00to01:80:C2:00:00:0Fare not forwarded by the bridge device. This property is a mask of 16 bits, each corresponding to a group address in the above range, that must be forwarded. Note that theGroup forward maskproperty cannot have any of the0,1,2bits set to1because those addresses are used for Spanning tree protocol (STP), Link Aggregation Control Protocol (LACP) and Ethernet MAC pause frames.
Procedure 9.3. Adding a Port Interface to a Bridge
- To add a port to a bridge, select the Bridge tab in the Editing Bridge connection 1 window. If necessary, open this window by following the procedure in Procedure 9.2, “Editing an Existing Bridge Connection”.
- Click . The Choose a Connection Type menu appears.
- Select the type of connection to be created from the list. Click Create. A window appropriate to the connection type selected appears.
Figure 9.6. The NetworkManager Graphical User Interface Add a Bridge Connection
- Select the Bridge Port tab. Configure Priority and Path cost as required. Note the STP priority for a bridge port is limited by the Linux kernel. Although the standard allows a range of
0to255, Linux only allows0to63. The default is32in this case.Figure 9.7. The NetworkManager Graphical User Interface Bridge Port tab
- If required, select the Hairpin mode check box to enable forwarding of frames for external processing. Also known as virtual Ethernet port aggregator (VEPA) mode.
- An Ethernet port, click the Ethernet tab and proceed to the section called “Basic Configuration Options ”, or;
- A Bond port, click the Bond tab and proceed to Section 7.8.1.1, “Configuring the Bond Tab”, or;
- A Team port, click the Team tab and proceed to Section 8.14.1.1, “Configuring the Team Tab”, or;
- An VLAN port, click the VLAN tab and proceed to Section 10.5.1.1, “Configuring the VLAN Tab”, or;
Saving Your New (or Modified) Connection and Making Further Configurations
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”, or;IPv6settings for the connection, click the IPv6 Settings tab and proceed to Section 5.5, “Configuring IPv6 Settings”.
Figure 9.8. The NetworkManager Graphical User Interface with Bridge
9.5. Ethernet Bridge Configuration Using iproute Copy linkLink copied to clipboard!
priority, cost or state.
ip utility, issue the following command as root:
ip link set enp1s0 type bridge_slave option
~]# ip link set enp1s0 type bridge_slave option
ip utility, issue the following command as root:
ip-link(8) man page.
9.6. Additional Resources Copy linkLink copied to clipboard!
nmcli(1)man page — Describes NetworkManager's command‐line tool.nmcli-examples(5)man page — Gives examples of nmcli commands.nm-settings(5)man page — Description of settings and parameters of NetworkManager connections.ip-link(8)man page — Description of the bridge port options.
Chapter 10. Configure 802.1Q VLAN tagging Copy linkLink copied to clipboard!
- In the case of VLANs over bonds, it is important that the bond has ports and that they are “up” before opening the VLAN interface. Adding a VLAN interface to a bond without ports does not work.
- A VLAN port cannot be configured on a bond with the
fail_over_mac=followoption, because the VLAN virtual device cannot change its MAC address to match the parent's new MAC address. In such a case, traffic would still be sent with the now incorrect source MAC address. - Sending VLAN tagged packets through a network switch requires the switch to be properly configured. For example, ports on Cisco switches must be assigned to one VLAN or be configured as trunk ports to accept tagged packets from multiple VLANs. Some vendor switches allow untagged frames of the native VLAN to be processed by a trunk port. Some devices allow you to enable or disable the native VLAN, other devices have it disabled by default. Consequence of this disparity may result in native VLAN misconfiguration between two different switches, posing a security risk. For example:One switch uses native VLAN 1 while the other uses native VLAN 10. If the frames are allowed to pass without the tag being inserted, an attacker is able to jump VLANs - this common network penetration technique is also known as VLAN hopping.To minimize security risks, configure your interface as follows:
- Switches
- Unless you need them, disable trunk ports.
- If you need trunk ports, disable native VLAN, so that untagged frames are not allowed.
- Red Hat Enterprise Linux server
- Use the nftables or ebtables utilities to drop untagged frames in ingress filtering.
- Some older network interface cards, loopback interfaces, Wimax cards, and some InfiniBand devices, are said to be VLAN challenged, meaning they cannot support VLANs. This is usually because the devices cannot cope with VLAN headers and the larger MTU size associated with tagged packets.
Note
10.1. Selecting VLAN Interface Configuration Methods Copy linkLink copied to clipboard!
- To configure a VLAN interface using NetworkManager's text user interface tool, nmtui, proceed to Section 10.2, “Configure 802.1Q VLAN tagging Using the Text User Interface, nmtui”
- To configure a VLAN interface using NetworkManager's command-line tool, nmcli, proceed to Section 10.3, “Configure 802.1Q VLAN Tagging Using the Command Line Tool, nmcli”
- To configure a network interface manually, see Section 10.4, “Configure 802.1Q VLAN Tagging Using the Command Line”.
- To configure a network using graphical user interface tools, proceed to Section 10.5, “Configure 802.1Q VLAN Tagging Using a GUI”
10.2. Configure 802.1Q VLAN tagging Using the Text User Interface, nmtui Copy linkLink copied to clipboard!
nmtui
~]$ nmtui
Figure 10.1. The NetworkManager Text User Interface Add a VLAN Connection menu
Figure 10.2. The NetworkManager Text User Interface Configuring a VLAN Connection menu
10.3. Configure 802.1Q VLAN Tagging Using the Command Line Tool, nmcli Copy linkLink copied to clipboard!
nmcli con show
~]$ nmcli con show
NAME UUID TYPE DEVICE
System enp2s0 9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04 802-3-ethernet enp2s0
System enp1s0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet enp1s0
nmcli connection commands to identify a connection. Use the DEVICE name with other applications such as firewalld.
10, issue a command as follows:
nmcli con add type vlan ifname VLAN10 dev enp1s0 id 10
~]$ nmcli con add type vlan ifname VLAN10 dev enp1s0 id 10
Connection 'vlan-VLAN10' (37750b4a-8ef5-40e6-be9b-4fb21a4b6d17) successfully added.
con-name was given for the VLAN interface, the name was derived from the interface name by prepending the type. Alternatively, specify a name with the con-name option as follows:
nmcli con add type vlan con-name VLAN12 dev enp1s0 id 12
~]$ nmcli con add type vlan con-name VLAN12 dev enp1s0 id 12
Connection 'VLAN12' (b796c16a-9f5f-441c-835c-f594d40e6533) successfully added.
Assigning Addresses to VLAN Interfaces
IPv4 address and gateway is as follows:
nmcli con add type vlan con-name VLAN20 dev enp1s0 id 20 ip4 10.10.10.10/24 \ gw4 10.10.10.254
~]$ nmcli con add type vlan con-name VLAN20 dev enp1s0 id 20 ip4 10.10.10.10/24 \
gw4 10.10.10.254
nmcli con add type vlan con-name VLAN30 dev enp1s0 id 30
~]$ nmcli con add type vlan con-name VLAN30 dev enp1s0 id 30
nmcli(1) man page. In the man pages the device on which the VLAN is created is referred to as the parent device. In the example above the device was specified by its interface name, enp1s0, it can also be specified by the connection UUID or MAC address.
13, issue a command as follows:
nmcli con add type vlan con-name VLAN1 dev enp2s0 id 13 ingress "2:3,3:5"
~]$ nmcli con add type vlan con-name VLAN1 dev enp2s0 id 13 ingress "2:3,3:5"
nmcli connection show vlan-VLAN10
~]$ nmcli connection show vlan-VLAN10
nmcli connection modify vlan-VLAN10 802.mtu 1496
~]$ nmcli connection modify vlan-VLAN10 802.mtu 1496
connection.interface-name and vlan.interface-name have to be the same (if they are set). They must therefore be changed simultaneously using nmcli's interactive mode. To change a VLAN connections name, issue commands as follows:
nmcli con edit vlan-VLAN10
~]$ nmcli con edit vlan-VLAN10
nmcli> set vlan.interface-name superVLAN
nmcli> set connection.interface-name superVLAN
nmcli> save
nmcli> quit
ioctl flags which change the way the 802.1Q code functions. The following VLAN flags are supported by NetworkManager:
- 0x01 - reordering of output packet headers
- 0x02 - use GVRP protocol
- 0x04 - loose binding of the interface and its master
0x04 enables a loose binding mode, in which only the operational state is passed from the parent to the associated VLANs, but the VLAN device state is not changed.
nmcli connection modify vlan-VLAN10 vlan.flags 1
~]$ nmcli connection modify vlan-VLAN10 vlan.flags 1
10.4. Configure 802.1Q VLAN Tagging Using the Command Line Copy linkLink copied to clipboard!
8021q module is loaded by default. If necessary, you can make sure that the module is loaded by issuing the following command as root:
modprobe --first-time 8021q
~]# modprobe --first-time 8021q
modprobe: ERROR: could not insert '8021q': Module already in kernel
modinfo 8021q
~]$ modinfo 8021q
modprobe(8) man page for more command options.
10.4.1. Setting Up 802.1Q VLAN Tagging Using ifcfg Files Copy linkLink copied to clipboard!
- Configure the parent interface in
/etc/sysconfig/network-scripts/ifcfg-device_name, where device_name is the name of the interface:DEVICE=interface_name TYPE=Ethernet BOOTPROTO=none ONBOOT=yes
DEVICE=interface_name TYPE=Ethernet BOOTPROTO=none ONBOOT=yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the VLAN interface configuration in the
/etc/sysconfig/network-scripts/directory. The configuration file name should be the parent interface plus a.character plus the VLAN ID number. For example, if the VLAN ID is 192, and the parent interface is enp1s0, then the configuration file name should beifcfg-enp1s0.192:Copy to Clipboard Copied! Toggle word wrap Toggle overflow If there is a need to configure a second VLAN, with for example, VLAN ID 193, on the same interface, enp1s0, add a new file with the nameenp1s0.193with the VLAN configuration details. - Restart the networking service in order for the changes to take effect. As
rootissue the following command:systemctl restart network
~]# systemctl restart networkCopy to Clipboard Copied! Toggle word wrap Toggle overflow
10.4.2. Configure 802.1Q VLAN Tagging Using ip Commands Copy linkLink copied to clipboard!
8, issue a command as root as follows:
ip link add link enp1s0 name enp1s0.8 type vlan id 8
~]# ip link add link enp1s0 name enp1s0.8 type vlan id 8
ip -d link show enp1s0.8
~]$ ip -d link show enp1s0.8
4: enp1s0.8@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 52:54:00:ce:5f:6c brd ff:ff:ff:ff:ff:ff promiscuity 0
vlan protocol 802.1Q id 8 <REORDER_HDR>
0x and as an octal value if it has a leading 0. This means that in order to assign a VLAN ID with a decimal value of 22, you must not add any leading zeros.
root as follows:
ip link delete enp1s0.8
~]# ip link delete enp1s0.8
ip link add link enp1s0 name enp1s0.1 type vlan id 1 ip link add link enp1s0 name enp1s0.2 type vlan id 2
~]# ip link add link enp1s0 name enp1s0.1 type vlan id 1
ip link set dev enp1s0.1 up
~]# ip link add link enp1s0 name enp1s0.2 type vlan id 2
ip link set dev enp1s0.2 up
tcpdump -nnei enp1s0 -vvv
tcpdump -nnei enp1s0 -vvv
Note
ifcfg files. See Section 10.4.1, “Setting Up 802.1Q VLAN Tagging Using ifcfg Files”
10.5. Configure 802.1Q VLAN Tagging Using a GUI Copy linkLink copied to clipboard!
10.5.1. Establishing a VLAN Connection Copy linkLink copied to clipboard!
Procedure 10.1. Adding a New VLAN Connection Using nm-connection-editor
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Add button. The Choose a Connection Type window appears. Select VLAN and click Create. The Editing VLAN connection 1 window appears.
- On the VLAN tab, select the parent interface from the drop-down list you want to use for the VLAN connection.
- Enter the VLAN ID
- Enter a VLAN interface name. This is the name of the VLAN interface that will be created. For example,
enp1s0.1orvlan2. (Normally this is either the parent interface name plus “.” and the VLAN ID, or “vlan” plus the VLAN ID.) - Review and confirm the settings and then click the Save button.
- To edit the VLAN-specific settings see Section 10.5.1.1, “Configuring the VLAN Tab”.
Figure 10.3. Adding a New VLAN Connection Using nm-connection-editor
Procedure 10.2. Editing an Existing VLAN Connection
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Select the connection you want to edit and click the Edit button.
- Select the General tab.
- Configure the connection name, auto-connect behavior, and availability settings.These settings in the Editing dialog are common to all connection types:
- Connection name — Enter a descriptive name for your network connection. This name will be used to list this connection in the VLAN section of the Network window.
- Automatically connect to this network when it is available — Select this box if you want NetworkManager to auto-connect to this connection when it is available. Refer to the section called “Editing an Existing Connection with control-center” for more information.
- Available to all users — Select this box to create a connection available to all users on the system. Changing this setting may require root privileges. Refer to Section 3.4.5, “Managing System-wide and Private Connection Profiles with a GUI” for details.
- To edit the VLAN-specific settings see Section 10.5.1.1, “Configuring the VLAN Tab”.
Saving Your New (or Modified) Connection and Making Further Configurations
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”.orIPv6settings for the connection, click the IPv6 Settings tab and proceed to Section 5.5, “Configuring IPv6 Settings”.
10.5.1.1. Configuring the VLAN Tab Copy linkLink copied to clipboard!
- Parent Interface
- A previously configured interface can be selected in the drop-down list.
- VLAN ID
- The identification number to be used to tag the VLAN network traffic.
- VLAN interface name
- The name of the VLAN interface that will be created. For example,
enp1s0.1orvlan2. - Cloned MAC address
- Optionally sets an alternate MAC address to use for identifying the VLAN interface. This can be used to change the source MAC address for packets sent on this VLAN.
- MTU
- Optionally sets a Maximum Transmission Unit (MTU) size to be used for packets to be sent over the VLAN connection.
10.6. VLAN on Bond and Bridge Using ip Commands Copy linkLink copied to clipboard!
- Add a bond device as
root:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set VLAN on the bond device:
ip link add link bond0 name bond0.2 type vlan id 2 ip link set bond0.2 up
# ip link add link bond0 name bond0.2 type vlan id 2 # ip link set bond0.2 upCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the bridge device and attach VLAN to it:
ip link add br0 type bridge ip link set bond0.2 master br0 ip link set br0 up
# ip link add br0 type bridge # ip link set bond0.2 master br0 # ip link set br0 upCopy to Clipboard Copied! Toggle word wrap Toggle overflow
10.7. VLAN on Bond and Bridge Using the NetworkManager Command Line Tool, nmcli Copy linkLink copied to clipboard!
- Add a bond device:Note that in this case a bond connection serves only as a "lower interface" for VLAN, and does not get any IP address. Therefore, the
nmcli connection add type bond con-name Bond0 ifname bond0 bond.options "mode=active-backup,miimon=100" ipv4.method disabled ipv6.method ignore
~]$ nmcli connection add type bond con-name Bond0 ifname bond0 bond.options "mode=active-backup,miimon=100" ipv4.method disabled ipv6.method ignoreCopy to Clipboard Copied! Toggle word wrap Toggle overflow ipv4.method disabledandipv6.method ignoreparameters have been added on the command line. - Add ports to the bond device:
nmcli connection add type ethernet con-name Slave1 ifname em1 master bond0 slave-type bond nmcli connection add type ethernet con-name Slave2 ifname em2 master bond0 slave-type bond
~]$ nmcli connection add type ethernet con-name Slave1 ifname em1 master bond0 slave-type bond ~]$ nmcli connection add type ethernet con-name Slave2 ifname em2 master bond0 slave-type bondCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add a bridge device:
nmcli connection add type bridge con-name Bridge0 ifname br0 ipv4.method manual ipv4.addresses 192.0.2.1/24
~]$ nmcli connection add type bridge con-name Bridge0 ifname br0 ipv4.method manual ipv4.addresses 192.0.2.1/24Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add a VLAN interface on top of bond, assigned to the bridge device:
nmcli connection add type vlan con-name Vlan2 ifname bond0.2 dev bond0 id 2 master br0 slave-type bridge
~]$ nmcli connection add type vlan con-name Vlan2 ifname bond0.2 dev bond0 id 2 master br0 slave-type bridgeCopy to Clipboard Copied! Toggle word wrap Toggle overflow - View the created connections:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.8. Configuring VLAN switchport mode Copy linkLink copied to clipboard!
switchport mode when the Ethernet interface is connected to a switch and there are VLANs running over the physical interface. A Red Hat Enterprise Linux server or workstation is usually connected to only one VLAN, which makes switchport mode access suitable, and the default setting.
switchport mode trunk to be configured on both ends.
switchport mode trunk. If you only set an IP address on an interface, use Cisco switchport mode access.
10.9. Additional Resources Copy linkLink copied to clipboard!
ip-link(8)man page — Describes the ip utility's network device configuration commands.nmcli(1)man page — Describes NetworkManager's command‐line tool.nmcli-examples(5)man page — Gives examples of nmcli commands.nm-settings(5)man page — Description of settings and parameters of NetworkManager connections.nm-settings-ifcfg-rh(5)man page — Description of ifcfg-rh settings in the/etc/sysconfig/network-scripts/ifcfg-*files.
Chapter 11. Consistent Network Device Naming Copy linkLink copied to clipboard!
eth[0123…]s0, but these names do not necessarily correspond to actual labels on the chassis. Modern server platforms with multiple network adapters can encounter non-deterministic and counter-intuitive naming of these interfaces. This affects both network adapters embedded on the motherboard (Lan-on-Motherboard, or LOM) and add-in (single and multiport) adapters.
Warning
11.1. Naming Schemes Hierarchy Copy linkLink copied to clipboard!
systemd will name interfaces using the following policy to apply the supported naming schemes:
- Scheme 1: Names incorporating Firmware or BIOS provided index numbers for on-board devices (example:
eno1), are applied if that information from the firmware or BIOS is applicable and available, else falling back to scheme 2. - Scheme 2: Names incorporating Firmware or BIOS provided PCI Express hotplug slot index numbers (example:
ens1) are applied if that information from the firmware or BIOS is applicable and available, else falling back to scheme 3. - Scheme 3: Names incorporating physical location of the connector of the hardware (example:
enp2s0), are applied if applicable, else falling directly back to scheme 5 in all other cases. - Scheme 4: Names incorporating interface's MAC address (example:
enx78e7d1ea46da), is not used by default, but is available if the user chooses. - Scheme 5: The traditional unpredictable kernel naming scheme, is used if all other methods fail (example:
eth0).
biosdevname=1 as a kernel command-line parameter, except in the case of a Dell system, where biosdevname will be used by default as long as it is installed. If the user has added udev rules which change the name of the kernel devices, those rules will take precedence.
11.2. Understanding the Device Renaming Procedure Copy linkLink copied to clipboard!
- A rule in
/usr/lib/udev/rules.d/60-net.rulesinstructs the udev helper utility, /lib/udev/rename_device, to look into all/etc/sysconfig/network-scripts/ifcfg-suffixfiles. If it finds anifcfgfile with aHWADDRentry matching the MAC address of an interface it renames the interface to the name given in theifcfgfile by theDEVICEdirective. - A rule in
/usr/lib/udev/rules.d/71-biosdevname.rulesinstructs biosdevname to rename the interface according to its naming policy, provided that it was not renamed in a previous step, biosdevname is installed, andbiosdevname=0was not given as a kernel command on the boot command line. - A rule in
/lib/udev/rules.d/75-net-description.rulesinstructs udev to fill in the internal udev device property values ID_NET_NAME_ONBOARD, ID_NET_NAME_SLOT, ID_NET_NAME_PATH, ID_NET_NAME_MAC by examining the network interface device. Note, that some device properties might be undefined. - A rule in
/usr/lib/udev/rules.d/80-net-name-slot.rulesinstructs udev to rename the interface, provided that it was not renamed in step 1 or 2, and the kernel parameternet.ifnames=0was not given, according to the following priority: ID_NET_NAME_ONBOARD, ID_NET_NAME_SLOT, ID_NET_NAME_PATH. It falls through to the next in the list, if one is unset. If none of these are set, then the interface will not be renamed.
11.3. Understanding the Predictable Network Interface Device Names Copy linkLink copied to clipboard!
enfor Ethernet,wlfor wireless LAN (WLAN),wwfor wireless wide area network (WWAN).
- o<index>
- on-board device index number
- s<slot>[f<function>][d<dev_id>]
- hotplug slot index number. All multi-function PCI devices will carry the
[f<function>]number in the device name, including the function0device. - x<MAC>
- MAC address
- [P<domain>]p<bus>s<slot>[f<function>][d<dev_id>]
- PCI geographical location. In PCI geographical location, the
[P<domain>]number is only mentioned if the value is not0. For example:ID_NET_NAME_PATH=P1enp5s0 - [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
- USB port number chain. For USB devices, the full chain of port numbers of hubs is composed. If the name gets longer than the maximum number of 15 characters, the name is not exported. If there are multiple USB devices in the chain, the default values for USB configuration descriptors
(c1)and USB interface descriptors(i0)are suppressed.
11.4. Naming Scheme for Network Devices Available for Linux on System z Copy linkLink copied to clipboard!
0.n, where n is the subchannel set ID. For example, 0.1.0ab1.
enccw0.0.1234
enccw0.0.1234
slccw0.0.1234
slccw0.0.1234
znetconf -c command or the lscss -a command to display available network devices and their bus-IDs.
| Format | Description |
|---|---|
| enccwbus-ID | device type Ethernet |
| slccwbus-ID | CTC network devices of device type SLIP |
11.5. Naming Scheme for VLAN Interfaces Copy linkLink copied to clipboard!
VLAN-ID ranges from 0 to 4096, which is a maximum of four characters and the total interface name has a limit of 15 characters. The maximum interface name length is defined by the kernel headers and is a global limit, affecting all applications.
- VLAN plus VLAN ID
- The word
vlanplus the VLAN ID. For example: vlan0005 - VLAN plus VLAN ID without padding
- The word
vlanplus the VLAN ID without padding by means of additional leading zeros. For example: vlan5 - Device name plus VLAN ID
- The name of the parent interface plus the VLAN ID. For example: enp1s0.0005
- Device name plus VLAN ID without padding
- The name of the parent interface plus the VLAN ID without padding by means of additional leading zeros. For example: enp1s0.5
11.6. Consistent Network Device Naming Using biosdevname Copy linkLink copied to clipboard!
eth[0123…] to the new naming convention as shown in Table 11.2, “The biosdevname Naming Convention”. Note that unless the system is a Dell system, or biosdevname is explicitly enabled as described in Section 11.6.2, “Enabling and Disabling the Feature”, the systemd naming scheme will take precedence.
| Device | Old Name | New Name |
|---|---|---|
| Embedded network interface (LOM) | eth[0123…] | em[1234…][a] |
| PCI card network interface | eth[0123…] | p<slot>p<ethernet port>[b] |
| Virtual function | eth[0123…] | p<slot>p<ethernet port>_<virtual interface>[c] |
[a]
New enumeration starts at 1.
[b]
For example: p3p4
[c]
For example: p3p4_1
| ||
11.6.1. System Requirements Copy linkLink copied to clipboard!
root:
yum install biosdevname
~]# yum install biosdevname
11.6.2. Enabling and Disabling the Feature Copy linkLink copied to clipboard!
biosdevname=0
biosdevname=0
biosdevname=1
biosdevname=1
systemd naming scheme as described in the beginning of the chapter.
biosdevname install option is specified, it must remain as a boot option for the lifetime of the system.
11.7. Notes for Administrators Copy linkLink copied to clipboard!
irqbalance, and other similar configuration files. Also, enabling this change for installation will require modification to existing kickstart files that use device names through the ksdevice parameter; these kickstart files will need to be updated to use the network device's MAC address or the network device's new name.
Note
11.8. Controlling the Selection of Network Device Names Copy linkLink copied to clipboard!
- By identifying the network interface device
- Setting the MAC address in an
ifcfgfile using theHWADDRdirective enables it to be identified by udev. The name will be taken from the string given by theDEVICEdirective, which by convention is the same as theifcfgsuffix. For example,ifcfg-enp1s0. - By turning on or off biosdevname
- The name provided by biosdevname will be used (if biosdevname can determine one).
- By turning on or off the
systemd-udevnaming scheme - The name provided by
systemd-udevwill be used (ifsystemd-udevcan determine one).
11.9. Troubleshooting Network Device Naming Copy linkLink copied to clipboard!
root:
udevadm info /sys/class/net/ifname | grep ID_NET_NAME
~]# udevadm info /sys/class/net/ifname | grep ID_NET_NAME
ls /sys/class/net/
~]$ ls /sys/class/net/
/usr/lib/udev/rules.d/60-net.rules- from initscripts,/usr/lib/udev/rules.d/71-biosdevname.rules- from biosdevname,/usr/lib/udev/rules.d/80-net-name-slot.rules- fromsystemd
80-net-name-slot.rules from /usr to /etc and edit the file appropriately. In other words, comment out or arrange schemes to be used in a certain order.
Example 11.1. Some Interfaces Have Names from the Kernel Namespace (eth[0,1,2...]) While Others Are Successfully Renamed by udev
Example 11.2. In /var/log/messages or the systemd Journal, Renaming Is Seen to Be Done Twice for Each Interface
initrd image are likely to encounter this issue. The interface name is initially assigned (through biosdevname or udev or dracut parameters on the kernel command line) during early-boot while still in initrd. Then after switching to real rootfs, renaming is done a second time and a new interface name is determined by the /usr/lib/udev/rename_device binary spawned by udev because of processing 60-net.rules. You can safely ignore such messages.
Example 11.3. Using Naming Scheme in ifcfg Files with ethX Names Does Not Work
/usr/lib/udev/rules.d/60-net.rules file.
- The system has only one network interface.
- When used for virtio NICs in Red Hat Enterprise Linux 7 virtual machine guests. See the KVM Paravirtualized (virtio) Drivers and Network Configuration chapters in the Virtualization Deployment and Administration Guide
Example 11.4. Setting net.ifnames=0 Results in Inconsistent enpXxX Names
systemd predictable interface naming (net.ifnames) and biosdevname naming schemes are disabled, network interfaces continue to use the unpredictable and potentially inconsistent ethX name originally given by the kernel.
systemd predictable interface naming scheme or the biosdevname naming scheme to rename the kernel unpredictable ethX interfaces in a predictable way to a name which is always consistent across reboots.
Example 11.5. Limitations for Prefixes of Ethernet Interfaces
- It consists of ASCII characters.
- It is an alpha-numeric string.
- It is shorter than 16 characters.
- It does not conflict with any other well-known prefix used for network interface naming, such as
eth,eno,ens, andem.
11.10. Additional Resources Copy linkLink copied to clipboard!
Installed Documentation
udev(7)man page — Describes the Linux dynamic device management daemon,udevd.systemd(1)man page — Describessystemdsystem and service manager.biosdevname(1)man page — Describes the utility for obtaining the BIOS-given name of a device.
Online Documentation
- The IBM Knowledge Center Publication SC34-2710-00 Device Drivers, Features, and Commands on Red Hat Enterprise Linux 7 includes information on “Predictable network device names” for IBM System z devices and attachments.
Chapter 12. Configuring Policy-based Routing to Define Alternative Routes Copy linkLink copied to clipboard!
Note
nmcli utility supports setting routing rules and assigning routes to specific tables.
12.1. Routing Traffic from a Specific Subnet to a Different Default Gateway Copy linkLink copied to clipboard!
Figure 12.1. Activate a Connection
Prerequisites
- The RHEL router you want to set up in the procedure has four network interfaces:
- The
enp7s0interface is connected to the network of provider A. The gateway IP in the provider’s network is198.51.100.2, and the network uses a/30network mask. - The
enp1s0interface is connected to the network of provider B. The gateway IP in the provider’s network is192.0.2.2, and the network uses a/30network mask. - The
enp8s0interface is connected to the10.0.0.0/24subnet with internal workstations. - The
enp9s0interface is connected to the203.0.113.0/24subnet with the company’s servers.
- Hosts in the internal workstations subnet use
10.0.0.1as default gateway. In the procedure, you assign this IP address to theenp8s0network interface of the router. - Hosts in the server subnet use
203.0.113.1as default gateway. In the procedure, you assign this IP address to theenp9s0network interface of the router. - The
firewalldservice is enabled and active, which is the default.
Procedure
- Configure the network interface to provider A:
nmcli connection add type ethernet con-name Provider-A ifname enp7s0 ipv4.method manual ipv4.addresses 198.51.100.1/30 ipv4.gateway 198.51.100.2 ipv4.dns 198.51.100.200 connection.zone external
# nmcli connection add type ethernet con-name Provider-A ifname enp7s0 ipv4.method manual ipv4.addresses 198.51.100.1/30 ipv4.gateway 198.51.100.2 ipv4.dns 198.51.100.200 connection.zone externalCopy to Clipboard Copied! Toggle word wrap Toggle overflow Thenmcli connection addcommand creates a NetworkManager connection profile. The following list describes the options of the command:type ethernet: Defines that the connection type is Ethernet.con-name connection_name: Sets the name of the profile. Use a meaningful name to avoid confusion.ifname network_device: Sets the network interface.ipv4.method manual: Enables to configure a static IP address.ipv4.addresses IP_address/subnet_mask: Sets the IPv4 addresses and subnet mask.ipv4.gateway IP_address: Sets the default gateway address.ipv4.dns IP_of_DNS_server: Sets the IPv4 address of the DNS server.connection.zone firewalld_zone: Assigns the network interface to the definedfirewalldzone. Note thatfirewalldautomatically enables masquerading interfaces assigned to theexternalzone.
- Configure the network interface to provider B:
nmcli connection add type ethernet con-name Provider-B ifname enp1s0 ipv4.method manual ipv4.addresses 192.0.2.1/30 ipv4.routes "0.0.0.0/1 192.0.2.2 table=5000, 128.0.0.0/1 192.0.2.2 table=5000" connection.zone external
# nmcli connection add type ethernet con-name Provider-B ifname enp1s0 ipv4.method manual ipv4.addresses 192.0.2.1/30 ipv4.routes "0.0.0.0/1 192.0.2.2 table=5000, 128.0.0.0/1 192.0.2.2 table=5000" connection.zone externalCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command uses theipv4.routesparameter instead ofipv4.gatewayto 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.Note
Thenmcliutility does not support using0.0.0.0/0for the default gateway inipv4.gateway. To work around this problem, the command creates separate routes for both the0.0.0.0/1and128.0.0.0/1subnets, which covers also the full IPv4 address space. - Configure the network interface to the internal workstations subnet:
nmcli connection add type ethernet con-name Internal-Workstations ifname enp8s0 ipv4.method manual ipv4.addresses 10.0.0.1/24 ipv4.routes "10.0.0.0/24 src=192.0.2.1 table=5000" ipv4.routing-rules "priority 5 from 10.0.0.0/24 table 5000" connection.zone trusted
# nmcli connection add type ethernet con-name Internal-Workstations ifname enp8s0 ipv4.method manual ipv4.addresses 10.0.0.1/24 ipv4.routes "10.0.0.0/24 src=192.0.2.1 table=5000" ipv4.routing-rules "priority 5 from 10.0.0.0/24 table 5000" connection.zone trustedCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command uses theipv4.routesparameter to add a static route to the routing table with ID5000. This static route for the10.0.0.0/24subnet uses the IP of the local network interface to provider B (192.0.2.1) as next hop.Additionally, the command uses theipv4.routing-rulesparameter to add a routing rule with priority5that routes traffic from the10.0.0.0/24subnet to table5000. Low values have a high priority.Note that the syntax in theipv4.routing-rulesparameter is the same as in anip route addcommand, except thatipv4.routing-rulesalways requires specifying a priority. - Configure the network interface to the server subnet:
nmcli connection add type ethernet con-name Servers ifname enp9s0 ipv4.method manual ipv4.addresses 203.0.113.1/24 connection.zone trusted
# nmcli connection add type ethernet con-name Servers ifname enp9s0 ipv4.method manual ipv4.addresses 203.0.113.1/24 connection.zone trustedCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification Steps
- On a RHEL host in the internal workstation subnet:
- Install the traceroute package:
yum install traceroute
# yum install tracerouteCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
tracerouteutility to display the route to a host on the internet:traceroute redhat.com
# 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 ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output of the command displays that the router sends packets over192.0.2.1, which is the network of provider B.
- On a RHEL host in the server subnet:
- Install the traceroute package:
yum install traceroute
# yum install tracerouteCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
tracerouteutility to display the route to a host on the internet:traceroute redhat.com
# 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 ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output of the command displays that the router sends packets over198.51.100.2, which is the network of provider A.
Troubleshooting Steps
- Display the rule list:
ip rule list
# 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 defaultCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Display the routes in table
5000:ip route list table 5000
# ip route list table 5000 0.0.0.0/1 via 192.0.2.2 dev enp1s0 proto static metric 100 10.0.0.0/24 dev enp8s0 proto static scope link src 192.0.2.1 metric 102 128.0.0.0/1 via 192.0.2.2 dev enp1s0 proto static metric 100Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Display which interfaces are assigned to which firewall zones:
firewall-cmd --get-active-zones
# firewall-cmd --get-active-zones external interfaces: enp1s0 enp7s0 trusted interfaces: enp8s0 enp9s0Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that the
externalzone has masquerading enabled:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional Resources
- For further details about the
ipv4.*parameters you can set in thenmcli connection addcommand, see the IPv4 settings section in the nm-settings(5) man page. - For further details about the
connection.*parameters you can set in thenmcli connection addcommand, see the Connection settings section in the nm-settings(5) man page. - For further details about managing NetworkManager connections using
nmcli, see the Connection management commands section in the nmcli(1) man page.
Part III. InfiniBand and RDMA Networking Copy linkLink copied to clipboard!
Chapter 13. Configure InfiniBand and RDMA Networks Copy linkLink copied to clipboard!
13.1. Understanding InfiniBand and RDMA technologies Copy linkLink copied to clipboard!
IP data transfer, application X on machine A sends some data to application Y on machine B. As part of the transfer, the kernel on machine B must first receive the data, decode the packet headers, determine that the data belongs to application Y, wake up application Y, wait for application Y to perform a read syscall into the kernel, then it must manually copy the data from the kernel's own internal memory space into the buffer provided by application Y. This process means that most network traffic must be copied across the system's main memory bus at least twice (once when the host adapter uses DMA to put the data into the kernel-provided memory buffer, and again when the kernel moves the data to the application's memory buffer) and it also means the computer must execute a number of context switches to switch between kernel context and application Y context. Both of these things impose extremely high CPU loads on the system when network traffic is flowing at very high rates and can make other tasks to slow down.
IP communications because they bypass kernel intervention in the communication process, and in the process greatly reduce the CPU overhead normally needed to process network communications. The RDMA protocol allows the host adapter in the machine to know when a packet comes in from the network, which application should receive that packet, and where in the application's memory space it should go. Instead of sending the packet to the kernel to be processed and then copied into the user application's memory, it places the contents of the packet directly in the application's buffer without any further intervention necessary. However, it cannot be accomplished using the standard Berkeley Sockets API that most IP networking applications are built upon, so it must provide its own API, the InfiniBand Verbs API, and applications must be ported to this API before they can use RDMA technology directly.
- The Internet Wide Area RDMA Protocol (iWARP)iWARP is a computer networking protocol that implements remote direct memory access (RDMA) for efficient data transfer over Internet Protocol (IP) networks.
- The RDMA over Converged Ethernet (RoCE) protocol, which later renamed to InfiniBand over Ethernet (IBoE).RoCE is a network protocol that allows remote direct memory access (RDMA) over an Ethernet network.
Prerequisites
IP network link layer as their underlying technology, and so the majority of their configuration is actually covered in Chapter 3, Configuring IP Networking. For the most part, once their IP networking features are properly configured, their RDMA features are all automatic and will show up as long as the proper drivers for the hardware are installed. The kernel drivers are always included with each kernel Red Hat provides, however the user-space drivers must be installed manually if the InfiniBand package group was not selected at machine install time.
root:
yum install libibverbs
~]# yum install libibverbs
/etc/modprobe.d/mlx4.conf to instruct the driver which packet priority is configured for the “no-drop” service on the Ethernet switches the cards are plugged into and rebuild the initramfs to include the modified file. Newer mlx5-based cards auto-negotiate PFC settings with the switch and do not need any module option to inform them of the “no-drop” priority or priorities.
13.2. Transferring Data Using RoCE Copy linkLink copied to clipboard!
- RoCE v1
- The
RoCE v1protocol is an Ethernet link layer protocol with ethertype0x8915that enables communication between any two hosts in the same Ethernet broadcast domain. RoCE v1 is the default version for RDMA Connection Manager (RDMA_CM) when using the ConnectX-3 network adapter. - RoCE v2
- The
RoCE v2protocol exists on top of either the UDP over IPv4 or the UDP over IPv6 protocol. The UDP destination port number4791has been reserved for RoCE v2. Since Red Hat Enterprise Linux 7.5, RoCE v2 is the default version for RDMA_CM when using the ConnectX-3 Pro, ConnectX-4, ConnectX-4 Lx and ConnectX-5 network adapters. Hardware supports bothRoCE v1andRoCE v2.
Prerequisites
- Both client and server support the same RoCE mode.
- A client supports RoCE v1 and a server RoCE v2.
- A successful connection:
- If a client is in RoCE v1 or in RoCE v2 mode depending on the network card and the driver used, the corresponding server must have the same version to create a connection. Also, the connection is successful if a client is in RoCE v1 and a server in RoCE v2 mode.
- A failed connection:
- If a client is in RoCE v2 and the corresponding server is in RoCE v1, no connection can be established. In this case, update the driver or the network adapter of the corresponding server, see Section 13.2, “Transferring Data Using RoCE”
| Client | Server | Default setting |
|---|---|---|
| RoCE v1 | RoCE v1 | Connection |
| RoCE v1 | RoCE v2 | Connection |
| RoCE v2 | RoCE v2 | Connection |
| RoCE v2 | RoCE v1 | No connection |
Procedure 13.1. Changing the Default RoCE Mode When the Hardware Is Already Running in Roce v2
- Change into the
/sys/kernel/config/rdma_cmdirectory to et the RoCE mode:cd /sys/kernel/config/rdma_cm
~]# cd /sys/kernel/config/rdma_cmCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Enter the
ibstatcommand with an Ethernet network device to display the status. For example, for mlx5_0:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a directory for the mlx5_0 device:
mkdir mlx5_0
~]# mkdir mlx5_0Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Display the RoCE mode in the
default_roce_modefile in the tree format:cd mlx5_0
~]# cd mlx5_0Copy to Clipboard Copied! Toggle word wrap Toggle overflow tree
~]$ tree └── ports └── 1 ├── default_roce_mode └── default_roce_tosCopy to Clipboard Copied! Toggle word wrap Toggle overflow ~]$ cat /sys/kernel/config/rdma_cm/mlx5_0/ports/1/default_roce_mode RoCE v2~]$ cat /sys/kernel/config/rdma_cm/mlx5_0/ports/1/default_roce_mode RoCE v2Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Change the default RoCE mode:
echo "RoCE v1" > /sys/kernel/config/rdma_cm/mlx5_0/ports/1/default_roce_mode
~]# echo "RoCE v1" > /sys/kernel/config/rdma_cm/mlx5_0/ports/1/default_roce_modeCopy to Clipboard Copied! Toggle word wrap Toggle overflow - View the changes:
~]$ cat /sys/kernel/config/rdma_cm/mlx5_0/ports/1/default_roce_mode RoCE v1~]$ cat /sys/kernel/config/rdma_cm/mlx5_0/ports/1/default_roce_mode RoCE v1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.3. Configuring Soft-RoCE Copy linkLink copied to clipboard!
Prerequisites
rxe_cfg script. To view options for rxe_cfg, enter rxe_cfg help.
Procedure 13.2. Configuring Soft-RoCE
- As the
rootuser, enter the following command to display the current configuration status of RXE:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To load the RXE kernel module and start RXE, enter as
root:Optionally, to verify that the RXE kernel module is loaded, enter:rxe_cfg start
~]# rxe_cfg start Name Link Driver Speed NMTU IPv4_addr RDEV RMTU igb_1 yes igb mlx4_1 no mlx4_en mlx4_2 no mlx4_enCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Before adding a new RXE device over an Ethernet interface, the corresponding interface should be opened and has a valid IP address assigned. To add a new RXE device, for example igb_1:
rxe_cfg add igb_1
~]# rxe_cfg add igb_1Copy to Clipboard Copied! Toggle word wrap Toggle overflow The rxe0 in the RDEV column indicates that rxe is enabled for the igb_1 device.rxe_cfg status
~]# rxe_cfg status Name Link Driver Speed NMTU IPv4_addr RDEV RMTU igb_1 yes igb rxe0 1024 (3) mlx4_1 no mlx4_en mlx4_2 no mlx4_enCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To verify the status of an RXE device, use the
ibv_devicescommand:Alternatively, enter theibv_devices
~]# ibv_devices device node GUID ------ ---------------- mlx4_0 0002c90300b3cff0 rxe0 a2369ffffe018294Copy to Clipboard Copied! Toggle word wrap Toggle overflow ibstatfor a detailed status:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Removing an RXE device
rxe_cfg remove igb_1
~]# rxe_cfg remove igb_1
Verifying Connectivity of an RXE device
Example 13.1. Verifying Connectivity of an RXE device on the Server Side
Example 13.2. Verifying Connectivity of an RXE device on the Client Side
13.5. Configuring the Base RDMA Subsystem Copy linkLink copied to clipboard!
rdma service is automatic. When RDMA capable hardware, whether InfiniBand or iWARP or RoCE/IBoE is detected, udev instructs systemd to start the rdma service.
systemctl status rdma
~]# systemctl status rdma
● rdma.service - Initialize the iWARP/InfiniBand/RDMA stack in the kernel
Loaded: loaded (/usr/lib/systemd/system/rdma.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: file:/etc/rdma/rdma.conf
rdma service, but they can if they want to force it on all the time. To do that, enter the following command as root:
systemctl enable rdma
~]# systemctl enable rdma
13.5.1. Configuration of the rdma.conf file Copy linkLink copied to clipboard!
rdma service reads /etc/rdma/rdma.conf to find out which kernel-level and user-level RDMA protocols the administrator wants to be loaded by default. Users should edit this file to turn various drivers on or off.
IPoIB— This is anIPnetwork emulation layer that allowsIPapplications to run over InfiniBand networks.SRP— This is the SCSI Request Protocol. It allows a machine to mount a remote drive or drive array that is exported through theSRPprotocol on the machine as though it were a local hard disk.SRPT— This is the target mode, or server mode, of theSRPprotocol. This loads the kernel support necessary for exporting a drive or drive array for other machines to mount as though it were local on their machine. Further configuration of the target mode support is required before any devices will actually be exported. See the documentation in the targetd and targetcli packages for further information.ISER— This is a low-level driver for the general iSCSI layer of the Linux kernel that provides transport over InfiniBand networks for iSCSI devices.RDS— This is the Reliable Datagram Service in the Linux kernel. It is not enabled in Red Hat Enterprise Linux 7 kernels and so cannot be loaded.
13.5.2. Usage of 70-persistent-ipoib.rules Copy linkLink copied to clipboard!
/etc/udev.d/rules.d/70-persistent-ipoib.rules. This udev rules file is used to rename IPoIB devices from their default names (such as ib0 and ib1) to more descriptive names. Users must edit this file to change how their devices are named. First, find out the GUID address for the device to be renamed:
ip link show ib0
~]$ ip link show ib0
8: ib0: >BROADCAST,MULTICAST,UP,LOWER_UP< mtu 65520 qdisc pfifo_fast state UP mode DEFAULT qlen 256
link/infiniband 80:00:02:00:fe:80:00:00:00:00:00:00:f4:52:14:03:00:7b:cb:a1 brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
link/infiniband is the 20 byte hardware address for the IPoIB interface. The final 8 bytes of the address, marked in bold above, is all that is required to make a new name. Users can make up whatever naming scheme suits them. For example, use a device_fabric naming convention such as mlx4_ib0 if a mlx4 device is connected to an ib0 subnet fabric. The only thing that is not recommended is to use the standard names, like ib0 or ib1, as these can conflict with the kernel assigned automatic names. Next, add an entry in the rules file. Copy the existing example in the rules file, replace the 8 bytes in the ATTR{address} entry with the highlighted 8 bytes from the device to be renamed, and enter the new name to be used in the NAME field.
13.5.3. Relaxing memlock restrictions for users Copy linkLink copied to clipboard!
root to run large RDMA applications, it will likely be necessary to increase the amount of memory that non-root users are allowed to pin in the system. This is done by adding a file in the /etc/security/limits.d/ directory with contents such as the following:
more /etc/security/limits.d/rdma.conf
~]$ more /etc/security/limits.d/rdma.conf
# configuration for rdma tuning
* soft memlock unlimited
* hard memlock unlimited
# rdma tuning end
13.5.4. Configuring Mellanox cards for Ethernet operation Copy linkLink copied to clipboard!
/etc/rdma/mlx4.conf file and follow the instructions in that file to set the port types properly for RoCE/IBoE usage. In this case is also necessary to rebuild the initramfs to make sure the updated port settings are copied into the initramfs.
mlx4_core 0000:05:00.0: Requested port type for port 1 is not supported on this HCA
mlx4_core 0000:05:00.0: Requested port type for port 1 is not supported on this HCA
13.5.5. Connecting to a Remote Linux SRP Target Copy linkLink copied to clipboard!
ib_qib, can have different format of GIDs. The ACL ID also depends on how you initiate the connection request.
Connecting to a Remote Linux SRP Target: High-Level Overview
- Prepare the target side:
- Create storage back end. For example get the /dev/sdc1 partition:
/> /backstores/block create vol1 /dev/sdc1
/> /backstores/block create vol1 /dev/sdc1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create an SRP target:
/> /srpt create 0xfe80000000000000001175000077dd7e
/> /srpt create 0xfe80000000000000001175000077dd7eCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a LUN based on the back end created in step a:
/> /srpt/ib.fe80000000000000001175000077dd7e/luns create /backstores/block/vol1
/> /srpt/ib.fe80000000000000001175000077dd7e/luns create /backstores/block/vol1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a Node ACL for the remote SRP client:Note that the Node ACL is different for
/> /srpt/ib.fe80000000000000001175000077dd7e/acls create 0x7edd770000751100001175000077d708
/> /srpt/ib.fe80000000000000001175000077dd7e/acls create 0x7edd770000751100001175000077d708Copy to Clipboard Copied! Toggle word wrap Toggle overflow srp_daemonandibsrpdm.
- Initiate an SRP connection with
srp_daemonoribsrpdmfor the client side:srp_daemon -e -n -i qib0 -p 1 -R 60 &
[root@initiator]# srp_daemon -e -n -i qib0 -p 1 -R 60 &Copy to Clipboard Copied! Toggle word wrap Toggle overflow ibsrpdm -c -d /dev/infiniband/umad0 > /sys/class/infiniband_srp/srp-qib0-1/add_target
[root@initiator]# ibsrpdm -c -d /dev/infiniband/umad0 > /sys/class/infiniband_srp/srp-qib0-1/add_targetCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Optional. It is recommended to verify the SRP connection with different tools, such as
lsscsiordmesg.
Procedure 13.3. Connecting to a Remote Linux SRP Target with srp_daemon or ibsrpdm
- Use the
ibstatcommand on the target to determine theStateandPort GUIDvalues. The HCA must be inActivestate. The ACL ID is based on thePort GUID:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Get the SRP target ID, which is based on the GUID of the HCA port. Note that you need a dedicated disk partition as a back end for a SRP target, for example
/dev/sdc1. The following command replaces the default prefix of fe80, removes the colon, and adds the new prefix to the remainder of the string:ibstatus | grep '<default-gid>' | sed -e 's/<default-gid>://' -e 's/://g' | grep 001175000077dd7e
[root@target]# ibstatus | grep '<default-gid>' | sed -e 's/<default-gid>://' -e 's/://g' | grep 001175000077dd7e fe80000000000000001175000077dd7eCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
targetclitool to create the LUN vol1 on the block device, create an SRP target, and export the LUN:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
ibstatcommand on the initiator to check if the state isActiveand determine thePort GUID:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the following command to scan without connecting to a remote SRP target. The target GUID shows that the initiator had found remote target. The ID string shows that the remote target is a Linux software target (
ib_srpt.ko).Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To verify the SRP connection, use the
lsscsicommand to list SCSI devices and compare thelsscsioutput before and after the initiator connects to target.lsscsi
[root@initiator]# lsscsi [0:0:10:0] disk IBM-ESXS ST9146803SS B53C /dev/sdaCopy to Clipboard Copied! Toggle word wrap Toggle overflow - To connect to a remote target without configuring a valid ACL for the initiator port, which is expected to fail, use the following commands for
srp_daemonoribsrpdm:srp_daemon -e -n -i qib0 -p 1 -R 60 &
[root@initiator]# srp_daemon -e -n -i qib0 -p 1 -R 60 & [1] 4184Copy to Clipboard Copied! Toggle word wrap Toggle overflow ibsrpdm -c -d /dev/infiniband/umad0 > /sys/class/infiniband_srp/srp-qib0-1/add_target
[root@initiator]# ibsrpdm -c -d /dev/infiniband/umad0 > /sys/class/infiniband_srp/srp-qib0-1/add_targetCopy to Clipboard Copied! Toggle word wrap Toggle overflow - The output of the
dmesgshows why the SRP connection operation failed. In a later step, thedmesgcommand on the target side is used to make the situation clear.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Because of failed LOGIN, the output of the
lsscsicommand is the same as in the earlier step.lsscsi
[root@initiator]# lsscsi [0:0:10:0] disk IBM-ESXS ST9146803SS B53C /dev/sdaCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Using the
dmesgon the target side (ib_srpt.ko) provides an explanation of why LOGIN failed. Also, the output contains the valid ACL ID provided bysrp_daemon:0x7edd770000751100001175000077d708.dmesg
[root@target]# dmesg [ 1200.303001] ib_srpt Received SRP_LOGIN_REQ with i_port_id 0x7edd770000751100:0x1175000077d708, t_port_id 0x1175000077dd7e:0x1175000077dd7e and it_iu_len 260 on port 1 (guid=0xfe80000000000000:0x1175000077dd7e) [ 1200.322207] ib_srpt Rejected login because no ACL has been configured yet for initiator 0x7edd770000751100001175000077d708.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
targetclitool to add a valid ACL:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify the SRP LOGIN operation:
- Wait for 60 seconds to allow
srp_daemonto re-try logging in:sleep 60
[root@initiator]# sleep 60Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify the SRP LOGIN operation:
lsscsi
[root@initiator]# lsscsi [0:0:10:0] disk IBM-ESXS ST9146803SS B53C /dev/sda [7:0:0:0] disk LIO-ORG vol1 4.0 /dev/sdbCopy to Clipboard Copied! Toggle word wrap Toggle overflow - For a kernel log of SRP target discovery, use:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.6. Configuring the Subnet Manager Copy linkLink copied to clipboard!
13.6.1. Determining Necessity Copy linkLink copied to clipboard!
13.6.2. Configuring the opensm main configuration file Copy linkLink copied to clipboard!
/etc/rdma/opensm.conf. Users may edit this file at any time and edits will be kept on upgrade. There is extensive documentation of the options in the file itself. However, for the two most common edits needed, setting the GUID to bind to and the PRIORITY to run with, it is highly recommended that the opensm.conf file is not edited but instead edit /etc/sysconfig/opensm. If there are no edits to the base /etc/rdma/opensm.conf file, it will get upgraded whenever the opensm package is upgraded. As new options are added to this file regularly, this makes it easier to keep the current configuration up to date. If the opensm.conf file has been changed, then on upgrade, it might be necessary to merge new options into the edited file.
13.6.3. Configuring the opensm startup options Copy linkLink copied to clipboard!
/etc/sysconfig/opensm file control how the subnet manager is actually started, as well as how many copies of the subnet manager are started. For example, a dual port InfiniBand card, with each port plugged into physically separate networks, will need a copy of the subnet manager running on each port. The opensm subnet manager will only manage one subnet per instance of the application and must be started once for each subnet that needs to be managed. In addition, if there is more than one opensm server, then set the priorities on each server to control which are to be ports and which are to be controller.
/etc/sysconfig/opensm is used to provide a simple means to set the priority of the subnet manager and to control which GUID the subnet manager binds to. There is an extensive explanation of the options in the /etc/sysconfig/opensm file itself. Users need only read and follow the directions in the file itself to enable failover and multifabric operation of opensm.
13.6.4. Creating a P_Key definition Copy linkLink copied to clipboard!
opensm.conf looks for the file /etc/rdma/partitions.conf to get a list of partitions to create on the fabric. All fabrics must contain the 0x7fff subnet, and all switches and all hosts must belong to that fabric. Any other partition can be created in addition to that, and all hosts and all switches do not have to be members of these additional partitions. This allows an administrator to create subnets akin to Ethernet’s VLANs on InfiniBand fabrics. If a partition is defined with a given speed, such as 40 Gbps, and there is a host on the network unable to do 40 Gbps, then that host will be unable to join the partition even if it has permission to do so as it will be unable to match the speed requirements, therefore it is recommended that the speed of a partition be set to the slowest speed of any host with permission to join the partition. If a faster partition for some subset of hosts is required, create a different partition with the higher speed.
0x7fff partition at a reduced speed of 10 Gbps, and a partition of 0x0002 with a speed of 40 Gbps:
13.6.5. Enabling opensm Copy linkLink copied to clipboard!
root:
systemctl enable opensm
~]# systemctl enable opensm
13.7. Testing Early InfiniBand RDMA operation Copy linkLink copied to clipboard!
Note
IP based devices, users should proceed to the section on testing RDMA operations once IPoIB has been configured and the devices have IP addresses.
rdma service is enabled, and the opensm service (if needed) is enabled, and the proper user-space library for the specific hardware has been installed, user space rdma operation should be possible. Simple test programs from the libibverbs-utils package are helpful in determining that RDMA operations are working properly. The ibv_devices program will show which devices are present in the system and the ibv_devinfo command will give detailed information about each device. For example:
ibv_devinfo and ibstat commands output slightly different information (such as port MTU exists in ibv_devinfo but not in ibstat output, and the Port GUID exists in ibstat output but not in ibv_devinfo output), and a few things are named differently (for example, the Base local identifier (LID) in ibstat output is the same as the port_lid output of ibv_devinfo)
IP addresses for specifying the server.
ibv_devinfo and ibstat commands to print out the port_lid (or Base lid) and the Port GUID of the port they want to test (assuming port 1 of the above interface, the port_lid/Base LID is 2 and Port GUID is 0xf4521403007bcba1)). Then start ibping with the necessary options to bind specifically to the card and port to be tested, and also specifying ibping should run in server mode. You can see the available options to ibping by passing -? or --help, but in this instance we will need either the -S or --Server option and for binding to the specific card and port we will need either -C or --Ca and -P or --Port. Note: port in this instance does not denote a network port number, but denotes the physical port number on the card when using a multi-port card. To test connectivity to the RDMA fabric using, for example, the second port of a multi-port card, requires telling ibping to bind to port 2 on the card. When using a single port card, or testing the first port on a card, this option is not needed. For example:
ibping -S -C mlx4_1 -P 1
~]$ ibping -S -C mlx4_1 -P 1
ibping -c 10000 -f -C mlx4_0 -P 1 -L 2
~]$ ibping -c 10000 -f -C mlx4_0 -P 1 -L 2
--- rdma-host.example.com.(none) (Lid 2) ibping statistics ---
10000 packets transmitted, 10000 received, 0% packet loss, time 816 ms
rtt min/avg/max = 0.032/0.081/0.446 ms
ibping -c 10000 -f -C mlx4_0 -P 1 -G 0xf4521403007bcba1 \ --- rdma-host.example.com.(none) (Lid 2) ibping statistics ---
~]$ ibping -c 10000 -f -C mlx4_0 -P 1 -G 0xf4521403007bcba1 \
--- rdma-host.example.com.(none) (Lid 2) ibping statistics ---
10000 packets transmitted, 10000 received, 0% packet loss, time 769 ms
rtt min/avg/max = 0.027/0.076/0.278 ms
ibv_devinfo
~]$ ibv_devinfo
libibverbs: Warning: no userspace device-specific driver found for /sys/class/infiniband_verbs/uverbs0
No IB devices found
x86_64, and libmlx4 is installed but is of type i686, then this error can result.
Note
13.8. Configuring IPoIB Copy linkLink copied to clipboard!
13.8.1. Understanding the role of IPoIB Copy linkLink copied to clipboard!
IP networks. InfiniBand is not. The role of IPoIB is to provide an IP network emulation layer on top of InfiniBand RDMA networks. This allows existing applications to run over InfiniBand networks unmodified. However, the performance of those applications is considerably lower than if the application were written to use RDMA communication natively. Since most InfiniBand networks have some set of applications that really must get all of the performance they can out of the network, and then some other applications for which a degraded rate of performance is acceptable if it means that the application does not need to be modified to use RDMA communications, IPoIB is there to allow those less critical applications to run on the network as they are.
IP networks with RDMA layered on top of their IP link layer, they have no need of IPoIB. As a result, the kernel will refuse to create any IPoIB devices on top of iWARP or RoCE/IBoE RDMA devices.
13.8.2. Understanding IPoIB communication modes Copy linkLink copied to clipboard!
IP packet being transmitted. As a result, the IPoIB MTU must be 4 bytes less than the InfiniBand link-layer MTU. As 2048 is a common InfiniBand link-layer MTU, the common IPoIB device MTU in datagram mode is 2044.
IP packet only has a 16 bit size field, and is therefore limited to 65535 as the maximum byte count. The maximum allowed MTU is actually smaller than that because we have to account for various TCP/IP headers that must also fit in that size. As a result, the IPoIB MTU in connected mode is capped at 65520 in order to make sure there is sufficient room for all needed TCP headers.
13.8.3. Understanding IPoIB hardware addresses Copy linkLink copied to clipboard!
0xfe:80:00:00:00:00:00:00. The device will use the default subnet prefix (0xfe80000000000000) until it makes contact with the subnet manager, at which point it will reset the subnet prefix to match what the subnet manager has configured it to be. The final 8 bytes are the GUID address of the InfiniBand port that the IPoIB device is attached to. Because both the first 4 bytes and the next 8 bytes can change from time to time, they are not used or matched against when specifying the hardware address for an IPoIB interface. Section Section 13.5.2, “Usage of 70-persistent-ipoib.rules” explains how to derive the address by leaving the first 12 bytes out of the ATTR{address} field in the udev rules file so that device matching will happen reliably. When configuring IPoIB interfaces, the HWADDR field of the configuration file can contain all 20 bytes, but only the last 8 bytes are actually used to match against and find the hardware specified by a configuration file. However, if the TYPE=InfiniBand entry is not spelled correctly in the device configuration file, and ifup-ib is not the actual script used to open the IPoIB interface, then an error about the system being unable to find the hardware specified by the configuration will be issued. For IPoIB interfaces, the TYPE= field of the configuration file must be either InfiniBand or infiniband (the entry is case sensitive, but the scripts will accept these two specific spellings).
13.8.4. Understanding InfiniBand P_Key subnets Copy linkLink copied to clipboard!
P_Key subnets. This is highly analogous to using VLANs on Ethernet interfaces. All switches and hosts must be a member of the default P_Key subnet, but administrators can create additional subnets and limit members of those subnets to subsets of the hosts or switches in the fabric. A P_Key subnet must be defined by the subnet manager before a host can use it. See section Section 13.6.4, “Creating a P_Key definition” for information on how to define a P_Key subnet using the opensm subnet manager. For IPoIB interfaces, once a P_Key subnet has been created, we can create additional IPoIB configuration files specifically for those P_Key subnets. Just like VLAN interfaces on Ethernet devices, each IPoIB interface will behave as though it were on a completely different fabric from other IPoIB interfaces that share the same link but have different P_Key values.
P_Key interfaces. All IPoIB P_Keys range from 0x0000 to 0x7fff, and the high bit, 0x8000, denotes that membership in a P_Key is full membership instead of partial membership. The Linux kernel’s IPoIB driver only supports full membership in P_Key subnets, so for any subnet that Linux can connect to, the high bit of the P_Key number will always be set. That means that if a Linux computer joins P_Key 0x0002, its actual P_Key number once joined will be 0x8002, denoting that we are full members of P_Key 0x0002. For this reason, when creating a P_Key definition in an opensm partitions.conf file as depicted in section Section 13.6.4, “Creating a P_Key definition”, it is required to specify a P_Key value without 0x8000, but when defining the P_Key IPoIB interfaces on the Linux clients, add the 0x8000 value to the base P_Key value.
13.8.5. Configure InfiniBand Using the Text User Interface, nmtui Copy linkLink copied to clipboard!
nmtui
~]$ nmtui
Figure 13.1. The NetworkManager Text User Interface Add an InfiniBand Connection menu
Figure 13.2. The NetworkManager Text User Interface Configuring a InfiniBand Connection menu
13.8.6. Configure IPoIB using the command-line tool, nmcli Copy linkLink copied to clipboard!
ib_ipoib kernel module and then reloading it as follows:
rmmod ib_ipoib modprobe ib_ipoib
~]$ rmmod ib_ipoib
~]$ modprobe ib_ipoib
Example 13.3. Creating and modifying IPoIB in two separate commands.
nmcli c add and nmcli c modify in one command, as follows:
Example 13.4. Creating and modifying IPoIB in one command.
nmcli con add type infiniband con-name mlx4_ib0 ifname mlx4_ib0 transport-mode connected mtu 65520 infiniband.mac-address 80:00:02:00:fe:80:00:00:00:00:00:00:f4:52:14:03:00:7b:cb:a3
nmcli con add type infiniband con-name mlx4_ib0 ifname mlx4_ib0 transport-mode connected mtu 65520 infiniband.mac-address 80:00:02:00:fe:80:00:00:00:00:00:00:f4:52:14:03:00:7b:cb:a3
mlx4_ib0 has been created and set to use connected mode, with the maximum connected mode MTU, DHCP for IPv4 and IPv6. If using IPoIB interfaces for cluster traffic and an Ethernet interface for out-of-cluster communications, it is likely that disabling default routes and any default name server on the IPoIB interfaces will be required. This can be done as follows:
P_Key interface is required, create one using nmcli as follows:
nmcli con add type infiniband con-name mlx4_ib0.8002 ifname mlx4_ib0.8002 parent mlx4_ib0 p-key 0x8002 nmcli con modify mlx4_ib0.8002 infiniband.mtu 65520 infiniband.transport-mode connected ipv4.ignore-auto-dns yes ipv4.ignore-auto-routes yes ipv4.never-default true ipv6.ignore-auto-dns yes ipv6.ignore-auto-routes yes ipv6.never-default true
~]$ nmcli con add type infiniband con-name mlx4_ib0.8002 ifname mlx4_ib0.8002 parent mlx4_ib0 p-key 0x8002
Connection 'mlx4_ib0.8002' (4a9f5509-7bd9-4e89-87e9-77751a1c54b4) successfully added.
~]$ nmcli con modify mlx4_ib0.8002 infiniband.mtu 65520 infiniband.transport-mode connected ipv4.ignore-auto-dns yes ipv4.ignore-auto-routes yes ipv4.never-default true ipv6.ignore-auto-dns yes ipv6.ignore-auto-routes yes ipv6.never-default true
13.8.7. Configure IPoIB Using the command line Copy linkLink copied to clipboard!
ib_ipoib kernel module and then reloading it as follows:
rmmod ib_ipoib modprobe ib_ipoib
~]$ rmmod ib_ipoib
~]$ modprobe ib_ipoib
ifcfg files with their preferred editor to control the devices. A typical IPoIB configuration file with static IPv4 addressing looks as follows:
yes or no, where yes will use connected mode and no will use datagram mode for communications (see section Section 13.8.2, “Understanding IPoIB communication modes”).
P_Key interfaces, this is a typical configuration file:
P_Key interface files, the PHYSDEV directive is required and must be the name of the parent device. The PKEY directive must be set to yes, and PKEY_ID must be the number of the interface (either with or without the 0x8000 membership bit added in). The device name, however, must be the four digit hexadecimal representation of the PKEY_ID combined with the 0x8000 membership bit using the logical OR operator as follows: NAME=${PHYSDEV}.$((0x8000 | $PKEY_ID))
NAME=${PHYSDEV}.$((0x8000 | $PKEY_ID))
PKEY_ID in the file is treated as a decimal number and converted to hexadecimal and then combined using the logical OR operator with 0x8000 to arrive at the proper name for the device, but users may specify the PKEY_ID in hexadecimal by prepending the standard 0x prefix to the number.
13.8.8. Testing an RDMA network after IPoIB is configured Copy linkLink copied to clipboard!
IP addresses to specify RDMA devices. Due to the ubiquitous nature of using IP addresses and host names to specify machines, most RDMA applications use this as their preferred, or in some cases only, way of specifying remote machines or local devices to connect to.
IP network test tool and provide the IP address of the IPoIB devices to be tested. For example, the ping command between the IP addresses of the IPoIB devices should now work.
IP address or host name of the IPoIB device, it is allowed for the test application to actually connect through a different RDMA interface. The reason for this is because the process of converting from the host name or IP address to an RDMA address allows any valid RDMA address pair between the two machines to be used. If there are multiple ways for the client to connect to the server, then the programs might choose to use a different path if there is a problem with the path specified. For example, if there are two ports on each machine connected to the same InfiniBand subnet, and an IP address for the second port on each machine is given, it is likely that the program will find the first port on each machine is a valid connection method and use them instead. In this case, command-line options to any of the perftest programs can be used to tell them which card and port to bind to, as was done with ibping in Section 13.7, “Testing Early InfiniBand RDMA operation”, in order to ensure that testing occurs over the specific ports required to be tested. For qperf, the method of binding to ports is slightly different. The qperf program operates as a server on one machine, listening on all devices (including non-RDMA devices). The client may connect to qperf using any valid IP address or host name for the server. Qperf will first attempt to open a data connection and run the requested test(s) over the IP address or host name given on the client command line, but if there is any problem using that address, qperf will fall back to attempting to run the test on any valid path between the client and server. For this reason, to force qperf to test over a specific link, use the -loc_id and -rem_id options to the qperf client in order to force the test to run on a specific link.
13.8.9. Configure IPoIB Using a GUI Copy linkLink copied to clipboard!
Procedure 13.4. Adding a New InfiniBand Connection Using nm-connection-editor
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Click the Add button. The Choose a Connection Type window appears. Select InfiniBand and click Create. The Editing InfiniBand connection 1 window appears.
- On the InfiniBand tab, select the transport mode from the drop-down list you want to use for the InfiniBand connection.
- Enter the InfiniBand MAC address.
- Review and confirm the settings and then click the Save button.
- Edit the InfiniBand-specific settings by referring to Section 13.8.9.1, “Configuring the InfiniBand Tab”.
Procedure 13.5. Editing an Existing InfiniBand Connection
- Enter nm-connection-editor in a terminal:
nm-connection-editor
~]$ nm-connection-editorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Select the connection you want to edit and click the Edit button.
- Select the General tab.
- Configure the connection name, auto-connect behavior, and availability settings.Five settings in the Editing dialog are common to all connection types, see the General tab:
- Connection name — Enter a descriptive name for your network connection. This name will be used to list this connection in the menu of the Network window.
- Automatically connect to this network when it is available — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See the section called “Editing an Existing Connection with control-center” for more information.
- All users may connect to this network — Select this box to create a connection available to all users on the system. Changing this setting may require root privileges. See Section 3.4.5, “Managing System-wide and Private Connection Profiles with a GUI” for details.
- Automatically connect to VPN when using this connection — Select this box if you want NetworkManager to auto-connect to a VPN connection when it is available. Select the VPN from the drop-down menu.
- Firewall Zone — Select the Firewall Zone from the drop-down menu. See the Red Hat Enterprise Linux 7 Security Guide for more information on Firewall Zones.
- Edit the InfiniBand-specific settings by referring to the Section 13.8.9.1, “Configuring the InfiniBand Tab”.
Saving Your New (or Modified) Connection and Making Further Configurations
IPv4settings for the connection, click the IPv4 Settings tab and proceed to Section 5.4, “Configuring IPv4 Settings”orIPv6settings for the connection, click the IPv6 Settings tab and proceed to Section 5.5, “Configuring IPv6 Settings”.
13.8.9.1. Configuring the InfiniBand Tab Copy linkLink copied to clipboard!
- Transport mode
- Datagram or Connected mode can be selected from the drop-down list. Select the same mode the rest of your IPoIB network is using.
- Device MAC address
- The MAC address of the InfiniBand capable device to be used for the InfiniBand network traffic.This hardware address field will be pre-filled if you have InfiniBand hardware installed.
- MTU
- Optionally sets a Maximum Transmission Unit (MTU) size to be used for packets to be sent over the InfiniBand connection.
13.8.10. Additional Resources Copy linkLink copied to clipboard!
Installed Documentation
/usr/share/doc/initscripts-version/sysconfig.txt— Describes configuration files and their directives.
Online Documentation
- https://www.kernel.org/doc/Documentation/infiniband/ipoib.txt
- A description of the IPoIB driver. Includes references to relevant RFCs.
Part IV. Servers Copy linkLink copied to clipboard!
Note
Chapter 14. DHCP Servers Copy linkLink copied to clipboard!
DHCP client connects to the centrally located DHCP server, which returns the network configuration (including the IP address, gateway, and DNS servers) of that client.
14.1. Why Use DHCP? Copy linkLink copied to clipboard!
DHCP is useful for automatic configuration of client network interfaces. When configuring the client system, you can choose DHCP instead of specifying an IP address, netmask, gateway, or DNS servers. The client retrieves this information from the DHCP server. DHCP is also useful if you want to change the IP addresses of a large number of systems. Instead of reconfiguring all the systems, you can just edit one configuration file on the server for the new set of IP addresses. If the DNS servers for an organization changes, the changes happen on the DHCP server, not on the DHCP clients. When you restart the network or reboot the clients, the changes go into effect.
DHCP server correctly connected to a network, laptops and other mobile computer users can move these devices from office to office.
DNS and DHCP servers, as well as any provisioning applications, should agree on the host name format used in an organization. See Section 6.1.1, “Recommended Naming Practices” for more information on the format of host names.
14.2. Configuring a DHCP Server Copy linkLink copied to clipboard!
DHCP server. Install the package as root:
yum install dhcp
~]# yum install dhcp
/etc/dhcp/dhcpd.conf, which is merely an empty configuration file. As root, issue the following command:
/usr/share/doc/dhcp-version;/dhcpd.conf.example. You should use this file to help you configure /etc/dhcp/dhcpd.conf, which is explained in detail below.
DHCP also uses the file /var/lib/dhcpd/dhcpd.leases to store the client lease database. See Section 14.2.2, “Lease Database” for more information.
14.2.1. Configuration File Copy linkLink copied to clipboard!
DHCP server is to create the configuration file that stores the network information for the clients. Use this file to declare options for client systems.
#) are considered comments.
- Parameters — State how to perform a task, whether to perform a task, or what network configuration options to send to the client.
- Declarations — Describe the topology of the network, describe the clients, provide addresses for the clients, or apply a group of parameters to a group of declarations.
DHCP options; whereas, parameters configure values that are not optional or control how the DHCP server behaves.
{ }) are considered global parameters. Global parameters apply to all the sections below it.
Important
DHCP daemon is restarted with the command systemctl restart dhcpd.
Note
DHCP configuration file and restarting the service each time, using the omshell command provides an interactive way to connect to, query, and change the configuration of a DHCP server. By using omshell, all changes can be made while the server is running. For more information on omshell, see the omshell man page.
routers, subnet-mask, domain-search, domain-name-servers, and time-offset options are used for any host statements declared below it.
DHCP server is connected, there must be one subnet declaration, which tells the DHCP daemon how to recognize that an address is on that subnet. A subnet declaration is required for each subnet even if no addresses will be dynamically allocated to that subnet.
DHCP client in the subnet and a range declared. Clients are assigned an IP address within the range.
Example 14.1. Subnet Declaration
DHCP server that leases a dynamic IP address to a system within a subnet, modify the example values from Example 14.2, “Range Parameter”. It declares a default lease time, maximum lease time, and network configuration values for the clients. This example assigns IP addresses in the range 192.168.1.10 and 192.168.1.100 to client systems.
Example 14.2. Range Parameter
IP address to a client based on the MAC address of the network interface card, use the hardware ethernet parameter within a host declaration. As demonstrated in Example 14.3, “Static IP Address Using DHCP”, the host apex declaration specifies that the network interface card with the MAC address 00:A0:78:8E:9E:AA always receives the IP address 192.168.1.4.
host-name to assign a host name to the client.
Example 14.3. Static IP Address Using DHCP
host apex {
option host-name "apex.example.com";
hardware ethernet 00:A0:78:8E:9E:AA;
fixed-address 192.168.1.4;
}
host apex {
option host-name "apex.example.com";
hardware ethernet 00:A0:78:8E:9E:AA;
fixed-address 192.168.1.4;
}
IP addresses to InfiniBand IPoIB interfaces. However, as these interfaces do not have a normal hardware Ethernet address, a different method of specifying a unique identifier for the IPoIB interface must be used. The standard is to use the option dhcp-client-identifier= construct to specify the IPoIB interface’s dhcp-client-identifier field. The DHCP server host construct supports at most one hardware Ethernet and one dhcp-client-identifier entry per host stanza. However, there may be more than one fixed-address entry and the DHCP server will automatically respond with an address that is appropriate for the network that the DHCP request was received on.
Example 14.4. Static IP Address Using DHCP on Multiple Interfaces
P_Key interfaces on each physical interface, plus an Ethernet connection, the following static IP construct could be used to serve this configuration:
dhcp-client-identifier for your device, you can usually use the prefix ff:00:00:00:00:00:02:00:00:02:c9:00 and then add the last 8 bytes of the IPoIB interface (which happens to also be the 8 byte GUID of the InfiniBand port the IPoIB interface is on). On some older controllers, this prefix is not correct. In that case, we recommend using tcpdump on the DHCP server to capture the incoming IPoIB DHCP request and gather the right dhcp-client-identifier from that capture. For example:
255 corresponds to the initial ff: of the ID, the rest of the ID is then quoted exactly as it needs to appear in the DHCP configuration file.
shared-network declaration as shown in Example 14.5, “Shared-network Declaration”. Parameters within the shared-network, but outside the enclosed subnet declarations, are considered to be global parameters. The name assigned to shared-network must be a descriptive title for the network, such as using the title “test-lab” to describe all the subnets in a test lab environment.
group declaration is used to apply global parameters to a group of declarations. For example, shared networks, subnets, and hosts can be grouped.
Example 14.6. Group Declaration
Note
root:
cp /usr/share/doc/dhcp-version_number/dhcpd.conf.example /etc/dhcp/dhcpd.conf
~]# cp /usr/share/doc/dhcp-version_number/dhcpd.conf.example /etc/dhcp/dhcpd.conf
DHCP version number.
dhcp-options(5) man page.
14.2.2. Lease Database Copy linkLink copied to clipboard!
DHCP server, the file /var/lib/dhcpd/dhcpd.leases stores the DHCP client lease database. Do not change this file. DHCP lease information for each recently assigned IP address is automatically stored in the lease database. The information includes the length of the lease, to whom the IP address has been assigned, the start and end dates for the lease, and the MAC address of the network interface card that was used to retrieve the lease.
dhcpd.leases file is renamed dhcpd.leases~ and the temporary lease database is written to dhcpd.leases.
DHCP daemon could be killed or the system could crash after the lease database has been renamed to the backup file but before the new file has been written. If this happens, the dhcpd.leases file does not exist, but it is required to start the service. Do not create a new lease file. If you do, all old leases are lost which causes many problems. The correct solution is to rename the dhcpd.leases~ backup file to dhcpd.leases and then start the daemon.
14.2.3. Starting and Stopping the Server Copy linkLink copied to clipboard!
Important
DHCP server is started for the first time, it fails unless the dhcpd.leases file exists. You can use the command touch /var/lib/dhcpd/dhcpd.leases to create the file if it does not exist. If the same server is also running BIND as a DNS server, this step is not necessary, as starting the named service automatically checks for a dhcpd.leases file.
dhcpd.leases~ backup file to dhcpd.leases and then start the daemon.
DHCP service, use the following command:
systemctl start dhcpd.service
systemctl start dhcpd.service
DHCP server, type:
systemctl stop dhcpd.service
systemctl stop dhcpd.service
DHCP service does not start at boot time. For information on how to configure the daemon to start automatically at boot time, see Red Hat Enterprise Linux System Administrator's Guide.
DHCP server should only listen for DHCP requests on one of the interfaces, configure the DHCP server to listen only on that device. The DHCP daemon will only listen on interfaces for which it finds a subnet declaration in the /etc/dhcp/dhcpd.conf file.
DHCP client to retrieve an IP address to the Internet. The other network card can be used as a DHCP server for the internal network behind the firewall. Specifying only the network card connected to the internal network makes the system more secure because users cannot connect to the daemon through the Internet.
dhcpd.service file as the root user. For example, as follows:
cp /usr/lib/systemd/system/dhcpd.service /etc/systemd/system/ vi /etc/systemd/system/dhcpd.service
~]# cp /usr/lib/systemd/system/dhcpd.service /etc/systemd/system/
~]# vi /etc/systemd/system/dhcpd.service
ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid your_interface_name(s)
ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid your_interface_name(s)
root user, restart the service:
systemctl --system daemon-reload systemctl restart dhcpd
~]# systemctl --system daemon-reload
~]# systemctl restart dhcpd
ExecStart=/usr/sbin/dhcpd in the /etc/systemd/system/dhcpd.service unit file under section [Service]. They include:
-p portnum— Specifies the UDP port number on whichdhcpdshould listen. The default is port 67. TheDHCPserver transmits responses to theDHCPclients at a port number one greater than the UDP port specified. For example, if the default port 67 is used, the server listens on port 67 for requests and responds to the client on port 68. If a port is specified here and theDHCPrelay agent is used, the same port on which theDHCPrelay agent should listen must be specified. See Section 14.3, “DHCP Relay Agent” for details.-f— Runs the daemon as a foreground process. This is mostly used for debugging.-d— Logs theDHCPserver daemon to the standard error descriptor. This is mostly used for debugging. If this is not specified, the log is written to/var/log/messages.-cf filename— Specifies the location of the configuration file. The default location is/etc/dhcp/dhcpd.conf.-lf filename— Specifies the location of the lease database file. If a lease database file already exists, it is very important that the same file be used every time theDHCPserver is started. It is strongly recommended that this option only be used for debugging purposes on non-production machines. The default location is/var/lib/dhcpd/dhcpd.leases.-q— Do not print the entire copyright message when starting the daemon.
14.3. DHCP Relay Agent Copy linkLink copied to clipboard!
DHCP and BOOTP requests from a subnet with no DHCP server on it to one or more DHCP servers on other subnets.
DHCP client requests information, the DHCP Relay Agent forwards the request to the list of DHCP servers specified when the DHCP Relay Agent is started. When a DHCP server returns a reply, the reply is broadcast or unicast on the network that sent the original request.
IPv4, dhcrelay, listens for DHCPv4 and BOOTP requests on all interfaces unless the interfaces are specified in /etc/sysconfig/dhcrelay with the INTERFACES directive. See Section 14.3.1, “Configure dhcrelay as a DHCPv4 and BOOTP relay agent”. The DHCP Relay Agent for IPv6, dhcrelay6, does not have this default behavior and interfaces to listen for DHCPv6 requests must be specified. See Section 14.3.2, “Configure dhcrelay as a DHCPv6 relay agent”.
DHCPv4 and BOOTP relay agent (by default) or as a DHCPv6 relay agent (with -6 argument). To see the usage message, issue the command dhcrelay -h.
14.3.1. Configure dhcrelay as a DHCPv4 and BOOTP relay agent Copy linkLink copied to clipboard!
DHCPv4 and BOOTP mode specify the servers to which the requests should be forwarded to. Copy and then edit the dhcrelay.service file as the root user:
cp /lib/systemd/system/dhcrelay.service /etc/systemd/system/ vi /etc/systemd/system/dhcrelay.service
~]# cp /lib/systemd/system/dhcrelay.service /etc/systemd/system/
~]# vi /etc/systemd/system/dhcrelay.service
ExecStart option under section [Service] and add one or more server IPv4 addresses to the end of the line, for example: ExecStart=/usr/sbin/dhcrelay -d --no-pid 192.168.1.1
ExecStart=/usr/sbin/dhcrelay -d --no-pid 192.168.1.1
DHCP requests, add them to the ExecStart option with -i argument (otherwise it will listen on all interfaces), for example: ExecStart=/usr/sbin/dhcrelay -d --no-pid 192.168.1.1 -i em1
ExecStart=/usr/sbin/dhcrelay -d --no-pid 192.168.1.1 -i em1
dhcrelay(8) man page.
root user, restart the service:
systemctl --system daemon-reload systemctl restart dhcrelay
~]# systemctl --system daemon-reload
~]# systemctl restart dhcrelay
14.3.2. Configure dhcrelay as a DHCPv6 relay agent Copy linkLink copied to clipboard!
DHCPv6 mode add the -6 argument and specify the “lower interface” (on which queries will be received from clients or from other relay agents) and the “upper interface” (to which queries from clients and other relay agents should be forwarded). Copy dhcrelay.service to dhcrelay6.service and edit it as the root user:
cp /lib/systemd/system/dhcrelay.service /etc/systemd/system/dhcrelay6.service vi /etc/systemd/system/dhcrelay6.service
~]# cp /lib/systemd/system/dhcrelay.service /etc/systemd/system/dhcrelay6.service
~]# vi /etc/systemd/system/dhcrelay6.service
ExecStart option under section [Service] add -6 argument and add the “lower interface” and “upper interface” interface, for example: ExecStart=/usr/sbin/dhcrelay -d --no-pid -6 -l em1 -u em2
ExecStart=/usr/sbin/dhcrelay -d --no-pid -6 -l em1 -u em2
dhcrelay(8) man page.
root user, restart the service:
systemctl --system daemon-reload systemctl restart dhcrelay6
~]# systemctl --system daemon-reload
~]# systemctl restart dhcrelay6
14.4. Configuring a Multihomed DHCP Server Copy linkLink copied to clipboard!
DHCP server serves multiple networks, that is, multiple subnets. The examples in these sections detail how to configure a DHCP server to serve multiple networks, select which network interfaces to listen on, and how to define network settings for systems that move networks.
/etc/dhcp/dhcpd.conf file.
DHCP daemon will only listen on interfaces for which it finds a subnet declaration in the /etc/dhcp/dhcpd.conf file.
/etc/dhcp/dhcpd.conf file, for a server that has two network interfaces, enp1s0 in a 10.0.0.0/24 network, and enp2s0 in a 172.16.0.0/24 network. Multiple subnet declarations allow you to define different settings for multiple networks:
-
subnet 10.0.0.0 netmask 255.255.255.0; - A
subnetdeclaration is required for every network yourDHCPserver is serving. Multiple subnets require multiplesubnetdeclarations. If theDHCPserver does not have a network interface in a range of asubnetdeclaration, theDHCPserver does not serve that network.If there is only onesubnetdeclaration, and no network interfaces are in the range of that subnet, theDHCPdaemon fails to start, and an error such as the following is logged to/var/log/messages:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
option subnet-mask 255.255.255.0; - The
option subnet-maskoption defines a subnet mask, and overrides thenetmaskvalue in thesubnetdeclaration. In simple cases, the subnet and netmask values are the same. -
option routers 10.0.0.1; - The
option routersoption defines the default gateway for the subnet. This is required for systems to reach internal networks on a different subnet, as well as external networks. -
range 10.0.0.5 10.0.0.15; - The
rangeoption specifies the pool of availableIPaddresses. Systems are assigned an address from the range of specifiedIPaddresses.
dhcpd.conf(5) man page.
Warning
14.4.1. Host Configuration Copy linkLink copied to clipboard!
/etc/sysconfig/dhcpd and /etc/dhcp/dhcpd.conf files.
The following /etc/dhcp/dhcpd.conf example creates two subnets, and configures an IP address for the same system, depending on which network it connects to:
-
host example0 - The
hostdeclaration defines specific parameters for a single system, such as anIPaddress. To configure specific parameters for multiple hosts, use multiplehostdeclarations.MostDHCPclients ignore the name inhostdeclarations, and as such, this name can be anything, as long as it is unique to otherhostdeclarations. To configure the same system for multiple networks, use a different name for eachhostdeclaration, otherwise theDHCPdaemon fails to start. Systems are identified by thehardware ethernetoption, not the name in thehostdeclaration. -
hardware ethernet 00:1A:6B:6A:2E:0B; - The
hardware ethernetoption identifies the system. To find this address, run theip linkcommand. -
fixed-address 10.0.0.20; - The
fixed-addressoption assigns a validIPaddress to the system specified by thehardware ethernetoption. This address must be outside theIPaddress pool specified with therangeoption.
option statements do not end with a semicolon, the DHCP daemon fails to start, and an error such as the following is logged to /var/log/messages:
The following host declarations configure a single system, which has multiple network interfaces, so that each interface receives the same IP address. This configuration will not work if both network interfaces are connected to the same network at the same time:
interface0 is the first network interface, and interface1 is the second interface. The different hardware ethernet options identify each interface.
host declarations, remembering to:
- assign a valid
fixed-addressfor the network the host is connecting to. - make the name in the
hostdeclaration unique.
host declaration is not unique, the DHCP daemon fails to start, and an error such as the following is logged to /var/log/messages:
dhcpd: /etc/dhcp/dhcpd.conf line 31: host interface0: already exists dhcpd: } dhcpd: ^ dhcpd: Configuration file errors encountered -- exiting
dhcpd: /etc/dhcp/dhcpd.conf line 31: host interface0: already exists
dhcpd: }
dhcpd: ^
dhcpd: Configuration file errors encountered -- exiting
host interface0 declarations defined in /etc/dhcp/dhcpd.conf.
14.5. DHCP for IPv6 (DHCPv6) Copy linkLink copied to clipboard!
DHCP includes support for IPv6 (DHCPv6) since the 4.x release with a DHCPv6 server, client, and relay agent functionality. The agents support both IPv4 and IPv6, however the agents can only manage one protocol at a time; for dual support they must be started separately for IPv4 and IPv6. For example, configure both DHCPv4 and DHCPv6 by editing their respective configuration files /etc/dhcp/dhcpd.conf and /etc/dhcp/dhcpd6.conf and then issue the following commands:
systemctl start dhcpd systemctl start dhcpd6
~]# systemctl start dhcpd
~]# systemctl start dhcpd6
DHCPv6 server configuration file can be found at /etc/dhcp/dhcpd6.conf.
/usr/share/doc/dhcp-version/dhcpd6.conf.example.
DHCPv6 server configuration file can look like this:
subnet6 2001:db8:0:1::/64 {
range6 2001:db8:0:1::129 2001:db8:0:1::254;
option dhcp6.name-servers fec0:0:0:1::1;
option dhcp6.domain-search "domain.example";
}
subnet6 2001:db8:0:1::/64 {
range6 2001:db8:0:1::129 2001:db8:0:1::254;
option dhcp6.name-servers fec0:0:0:1::1;
option dhcp6.domain-search "domain.example";
}
fixed-address to a client, based on the MAC address of the network interface card, use the hardware ethernet parameter:
host otherclient {
hardware ethernet 01:00:80:a2:55:67;
fixed-address6 3ffe:501:ffff:100::4321;
}
host otherclient {
hardware ethernet 01:00:80:a2:55:67;
fixed-address6 3ffe:501:ffff:100::4321;
}
shared-network, and group declaration for IPv6 are the same as IPV4. For more details, see the examples as demonstrated in Example 14.5, “Shared-network Declaration”, and Example 14.6, “Group Declaration”.
14.6. Configuring the radvd daemon for IPv6 routers Copy linkLink copied to clipboard!
radvd) sends router advertisement messages which are required for IPv6 stateless autoconfiguration. This allows users to automatically configure their addresses, settings, routes and choose a default router based on these advertisements. To configure the radvd daemon:
- Install the
radvddaemon:sudo yum install radvd
~]# sudo yum install radvdCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set up the
/etc/radvd.conffile. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
If you want to additionally advertise DNS resolvers along with the router advertisements, add theRDNSS <ip> <ip> <ip> { };option in the/etc/radvd.conffile. To configure a DHCPv6 service for your subnets, you can set theAdvManagedFlagto on, so the router advertisements allow clients to automatically obtain an IPv6 address when a DHCPv6 service is available. For more details on configuring the DHCPv6 service, see Section 14.5, “DHCP for IPv6 (DHCPv6)” - Enable the
radvddaemon:sudo systemctl enable radvd.service
~]# sudo systemctl enable radvd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the
radvddaemon immediately:sudo systemctl start radvd.service
~]# sudo systemctl start radvd.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
radvd daemon, use the radvdump command:
radvd daemon, see the radvd(8), radvd.conf(5), radvdump(8) man pages.
14.7. Comparison of DHCPv6 to radvd Copy linkLink copied to clipboard!
- Manually
- Using the
radvddaemon - Using the
DHCPv6server
Manually
Using the radvd Daemon
Using the DHCPv6 Server
| DHCPv6 | radvd |
|---|---|
| Guarantee random addresses to protect privacy. | Provide information on a default gateway. |
| Send further network configuration options to clients. For example, Network Time Protocol (NTP) servers, Session Initiation Protocol (SIP) servers, Preboot Execution Environment (iPXE) configuration. | |
| Map MAC addresses to IPv6 addresses. |
Note
14.8. Additional Resources Copy linkLink copied to clipboard!
dhcpd(8)man page — Describes how theDHCPdaemon works.dhcpd.conf(5)man page — Explains how to configure theDHCPconfiguration file; includes some examples.dhcpd.leases(5)man page — Describes a persistent database of leases.dhcp-options(5)man page — Explains the syntax for declaringDHCPoptions indhcpd.conf; includes some examples.dhcrelay(8)man page — Explains theDHCPRelay Agent and its configuration options./usr/share/doc/dhcp-version/— Contains example files, README files, and release notes for current versions of theDHCPservice.
Chapter 15. DNS Servers Copy linkLink copied to clipboard!
DNS (Domain Name System), is a distributed database system that is used to associate host names with their respective IP addresses. For users, this has the advantage that they can refer to machines on the network by names that are usually easier to remember than the numerical network addresses. For system administrators, using a DNS server, also known as a name server, enables changing the IP address for a host without ever affecting the name-based queries. The use of the DNS databases is not only for resolving IP addresses to domain names and their use is becoming broader and broader as DNSSEC is deployed.
15.1. Introduction to DNS Copy linkLink copied to clipboard!
DNS is usually implemented using one or more centralized servers that are authoritative for certain domains. When a client host requests information from a name server, it usually connects to port 53. The name server then attempts to resolve the name requested. If the name server is configured to be a recursive name servers and it does not have an authoritative answer, or does not already have the answer cached from an earlier query, it queries other name servers, called root name servers, to determine which name servers are authoritative for the name in question, and then queries them to get the requested name. Name servers configured as purely authoritative, with recursion disabled, will not do lookups on behalf of clients.
15.1.1. Name server Zones Copy linkLink copied to clipboard!
DNS server, all information is stored in basic data elements called resource records (RR). Resource records are defined in RFC 1034. The domain names are organized into a tree structure. Each level of the hierarchy is divided by a period (.). For example: The root domain, denoted by ., is the root of the DNS tree, which is at level zero. The domain name com, referred to as the top-level domain (TLD) is a child of the root domain (.) so it is the first level of the hierarchy. The domain name example.com is at the second level of the hierarchy.
Example 15.1. A Simple Resource Record
example.com. 86400 IN A 192.0.2.1
example.com. 86400 IN A 192.0.2.1
example.com, is the owner for the RR. The value 86400 is the time to live (TTL). The letters IN, meaning “the Internet system”, indicate the class of the RR. The letter A indicates the type of RR (in this example, a host address). The host address 192.0.2.1 is the data contained in the final section of this RR. This one line example is a RR. A set of RRs with the same type, owner, and class is called a resource record set (RRSet).
DNS and DHCP servers, as well as any provisioning applications, should agree on the host name format used in an organization. See Section 6.1.1, “Recommended Naming Practices” for more information on the format of host names.
15.1.2. Name server Types Copy linkLink copied to clipboard!
- authoritative
- Authoritative name servers answer to resource records that are part of their zones only. This category includes both primary (master) and secondary (slave) name servers.
- recursive
- Recursive name servers offer resolution services, but they are not authoritative for any zone. Answers for all resolutions are cached in a memory for a fixed period of time, which is specified by the retrieved resource record.
15.1.3. BIND as a Name server Copy linkLink copied to clipboard!
named, an administration utility called rndc, and a debugging tool called dig. See Red Hat Enterprise Linux System Administrator's Guide for more information on how to run a service in Red Hat Enterprise Linux.
15.2. BIND Copy linkLink copied to clipboard!
BIND (Berkeley Internet Name Domain), the DNS server included in Red Hat Enterprise Linux. It focuses on the structure of its configuration files, and describes how to administer it both locally and remotely.
15.2.1. Empty Zones Copy linkLink copied to clipboard!
BIND configures a number of “empty zones” to prevent recursive servers from sending unnecessary queries to Internet servers that cannot handle them (thus creating delays and SERVFAIL responses to clients who query for them). These empty zones ensure that immediate and authoritative NXDOMAIN responses are returned instead. The configuration option empty-zones-enable controls whether or not empty zones are created, whilst the option disable-empty-zone can be used in addition to disable one or more empty zones from the list of default prefixes that would be used.
15.2.2. Configuring the named Service Copy linkLink copied to clipboard!
named service is started, it reads the configuration from the files as described in Table 15.1, “The named Service Configuration Files”.
| Path | Description |
|---|---|
/etc/named.conf | The main configuration file. |
/etc/named/ | An auxiliary directory for configuration files that are included in the main configuration file. |
{ and }). Note that when editing the file, you have to be careful not to make any syntax error, otherwise the named service will not start. A typical /etc/named.conf file is organized as follows:
Note
chroot environment. In that case, the initialization script will mount the above configuration files using the mount --bind command, so that you can manage the configuration outside this environment. There is no need to copy anything into the /var/named/chroot/ directory because it is mounted automatically. This simplifies maintenance since you do not need to take any special care of BIND configuration files if it is run in a chroot environment. You can organize everything as you would with BIND not running in a chroot environment.
/var/named/chroot/ directory if the corresponding mount point directories underneath /var/named/chroot/ are empty:
/etc/named/etc/pki/dnssec-keys/run/named/var/named/usr/lib64/bindor/usr/lib/bind(architecture dependent).
/var/named/chroot/:
/etc/named.conf/etc/rndc.conf/etc/rndc.key/etc/named.rfc1912.zones/etc/named.dnssec.keys/etc/named.iscdlv.key/etc/named.root.key
Important
chroot environment requires creating a backup copy and then editing the original file. Alternatively, use an editor with “edit-a-copy” mode disabled. For example, to edit the BIND's configuration file, /etc/named.conf, with Vim while it is running in a chroot environment, issue the following command as root:
vim -c "set backupcopy=yes" /etc/named.conf
~]# vim -c "set backupcopy=yes" /etc/named.conf
15.2.2.1. Installing BIND in a chroot Environment Copy linkLink copied to clipboard!
chroot environment, issue the following command as root:
yum install bind-chroot
~]# yum install bind-chroot
named-chroot service, first check if the named service is running by issuing the following command:
systemctl status named
~]$ systemctl status named
named, issue the following commands as root:
systemctl stop named
~]# systemctl stop named
systemctl disable named
~]# systemctl disable named
named-chroot service, issue the following commands as root:
systemctl enable named-chroot
~]# systemctl enable named-chroot
systemctl start named-chroot
~]# systemctl start named-chroot
named-chroot service, issue the following command as root:
systemctl status named-chroot
~]# systemctl status named-chroot
15.2.2.2. Common Statement Types Copy linkLink copied to clipboard!
/etc/named.conf:
-
acl - The
acl(Access Control List) statement allows you to define groups of hosts, so that they can be permitted or denied access to the nameserver. It takes the following form:acl acl-name { match-element; ... };acl acl-name { match-element; ... };Copy to Clipboard Copied! Toggle word wrap Toggle overflow The acl-name statement name is the name of the access control list, and the match-element option is usually an individualIPaddress (such as10.0.1.1) or a Classless Inter-Domain Routing (CIDR) network notation (for example,10.0.1.0/24). For a list of already defined keywords, see Table 15.2, “Predefined Access Control Lists”.Expand Table 15.2. Predefined Access Control Lists Keyword Description anyMatches every IPaddress.localhostMatches any IPaddress that is in use by the local system.localnetsMatches any IPaddress on any network to which the local system is connected.noneDoes not match any IPaddress.Theaclstatement can be especially useful in conjunction with other statements such asoptions. Example 15.2, “Using acl in Conjunction with Options” defines two access control lists,black-hatsandred-hats, and addsblack-hatson the blacklist while grantingred-hatsnormal access.Example 15.2. Using acl in Conjunction with Options
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
include - The
includestatement allows you to include files in the/etc/named.conf, so that potentially sensitive data can be placed in a separate file with restricted permissions. It takes the following form:include "file-name"
include "file-name"Copy to Clipboard Copied! Toggle word wrap Toggle overflow The file-name statement name is an absolute path to a file.Example 15.3. Including a File to /etc/named.conf
include "/etc/named.rfc1912.zones";
include "/etc/named.rfc1912.zones";Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
options - The
optionsstatement allows you to define global server configuration options as well as to set defaults for other statements. It can be used to specify the location of thenamedworking directory, the types of queries allowed, and much more. It takes the following form:options { option; ... };options { option; ... };Copy to Clipboard Copied! Toggle word wrap Toggle overflow For a list of frequently used option directives, see Table 15.3, “Commonly Used Configuration Options” below.Expand Table 15.3. Commonly Used Configuration Options Option Description allow-querySpecifies which hosts are allowed to query the nameserver for authoritative resource records. It accepts an access control list, a collection of IPaddresses, or networks in the CIDR notation. All hosts are allowed by default.allow-query-cacheSpecifies which hosts are allowed to query the nameserver for non-authoritative data such as recursive queries. Only localhostandlocalnetsare allowed by default.blackholeSpecifies which hosts are not allowed to query the nameserver. This option should be used when a particular host or network floods the server with requests. The default option is none.directorySpecifies a working directory for the namedservice. The default option is/var/named/.disable-empty-zoneUsed to disable one or more empty zones from the list of default prefixes that would be used. Can be specified in the options statement and also in view statements. It can be used multiple times. dnssec-enableSpecifies whether to return DNSSEC related resource records. The default option is yes.dnssec-validationSpecifies whether to prove that resource records are authentic through DNSSEC. The default option is yes.empty-zones-enableControls whether or not empty zones are created. Can be specified only in the options statement. forwardersSpecifies a list of valid IPaddresses for nameservers to which the requests should be forwarded for resolution.forwardSpecifies the behavior of theforwardersdirective. It accepts the following options:first— The server will query the nameservers listed in theforwardersdirective before attempting to resolve the name on its own.only— When unable to query the nameservers listed in theforwardersdirective, the server will not attempt to resolve the name on its own.
listen-onSpecifies the IPv4network interface on which to listen for queries. On aDNSserver that also acts as a gateway, you can use this option to answer queries originating from a single network only. AllIPv4interfaces are used by default.listen-on-v6Specifies the IPv6network interface on which to listen for queries. On aDNSserver that also acts as a gateway, you can use this option to answer queries originating from a single network only. AllIPv6interfaces are used by default.max-cache-sizeSpecifies the maximum amount of memory to be used for server caches. When the limit is reached, the server causes records to expire prematurely so that the limit is not exceeded. In a server with multiple views, the limit applies separately to the cache of each view. The default option is 32M.notifySpecifies whether to notify the secondary nameservers when a zone is updated. It accepts the following options:yes— The server will notify all secondary nameservers.no— The server will not notify any secondary nameserver.master-only— The server will notify primary server for the zone only.explicit— The server will notify only the secondary servers that are specified in thealso-notifylist within a zone statement.
pid-fileSpecifies the location of the process ID file created by the namedservice.recursionSpecifies whether to act as a recursive server. The default option is yes.statistics-fileSpecifies an alternate location for statistics files. The /var/named/named.statsfile is used by default.Note
The directory used bynamedfor runtime data has been moved from the BIND default location,/var/run/named/, to a new location/run/named/. As a result, the PID file has been moved from the default location/var/run/named/named.pidto the new location/run/named/named.pid. In addition, the session-key file has been moved to/run/named/session.key. These locations need to be specified by statements in the options section. See Example 15.4, “Using the options Statement”.Important
To prevent distributed denial of service (DDoS) attacks, it is recommended that you use theallow-query-cacheoption to restrict recursiveDNSservices for a particular subset of clients only.See the BIND 9 Administrator Reference Manual referenced in Section 15.2.8.1, “Installed Documentation”, and thenamed.confmanual page for a complete list of available options.Example 15.4. Using the options Statement
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
zone - The
zonestatement allows you to define the characteristics of a zone, such as the location of its configuration file and zone-specific options, and can be used to override the globaloptionsstatements. It takes the following form:zone zone-name [zone-class] { option; ... };zone zone-name [zone-class] { option; ... };Copy to Clipboard Copied! Toggle word wrap Toggle overflow The zone-name attribute is the name of the zone, zone-class is the optional class of the zone, and option is azonestatement option as described in Table 15.4, “Commonly Used Options in Zone Statements”.The zone-name attribute is particularly important, as it is the default value assigned for the$ORIGINdirective used within the corresponding zone file located in the/var/named/directory. Thenameddaemon appends the name of the zone to any non-fully qualified domain name listed in the zone file. For example, if azonestatement defines the namespace forexample.com, useexample.comas the zone-name so that it is placed at the end of host names within theexample.comzone file.For more information about zone files, see Section 15.2.3, “Editing Zone Files”.Expand Table 15.4. Commonly Used Options in Zone Statements Option Description allow-querySpecifies which clients are allowed to request information about this zone. This option overrides global allow-queryoption. All query requests are allowed by default.allow-transferSpecifies which secondary servers are allowed to request a transfer of the zone's information. All transfer requests are allowed by default. allow-updateSpecifies which hosts are allowed to dynamically update information in their zone. The default option is to deny all dynamic update requests.Note that you should be careful when allowing hosts to update information about their zone. Do not setIPaddresses in this option unless the server is in the trusted network. Instead, use TSIG key as described in Section 15.2.6.3, “Transaction SIGnatures (TSIG)”.fileSpecifies the name of the file in the namedworking directory that contains the zone's configuration data.mastersSpecifies from which IPaddresses to request authoritative zone information. This option is used only if the zone is defined astypeslave.notifySpecifies whether to notify the secondary nameservers when a zone is updated. It accepts the following options:yes— The server will notify all secondary nameservers.no— The server will not notify any secondary nameserver.master-only— The server will notify primary server for the zone only.explicit— The server will notify only the secondary servers that are specified in thealso-notifylist within a zone statement.
typeSpecifies the zone type. It accepts the following options:delegation-only— Enforces the delegation status of infrastructure zones such as COM, NET, or ORG. Any answer that is received without an explicit or implicit delegation is treated asNXDOMAIN. This option is only applicable in TLDs (Top-Level Domain) or root zone files used in recursive or caching implementations.forward— Forwards all requests for information about this zone to other nameservers.hint— A special type of zone used to point to the root nameservers which resolve queries when a zone is not otherwise known. No configuration beyond the default is necessary with ahintzone.master— Designates the nameserver as authoritative for this zone. A zone should be set as themasterif the zone's configuration files reside on the system.slave— Designates the nameserver as a secondary server for this zone. Primary server is specified in themastersdirective.
Most changes to the/etc/named.conffile of a primary or secondary nameserver involve adding, modifying, or deletingzonestatements, and only a small subset ofzonestatement options is usually needed for a nameserver to work efficiently.In Example 15.5, “A Zone Statement for a Primary nameserver”, the zone is identified asexample.com, the type is set tomaster, and thenamedservice is instructed to read the/var/named/example.com.zonefile. It also allows only a secondary nameserver (192.168.0.2) to transfer the zone.Example 15.5. A Zone Statement for a Primary nameserver
zone "example.com" IN { type master; file "example.com.zone"; allow-transfer { 192.168.0.2; }; };zone "example.com" IN { type master; file "example.com.zone"; allow-transfer { 192.168.0.2; }; };Copy to Clipboard Copied! Toggle word wrap Toggle overflow A secondary server'szonestatement is slightly different. The type is set toslave, and themastersdirective is tellingnamedtheIPaddress of the primary server.In Example 15.6, “A Zone Statement for a Secondary nameserver”, thenamedservice is configured to query the primary server at the192.168.0.1IPaddress for information about theexample.comzone. The received information is then saved to the/var/named/slaves/example.com.zonefile. Note that you have to put all secondary zones in the/var/named/slaves/directory, otherwise the service will fail to transfer the zone.Example 15.6. A Zone Statement for a Secondary nameserver
zone "example.com" { type slave; file "slaves/example.com.zone"; masters { 192.168.0.1; }; };zone "example.com" { type slave; file "slaves/example.com.zone"; masters { 192.168.0.1; }; };Copy to Clipboard Copied! Toggle word wrap Toggle overflow
15.2.2.3. Other Statement Types Copy linkLink copied to clipboard!
/etc/named.conf:
-
controls - The
controlsstatement allows you to configure various security requirements necessary to use therndccommand to administer thenamedservice.See Section 15.2.4, “Using the rndc Utility” for more information on therndcutility and its usage. -
key - The
keystatement allows you to define a particular key by name. Keys are used to authenticate various actions, such as secure updates or the use of therndccommand. Two options are used withkey:algorithm algorithm-name— The type of algorithm to be used (for example,hmac-md5).secret "key-value"— The encrypted key.
See Section 15.2.4, “Using the rndc Utility” for more information on therndcutility and its usage. -
logging - The
loggingstatement allows you to use multiple types of logs, so called channels. By using thechanneloption within the statement, you can construct a customized type of log with its own file name (file), size limit (size), version number (version), and level of importance (severity). Once a customized channel is defined, acategoryoption is used to categorize the channel and begin logging when thenamedservice is restarted.By default,namedsends standard messages to thersyslogdaemon, which places them in/var/log/messages. Several standard channels are built into BIND with various severity levels, such asdefault_syslog(which handles informational logging messages) anddefault_debug(which specifically handles debugging messages). A default category, calleddefault, uses the built-in channels to do normal logging without any special configuration.Customizing the logging process can be a very detailed process and is beyond the scope of this chapter. For information on creating custom BIND logs, see the BIND 9 Administrator Reference Manual referenced in Section 15.2.8.1, “Installed Documentation”. -
server - The
serverstatement allows you to specify options that affect how thenamedservice should respond to remote nameservers, especially with regard to notifications and zone transfers.Thetransfer-formatoption controls the number of resource records that are sent with each message. It can be eitherone-answer(only one resource record), ormany-answers(multiple resource records). Note that while themany-answersoption is more efficient, it is not supported by older versions of BIND. -
trusted-keys - The
trusted-keysstatement allows you to specify assorted public keys used for secureDNS(DNSSEC). See Section 15.2.6.4, “DNS Security Extensions (DNSSEC)” for more information on this topic. -
view - The
viewstatement allows you to create special views depending upon which network the host querying the nameserver is on. This allows some hosts to receive one answer regarding a zone while other hosts receive totally different information. Alternatively, certain zones may only be made available to particular trusted hosts while non-trusted hosts can only make queries for other zones.Multiple views can be used as long as their names are unique. Thematch-clientsoption allows you to specify theIPaddresses that apply to a particular view. If theoptionsstatement is used within a view, it overrides the already configured global options. Finally, mostviewstatements contain multiplezonestatements that apply to thematch-clientslist.Note that the order in which theviewstatements are listed is important, as the first statement that matches a particular client'sIPaddress is used. For more information on this topic, see Section 15.2.6.1, “Multiple Views”.
15.2.2.4. Comment Tags Copy linkLink copied to clipboard!
/etc/named.conf file can also contain comments. Comments are ignored by the named service, but can prove useful when providing additional information to a user. The following are valid comment tags:
-
// - Any text after the
//characters to the end of the line is considered a comment. For example:notify yes; // notify all secondary nameservers
notify yes; // notify all secondary nameserversCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
# - Any text after the
#character to the end of the line is considered a comment. For example:notify yes; # notify all secondary nameservers
notify yes; # notify all secondary nameserversCopy to Clipboard Copied! Toggle word wrap Toggle overflow /*and*/- Any block of text enclosed in
/*and*/is considered a comment. For example:notify yes; /* notify all secondary nameservers */
notify yes; /* notify all secondary nameservers */Copy to Clipboard Copied! Toggle word wrap Toggle overflow
15.2.3. Editing Zone Files Copy linkLink copied to clipboard!
named working directory located in /var/named/ by default. Each zone file is named according to the file option in the zone statement, usually in a way that relates to the domain in and identifies the file as containing zone data, such as example.com.zone.
| Path | Description |
|---|---|
/var/named/ | The working directory for the named service. The nameserver is not allowed to write to this directory. |
/var/named/slaves/ | The directory for secondary zones. This directory is writable by the named service. |
/var/named/dynamic/ | The directory for other files, such as dynamic DNS (DDNS) zones or managed DNSSEC keys. This directory is writable by the named service. |
/var/named/data/ | The directory for various statistics and debugging files. This directory is writable by the named service. |
15.2.3.1. Common Directives Copy linkLink copied to clipboard!
$) followed by the name of the directive, and usually appear at the top of the file. The following directives are commonly used in zone files:
-
$INCLUDE - The
$INCLUDEdirective allows you to include another file at the place where it appears, so that other zone settings can be stored in a separate zone file.Example 15.7. Using the $INCLUDE Directive
$INCLUDE /var/named/penguin.example.com
$INCLUDE /var/named/penguin.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
$ORIGIN - The
$ORIGINdirective allows you to append the domain name to unqualified records, such as those with the host name only. Note that the use of this directive is not necessary if the zone is specified in/etc/named.conf, since the zone name is used by default.In Example 15.8, “Using the $ORIGIN Directive”, any names used in resource records that do not end in a trailing period (the.character) are appended withexample.com.Example 15.8. Using the $ORIGIN Directive
$ORIGIN example.com.
$ORIGIN example.com.Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
$TTL - The
$TTLdirective allows you to set the default Time to Live (TTL) value for the zone, that is, how long is a zone record valid. Each resource record can contain its own TTL value, which overrides this directive.Increasing this value allows remote nameservers to cache the zone information for a longer period of time, reducing the number of queries for the zone and lengthening the amount of time required to propagate resource record changes.Example 15.9. Using the $TTL Directive
$TTL 1D
$TTL 1DCopy to Clipboard Copied! Toggle word wrap Toggle overflow
15.2.3.2. Common Resource Records Copy linkLink copied to clipboard!
-
A - The Address record specifies an
IPaddress to be assigned to a name. It takes the following form:hostname IN A IP-address
hostname IN A IP-addressCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the hostname value is omitted, the record will point to the last specified hostname.In Example 15.10, “Using the A Resource Record”, the requests forserver1.example.comare pointed to10.0.1.3or10.0.1.5.Example 15.10. Using the A Resource Record
server1 IN A 10.0.1.3 IN A 10.0.1.5server1 IN A 10.0.1.3 IN A 10.0.1.5Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
CNAME - The Canonical Name record maps one name to another. Because of this, this type of record is sometimes referred to as an alias record. It takes the following form:
alias-name IN CNAME real-name
alias-name IN CNAME real-nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow CNAMErecords are most commonly used to point to services that use a common naming scheme, such aswwwfor Web servers. However, there are multiple restrictions for their usage:- CNAME records should not point to other CNAME records. This is mainly to avoid possible infinite loops.
- CNAME records should not contain other resource record types (such as A, NS, MX, and so on). The only exception are DNSSEC related records (RRSIG, NSEC, and so on) when the zone is signed.
- Other resource records that point to the fully qualified domain name (FQDN) of a host (NS, MX, PTR) should not point to a CNAME record.
In Example 15.11, “Using the CNAME Resource Record”, theArecord binds a host name to anIPaddress, while theCNAMErecord points the commonly usedwwwhost name to it.Example 15.11. Using the CNAME Resource Record
server1 IN A 10.0.1.5 www IN CNAME server1
server1 IN A 10.0.1.5 www IN CNAME server1Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
MX - The Mail Exchange record specifies where the mail sent to a particular namespace controlled by this zone should go. It takes the following form:
IN MX preference-value email-server-name
IN MX preference-value email-server-nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow The email-server-name is a fully qualified domain name (FQDN). The preference-value allows numerical ranking of the email servers for a namespace, giving preference to some email systems over others. TheMXresource record with the lowest preference-value is preferred over the others. However, multiple email servers can possess the same value to distribute email traffic evenly among them.In Example 15.12, “Using the MX Resource Record”, the firstmail.example.comemail server is preferred to themail2.example.comemail server when receiving email destined for theexample.comdomain.Example 15.12. Using the MX Resource Record
example.com. IN MX 10 mail.example.com. IN MX 20 mail2.example.com.example.com. IN MX 10 mail.example.com. IN MX 20 mail2.example.com.Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
NS - The Nameserver record announces authoritative nameservers for a particular zone. It takes the following form:
IN NS nameserver-name
IN NS nameserver-nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow The nameserver-name should be a fully qualified domain name (FQDN). Note that when two nameservers are listed as authoritative for the domain, it is not important whether these nameservers are secondary nameservers, or if one of them is a primary server. They are both still considered authoritative.Example 15.13. Using the NS Resource Record
IN NS dns1.example.com. IN NS dns2.example.com.
IN NS dns1.example.com. IN NS dns2.example.com.Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
PTR - The Pointer record points to another part of the namespace. It takes the following form:
last-IP-digit IN PTR FQDN-of-system
last-IP-digit IN PTR FQDN-of-systemCopy to Clipboard Copied! Toggle word wrap Toggle overflow The last-IP-digit directive is the last number in anIPaddress, and the FQDN-of-system is a fully qualified domain name (FQDN).PTRrecords are primarily used for reverse name resolution, as they pointIPaddresses back to a particular name. See Section 15.2.3.4.2, “A Reverse Name Resolution Zone File” for examples ofPTRrecords in use. -
SOA - The Start of Authority record announces important authoritative information about a namespace to the nameserver. Located after the directives, it is the first resource record in a zone file. It takes the following form:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The directives are as follows:- The
@symbol places the$ORIGINdirective (or the zone's name if the$ORIGINdirective is not set) as the namespace being defined by thisSOAresource record. - The primary-name-server directive is the host name of the primary nameserver that is authoritative for this domain.
- The hostmaster-email directive is the email of the person to contact about the namespace.
- The serial-number directive is a numerical value incremented every time the zone file is altered to indicate it is time for the
namedservice to reload the zone. - The time-to-refresh directive is the numerical value secondary nameservers use to determine how long to wait before asking the primary nameserver if any changes have been made to the zone.
- The time-to-retry directive is a numerical value used by secondary nameservers to determine the length of time to wait before issuing a refresh request in the event that the primary nameserver is not answering. If the primary server has not replied to a refresh request before the amount of time specified in the time-to-expire directive elapses, the secondary servers stop responding as an authority for requests concerning that namespace.
- In BIND 4 and 8, the minimum-TTL directive is the amount of time other nameservers cache the zone's information. In BIND 9, it defines how long negative answers are cached for. Caching of negative answers can be set to a maximum of 3 hours (
3H).
When configuring BIND, all times are specified in seconds. However, it is possible to use abbreviations when specifying units of time other than seconds, such as minutes (M), hours (H), days (D), and weeks (W). Table 15.6, “Seconds compared to other time units” shows an amount of time in seconds and the equivalent time in another format.Expand Table 15.6. Seconds compared to other time units Seconds Other Time Units 60 1M1800 30M3600 1H10800 3H21600 6H43200 12H86400 1D259200 3D604800 1W31536000 365DExample 15.14. Using the SOA Resource Record
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
15.2.3.3. Comment Tags Copy linkLink copied to clipboard!
named service, but can prove useful when providing additional information to the user. Any text after the semicolon character to the end of the line is considered a comment. For example:
604800 ; expire after 1 week
604800 ; expire after 1 week
15.2.3.4. Example Usage Copy linkLink copied to clipboard!
15.2.3.4.1. A Simple Zone File Copy linkLink copied to clipboard!
SOA values.
Example 15.15. A simple zone file
dns1.example.com and dns2.example.com, and are tied to the 10.0.1.1 and 10.0.1.2 IP addresses respectively using the A record.
MX records point to mail and mail2 through A records. Since these names do not end in a trailing period, the $ORIGIN domain is placed after them, expanding them to mail.example.com and mail2.example.com.
www.example.com (WWW), are pointed at the appropriate servers using the CNAME record.
zone statement in the /etc/named.conf similar to the following:
zone "example.com" IN {
type master;
file "example.com.zone";
allow-update { none; };
};
zone "example.com" IN {
type master;
file "example.com.zone";
allow-update { none; };
};
15.2.3.4.2. A Reverse Name Resolution Zone File Copy linkLink copied to clipboard!
IP address in a particular namespace into a fully qualified domain name (FQDN). It looks very similar to a standard zone file, except that the PTR resource records are used to link the IP addresses to a fully qualified domain name as shown in Example 15.16, “A reverse name resolution zone file”.
Example 15.16. A reverse name resolution zone file
IP addresses 10.0.1.1 through 10.0.1.6 are pointed to the corresponding fully qualified domain name.
zone statement in the /etc/named.conf file similar to the following:
zone "1.0.10.in-addr.arpa" IN {
type master;
file "example.com.rr.zone";
allow-update { none; };
};
zone "1.0.10.in-addr.arpa" IN {
type master;
file "example.com.rr.zone";
allow-update { none; };
};
zone statement, except for the zone name. Note that a reverse name resolution zone requires the first three blocks of the IP address reversed followed by .in-addr.arpa. This allows the single block of IP numbers used in the reverse name resolution zone file to be associated with the zone.
15.2.4. Using the rndc Utility Copy linkLink copied to clipboard!
rndc utility is a command-line tool that allows you to administer the named service, both locally and from a remote machine. Its usage is as follows:
rndc [option...] command [command-option]
rndc [option...] command [command-option]
15.2.4.1. Configuring the Utility Copy linkLink copied to clipboard!
named must be configured to listen on the selected port (953 by default), and an identical key must be used by both the service and the rndc utility.
rndc configuration is located in /etc/rndc.conf. If the file does not exist, the utility will use the key located in /etc/rndc.key, which was generated automatically during the installation process using the rndc-confgen -a command.
named service is configured using the controls statement in the /etc/named.conf configuration file as described in Section 15.2.2.3, “Other Statement Types”. Unless this statement is present, only the connections from the loopback address (127.0.0.1) will be allowed, and the key located in /etc/rndc.key will be used.
Important
root is allowed to read the /etc/rndc.key file:
chmod o-rwx /etc/rndc.key
~]# chmod o-rwx /etc/rndc.key
15.2.4.2. Checking the Service Status Copy linkLink copied to clipboard!
named service, use the following command:
15.2.4.3. Reloading the Configuration and Zones Copy linkLink copied to clipboard!
rndc reload
~]# rndc reload
server reload successful
reload command, for example:
rndc reload localhost
~]# rndc reload localhost
zone reload up-to-date
rndc reconfig
~]# rndc reconfig
Note
DNS (DDNS), make sure you run the freeze command first:
rndc freeze localhost
~]# rndc freeze localhost
thaw command to allow the DDNS again and reload the zone:
rndc thaw localhost
~]# rndc thaw localhost
The zone reload and thaw was successful.
15.2.4.4. Updating Zone Keys Copy linkLink copied to clipboard!
sign command. For example:
rndc sign localhost
~]# rndc sign localhost
auto-dnssec option has to be set to maintain in the zone statement. For example:
15.2.4.5. Enabling the DNSSEC Validation Copy linkLink copied to clipboard!
root:
rndc validation on
~]# rndc validation on
rndc validation off
~]# rndc validation off
options statement described in Section 15.2.2.2, “Common Statement Types” for information on how to configure this option in /etc/named.conf.
15.2.4.6. Enabling the Query Logging Copy linkLink copied to clipboard!
root:
rndc querylog
~]# rndc querylog
status command as described in Section 15.2.4.2, “Checking the Service Status”.
15.2.5. Using the dig Utility Copy linkLink copied to clipboard!
dig utility is a command-line tool that allows you to perform DNS lookups and debug a nameserver configuration. Its typical usage is as follows:
dig [@server] [option...] name type
dig [@server] [option...] name type
15.2.5.1. Looking Up a Nameserver Copy linkLink copied to clipboard!
dig name NS
dig name NS
dig utility is used to display nameservers for example.com.
Example 15.17. A sample nameserver lookup
15.2.5.2. Looking Up an IP Address Copy linkLink copied to clipboard!
IP address assigned to a particular domain, use the command in the following form:
dig name A
dig name A
dig utility is used to display the IP address of example.com.
Example 15.18. A sample IP address lookup
15.2.5.3. Looking Up a Host Name Copy linkLink copied to clipboard!
IP address, use the command in the following form:
dig -x address
dig -x address
dig utility is used to display the host name assigned to 192.0.32.10.
Example 15.19. A Sample Host Name Lookup
15.2.6. Advanced Features of BIND Copy linkLink copied to clipboard!
named service to provide name resolution services or to act as an authority for a particular domain. However, BIND version 9 has a number of advanced features that allow for a more secure and efficient DNS service.
Important
15.2.6.1. Multiple Views Copy linkLink copied to clipboard!
DNS entries from clients outside of the local network, while allowing queries from clients inside the local network.
view statement to the /etc/named.conf configuration file. Use the match-clients option to match IP addresses or entire networks and give them special options and zone data.
15.2.6.2. Incremental Zone Transfers (IXFR) Copy linkLink copied to clipboard!
15.2.6.3. Transaction SIGnatures (TSIG) Copy linkLink copied to clipboard!
IP address-based method of transfer authorization, since attackers would not only need to have access to the IP address to transfer the zone, but they would also need to know the secret key.
Important
IP address-based authentication only.
15.2.6.4. DNS Security Extensions (DNSSEC) Copy linkLink copied to clipboard!
DNS data, authenticated denial of existence, and data integrity. When a particular domain is marked as secure, the SERVFAIL response is returned for each resource record that fails the validation.
dig utility as described in Section 15.2.5, “Using the dig Utility”. Useful options are +dnssec (requests DNSSEC-related resource records by setting the DNSSEC OK bit), +cd (tells recursive nameserver not to validate the response), and +bufsize=512 (changes the packet size to 512B to get through some firewalls).
15.2.6.5. Internet Protocol version 6 (IPv6) Copy linkLink copied to clipboard!
AAAA resource records, and the listen-on-v6 directive as described in Table 15.3, “Commonly Used Configuration Options”.
15.2.7. Common Mistakes to Avoid Copy linkLink copied to clipboard!
- Use semicolons and curly brackets correctly
- An omitted semicolon or unmatched curly bracket in the
/etc/named.conffile can prevent thenamedservice from starting. - Use period (the
.character) correctly - In zone files, a period at the end of a domain name denotes a fully qualified domain name. If omitted, the
namedservice will append the name of the zone or the value of$ORIGINto complete it. - Increment the serial number when editing a zone file
- If the serial number is not incremented, the primary nameserver will have the correct, new information, but the secondary nameservers will never be notified of the change, and will not attempt to refresh their data of that zone.
- Configure the firewall
- If a firewall is blocking connections from the
namedservice to other nameservers, the recommended practice is to change the firewall settings.Warning
Using a fixedUDPsource port forDNSqueries is a potential security vulnerability that could allow an attacker to conduct cache-poisoning attacks more easily. To prevent this, by defaultDNSsends from a random ephemeral port. Configure your firewall to allow outgoing queries from a randomUDPsource port. The range1024to65535is used by default.
15.2.8. Additional Resources Copy linkLink copied to clipboard!
15.2.8.1. Installed Documentation Copy linkLink copied to clipboard!
-
/usr/share/doc/bind-version/ - The main directory containing the most recent documentation. The directory contains the BIND 9 Administrator Reference Manual in HTML and PDF formats, which details BIND resource requirements, how to configure different types of nameservers, how to perform load balancing, and other advanced topics.
-
/usr/share/doc/bind-version/sample/etc/ - The directory containing examples of
namedconfiguration files.
-
rndc(8) - The manual page for the
rndcname server control utility, containing documentation on its usage. -
named(8) - The manual page for the Internet domain name server
named, containing documentation on assorted arguments that can be used to control the BIND nameserver daemon. -
lwresd(8) - The manual page for the lightweight resolver daemon
lwresd, containing documentation on the daemon and its usage. -
named.conf(5) - The manual page with a comprehensive list of options available within the
namedconfiguration file. -
rndc.conf(5) - The manual page with a comprehensive list of options available within the
rndcconfiguration file.
15.2.8.2. Online Resources Copy linkLink copied to clipboard!
- https://access.redhat.com/site/articles/770133
- A Red Hat Knowledgebase article about running BIND in a
chrootenvironment, including the differences compared to Red Hat Enterprise Linux 6. - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/
- The Red Hat Enterprise Linux 7 Security Guide has a comprehensive section on DNSSEC.
- https://www.icann.org/namecollision
- The ICANN FAQ on domain name collision.
Chapter 16. Configuring the Squid Caching Proxy Server Copy linkLink copied to clipboard!
16.1. Setting up Squid as a Caching Proxy Without Authentication Copy linkLink copied to clipboard!
Prerequisites
- The procedure assumes that the
/etc/squid/squid.conffile is as provided by the squid package. If you edited this file before, remove the file and reinstall the package.
Procedure
- Install the squid package:
yum install squid
# yum install squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the
/etc/squid/squid.conffile:- Adapt the
localnetaccess control lists (ACL) to match the IP ranges that should be allowed to use the proxy:acl localnet src 192.0.2.0/24 acl localnet 2001:db8::/32
acl localnet src 192.0.2.0/24 acl localnet 2001:db8::/32Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the/etc/squid/squid.conffile contains thehttp_access allow localnetrule that allows using the proxy from all IP ranges specified inlocalnetACLs. Note that you must specify alllocalnetACLs before thehttp_access allow localnetrule.Important
Remove all existingacl localnetentries that do not match your environment. - The following ACL exists in the default configuration and defines
443as a port that uses the HTTPS protocol:acl SSL_ports port 443
acl SSL_ports port 443Copy to Clipboard Copied! Toggle word wrap Toggle overflow If users should be able to use the HTTPS protocol also on other ports, add an ACL for each of these port:acl SSL_ports port port_number
acl SSL_ports port port_numberCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Update the list of
acl Safe_portsrules to configure to which ports Squid can establish a connection. For example, to configure that clients using the proxy can only access resources on port 21 (FTP), 80 (HTTP), and 443 (HTTPS), keep only the followingacl Safe_portsstatements in the configuration:acl Safe_ports port 21 acl Safe_ports port 80 acl Safe_ports port 443
acl Safe_ports port 21 acl Safe_ports port 80 acl Safe_ports port 443Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the configuration contains thehttp_access deny !Safe_portsrule that defines access denial to ports that are not defined inSafe_portsACLs. - Configure the cache type, the path to the cache directory, the cache size, and further cache type-specific settings in the
cache_dirparameter:cache_dir ufs /var/spool/squid 10000 16 256
cache_dir ufs /var/spool/squid 10000 16 256Copy to Clipboard Copied! Toggle word wrap Toggle overflow With these settings:- Squid uses the
ufscache type. - Squid stores its cache in the
/var/spool/squid/directory. - The cache grows up to
10000MB. - Squid creates
16level-1 sub-directories in the/var/spool/squid/directory. - Squid creates
256sub-directories in each level-1 directory.
If you do not set acache_dirdirective, Squid stores the cache in memory.
- If you set a different cache directory than
/var/spool/squid/in thecache_dirparameter:- Create the cache directory:
mkdir -p path_to_cache_directory
# mkdir -p path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the permissions for the cache directory:
chown squid:squid path_to_cache_directory
# chown squid:squid path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you run SELinux in
enforcingmode, set thesquid_cache_tcontext for the cache directory:semanage fcontext -a -t squid_cache_t "path_to_cache_directory(/.*)?" restorecon -Rv path_to_cache_directory
# semanage fcontext -a -t squid_cache_t "path_to_cache_directory(/.*)?" # restorecon -Rv path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow If thesemanageutility is not available on your system, install the policycoreutils-python-utils package.
- Open the
3128port in the firewall:firewall-cmd --permanent --add-port=3128/tcp firewall-cmd --reload
# firewall-cmd --permanent --add-port=3128/tcp # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the
squidservice:systemctl start squid
# systemctl start squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Enable the
squidservice to start automatically when the system boots:systemctl enable squid
# systemctl enable squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification Steps
curl utility:
curl -O -L "https://www.redhat.com/index.html" -x "proxy.example.com:3128"
# curl -O -L "https://www.redhat.com/index.html" -x "proxy.example.com:3128"
curl does not display any error and the index.html file was downloaded to the current directory, the proxy works.
16.2. Setting up Squid as a Caching Proxy With LDAP Authentication Copy linkLink copied to clipboard!
Prerequisites
- The procedure assumes that the
/etc/squid/squid.conffile is as provided by the squid package. If you edited this file before, remove the file and reinstall the package. - An service user, such as
uid=proxy_user,cn=users,cn=accounts,dc=example,dc=comexists in the LDAP directory. Squid uses this account only to search for the authenticating user. If the authenticating user exists, Squid binds as this user to the directory to verify the authentication.
Procedure
- Install the squid package:
yum install squid
# yum install squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the
/etc/squid/squid.conffile:- To configure the
basic_ldap_authhelper utility, add the following configuration entry to the top of/etc/squid/squid.conf:auth_param basic program /usr/lib64/squid/basic_ldap_auth -b "cn=users,cn=accounts,dc=example,dc=com" -D "uid=proxy_user,cn=users,cn=accounts,dc=example,dc=com" -W /etc/squid/ldap_password -f "(&(objectClass=person)(uid=%s))" -ZZ -H ldap://ldap_server.example.com:389
auth_param basic program /usr/lib64/squid/basic_ldap_auth -b "cn=users,cn=accounts,dc=example,dc=com" -D "uid=proxy_user,cn=users,cn=accounts,dc=example,dc=com" -W /etc/squid/ldap_password -f "(&(objectClass=person)(uid=%s))" -ZZ -H ldap://ldap_server.example.com:389Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following describes the parameters passed to thebasic_ldap_authhelper utility in the example above:-B base_DNsets the LDAP search base.-D proxy_service_user_DNsets the distinguished name (DN) of the account Squid uses to search for the authenticating user in the directory.-W path_to_password_filesets the path to the file that contains the password of the proxy service user. Using a password file prevents that the password is visible in the operating system's process list.-f LDAP_filterspecifies the LDAP search filter. Squid replaces the%svariable with the user name provided by the authenticating user.The(&(objectClass=person)(uid=%s))filter in the example defines that the user name must match the value set in theuidattribute and that the directory entry contains thepersonobject class.-ZZenforces a TLS-encrypted connection over the LDAP protocol using theSTARTTLScommand. Omit the-ZZin the following situations:- The LDAP server does not support encrypted connections.
- The port specified in the URL uses the LDAPS protocol.
- The
-H LDAP_URLparameter specifies the protocol, the host name or IP address, and the port of the LDAP server in URL format.
- Add the following ACL and rule to configure that Squid allows only authenticated users to use the proxy:
acl ldap-auth proxy_auth REQUIRED http_access allow ldap-auth
acl ldap-auth proxy_auth REQUIRED http_access allow ldap-authCopy to Clipboard Copied! Toggle word wrap Toggle overflow Important
Specify these settings before thehttp_access deny allrule. - Remove the following rule to disable bypassing the proxy authentication from IP ranges specified in
localnetACLs:http_access allow localnet
http_access allow localnetCopy to Clipboard Copied! Toggle word wrap Toggle overflow - The following ACL exists in the default configuration and defines
443as a port that uses the HTTPS protocol:acl SSL_ports port 443
acl SSL_ports port 443Copy to Clipboard Copied! Toggle word wrap Toggle overflow If users should be able to use the HTTPS protocol also on other ports, add an ACL for each of these port:acl SSL_ports port port_number
acl SSL_ports port port_numberCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Update the list of
acl Safe_portsrules to configure to which ports Squid can establish a connection. For example, to configure that clients using the proxy can only access resources on port 21 (FTP), 80 (HTTP), and 443 (HTTPS), keep only the followingacl Safe_portsstatements in the configuration:acl Safe_ports port 21 acl Safe_ports port 80 acl Safe_ports port 443
acl Safe_ports port 21 acl Safe_ports port 80 acl Safe_ports port 443Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the configuration contains thehttp_access deny !Safe_portsrule that defines access denial to ports that are not defined inSafe_portsACLs. - Configure the cache type, the path to the cache directory, the cache size, and further cache type-specific settings in the
cache_dirparameter:cache_dir ufs /var/spool/squid 10000 16 256
cache_dir ufs /var/spool/squid 10000 16 256Copy to Clipboard Copied! Toggle word wrap Toggle overflow With these settings:- Squid uses the
ufscache type. - Squid stores its cache in the
/var/spool/squid/directory. - The cache grows up to
10000MB. - Squid creates
16level-1 sub-directories in the/var/spool/squid/directory. - Squid creates
256sub-directories in each level-1 directory.
If you do not set acache_dirdirective, Squid stores the cache in memory.
- If you set a different cache directory than
/var/spool/squid/in thecache_dirparameter:- Create the cache directory:
mkdir -p path_to_cache_directory
# mkdir -p path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the permissions for the cache directory:
chown squid:squid path_to_cache_directory
# chown squid:squid path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you run SELinux in
enforcingmode, set thesquid_cache_tcontext for the cache directory:semanage fcontext -a -t squid_cache_t "path_to_cache_directory(/.*)?" restorecon -Rv path_to_cache_directory
# semanage fcontext -a -t squid_cache_t "path_to_cache_directory(/.*)?" # restorecon -Rv path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow If thesemanageutility is not available on your system, install the policycoreutils-python-utils package.
- Store the password of the LDAP service user in the
/etc/squid/ldap_passwordfile, and set appropriate permissions for the file:echo "password" > /etc/squid/ldap_password chown root:squid /etc/squid/ldap_password chmod 640 /etc/squid/ldap_password
# echo "password" > /etc/squid/ldap_password # chown root:squid /etc/squid/ldap_password # chmod 640 /etc/squid/ldap_passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Open the
3128port in the firewall:firewall-cmd --permanent --add-port=3128/tcp firewall-cmd --reload
# firewall-cmd --permanent --add-port=3128/tcp # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the
squidservice:systemctl start squid
# systemctl start squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Enable the
squidservice to start automatically when the system boots:systemctl enable squid
# systemctl enable squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification Steps
curl utility:
curl -O -L "https://www.redhat.com/index.html" -x "user_name:password@proxy.example.com:3128"
# curl -O -L "https://www.redhat.com/index.html" -x "user_name:password@proxy.example.com:3128"
curl does not display any error and the index.html file was downloaded to the current directory, the proxy works.
Troubleshooting Steps
- Manually start the helper utility with the same settings you used in the
auth_paramparameter:/usr/lib64/squid/basic_ldap_auth -b "cn=users,cn=accounts,dc=example,dc=com" -D "uid=proxy_user,cn=users,cn=accounts,dc=example,dc=com" -W /etc/squid/ldap_password -f "(&(objectClass=person)(uid=%s))" -ZZ -H ldap://ldap_server.example.com:389
# /usr/lib64/squid/basic_ldap_auth -b "cn=users,cn=accounts,dc=example,dc=com" -D "uid=proxy_user,cn=users,cn=accounts,dc=example,dc=com" -W /etc/squid/ldap_password -f "(&(objectClass=person)(uid=%s))" -ZZ -H ldap://ldap_server.example.com:389Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Enter a valid user name and password, and press Enter:
user_name password
user_name passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the helper utility returnsOK, authentication succeeded.
16.3. Setting up Squid as a Caching Proxy With Kerberos Authentication Copy linkLink copied to clipboard!
Prerequisites
- The procedure assumes that the
/etc/squid/squid.conffile is as provided by the squid package. If you edited this file before, remove the file and reinstall the package. - The server on which you want to install Squid is a member of the AD domain. For details, see Setting up Samba as a Domain Member in the Red Hat Enterprise Linux 7 System Administrator's Guide.
Procedure
- Install the following packages:
yum install squid krb5-workstation
# yum install squid krb5-workstationCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Authenticate as the AD domain administrator:
kinit administrator@AD.EXAMPLE.COM
# kinit administrator@AD.EXAMPLE.COMCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a keytab for Squid and store it in the
/etc/squid/HTTP.keytabfile:export KRB5_KTNAME=FILE:/etc/squid/HTTP.keytab net ads keytab CREATE -U administrator
# export KRB5_KTNAME=FILE:/etc/squid/HTTP.keytab # net ads keytab CREATE -U administratorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the
HTTPservice principal to the keytab:net ads keytab ADD HTTP -U administrator
# net ads keytab ADD HTTP -U administratorCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the owner of the keytab file to the
squiduser:chown squid /etc/squid/HTTP.keytab
# chown squid /etc/squid/HTTP.keytabCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Optionally, verify that the keytab file contains the
HTTPservice principal for the fully-qualified domain name (FQDN) of the proxy server:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the
/etc/squid/squid.conffile:- To configure the
negotiate_kerberos_authhelper utility, add the following configuration entry to the top of/etc/squid/squid.conf:auth_param negotiate program /usr/lib64/squid/negotiate_kerberos_auth -k /etc/squid/HTTP.keytab -s HTTP/proxy.ad.example.com@AD.EXAMPLE.COM
auth_param negotiate program /usr/lib64/squid/negotiate_kerberos_auth -k /etc/squid/HTTP.keytab -s HTTP/proxy.ad.example.com@AD.EXAMPLE.COMCopy to Clipboard Copied! Toggle word wrap Toggle overflow The following describes the parameters passed to thenegotiate_kerberos_authhelper utility in the example above:-k filesets the path to the key tab file. Note that thesquiduser must have read permissions on this file.-s HTTP/host_name@kerberos_realmsets the Kerberos principal that Squid uses.
Optionally, you can enable logging by passing one or both of the following parameters to the helper utility:-ilogs informational messages, such as the authenticating user.-denables debug logging.
Squid logs the debugging information from the helper utility to the/var/log/squid/cache.logfile. - Add the following ACL and rule to configure that Squid allows only authenticated users to use the proxy:
acl kerb-auth proxy_auth REQUIRED http_access allow kerb-auth
acl kerb-auth proxy_auth REQUIRED http_access allow kerb-authCopy to Clipboard Copied! Toggle word wrap Toggle overflow Important
Specify these settings before thehttp_access deny allrule. - Remove the following rule to disable bypassing the proxy authentication from IP ranges specified in
localnetACLs:http_access allow localnet
http_access allow localnetCopy to Clipboard Copied! Toggle word wrap Toggle overflow - The following ACL exists in the default configuration and defines
443as a port that uses the HTTPS protocol:acl SSL_ports port 443
acl SSL_ports port 443Copy to Clipboard Copied! Toggle word wrap Toggle overflow If users should be able to use the HTTPS protocol also on other ports, add an ACL for each of these port:acl SSL_ports port port_number
acl SSL_ports port port_numberCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Update the list of
acl Safe_portsrules to configure to which ports Squid can establish a connection. For example, to configure that clients using the proxy can only access resources on port 21 (FTP), 80 (HTTP), and 443 (HTTPS), keep only the followingacl Safe_portsstatements in the configuration:acl Safe_ports port 21 acl Safe_ports port 80 acl Safe_ports port 443
acl Safe_ports port 21 acl Safe_ports port 80 acl Safe_ports port 443Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the configuration contains thehttp_access deny !Safe_portsrule that defines access denial to ports that are not defined inSafe_portsACLs. - Configure the cache type, the path to the cache directory, the cache size, and further cache type-specific settings in the
cache_dirparameter:cache_dir ufs /var/spool/squid 10000 16 256
cache_dir ufs /var/spool/squid 10000 16 256Copy to Clipboard Copied! Toggle word wrap Toggle overflow With these settings:- Squid uses the
ufscache type. - Squid stores its cache in the
/var/spool/squid/directory. - The cache grows up to
10000MB. - Squid creates
16level-1 sub-directories in the/var/spool/squid/directory. - Squid creates
256sub-directories in each level-1 directory.
If you do not set acache_dirdirective, Squid stores the cache in memory.
- If you set a different cache directory than
/var/spool/squid/in thecache_dirparameter:- Create the cache directory:
mkdir -p path_to_cache_directory
# mkdir -p path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the permissions for the cache directory:
chown squid:squid path_to_cache_directory
# chown squid:squid path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you run SELinux in
enforcingmode, set thesquid_cache_tcontext for the cache directory:semanage fcontext -a -t squid_cache_t "path_to_cache_directory(/.*)?" restorecon -Rv path_to_cache_directory
# semanage fcontext -a -t squid_cache_t "path_to_cache_directory(/.*)?" # restorecon -Rv path_to_cache_directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow If thesemanageutility is not available on your system, install the policycoreutils-python-utils package.
- Open the
3128port in the firewall:firewall-cmd --permanent --add-port=3128/tcp firewall-cmd --reload
# firewall-cmd --permanent --add-port=3128/tcp # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the
squidservice:systemctl start squid
# systemctl start squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Enable the
squidservice to start automatically when the system boots:systemctl enable squid
# systemctl enable squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification Steps
curl utility:
curl -O -L "https://www.redhat.com/index.html" --proxy-negotiate -u : -x "proxy.ad.example.com:3128"
# curl -O -L "https://www.redhat.com/index.html" --proxy-negotiate -u : -x "proxy.ad.example.com:3128"
curl does not display any error and the index.html file exists in the current directory, the proxy works.
Troubleshooting Steps
- Obtain a Kerberos ticket for the AD account:
kinit user@AD.EXAMPLE.COM
# kinit user@AD.EXAMPLE.COMCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Optionally, display the ticket:
klist
# klistCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
negotiate_kerberos_auth_testutility to test the authentication:/usr/lib64/squid/negotiate_kerberos_auth_test proxy.ad.example.com
# /usr/lib64/squid/negotiate_kerberos_auth_test proxy.ad.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the helper utility returns a token, the authentication succeeded.Token: YIIFtAYGKwYBBQUCoIIFqDC...
Token: YIIFtAYGKwYBBQUCoIIFqDC...Copy to Clipboard Copied! Toggle word wrap Toggle overflow
16.4. Configuring a Domain Blacklist in Squid Copy linkLink copied to clipboard!
Prerequisites
- Squid is configured, and users can use the proxy.
Procedure
- Edit the
/etc/squid/squid.conffile and add the following settings:acl domain_blacklist dstdomain "/etc/squid/domain_blacklist.txt" http_access deny all domain_blacklist
acl domain_blacklist dstdomain "/etc/squid/domain_blacklist.txt" http_access deny all domain_blacklistCopy to Clipboard Copied! Toggle word wrap Toggle overflow Important
Add these entries before the firsthttp_access allowstatement that allows access to users or clients. - Create the
/etc/squid/domain_blacklist.txtfile and add the domains you want to block. For example, to block access toexample.comincluding subdomains and to blockexample.net, add:.example.com example.net
.example.com example.netCopy to Clipboard Copied! Toggle word wrap Toggle overflow Important
If you referred to the/etc/squid/domain_blacklist.txtfile in the squid configuration, this file must not be empty. If the file is empty, Squid fails to start. - Restart the
squidservice:systemctl restart squid
# systemctl restart squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow
16.5. Configuring the Squid Service to Listen on a Specific Port or IP Address Copy linkLink copied to clipboard!
3128 port on all network interfaces. This section describes how to change the port and configuring Squid to listen on a specific IP address.
Prerequisites
- Squid is installed.
Procedure
- Edit the
/etc/squid/squid.conffile:- To set the port on which the Squid service listens, set the port number in the
http_portparameter. For example, to set the port to8080, set:http_port 8080
http_port 8080Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To configure on which IP address the Squid service listens, set the IP address and port number in the
http_portparameter. For example, to configure that Squid listens only on the192.0.2.1IP address on port3128, set:http_port 192.0.2.1:3128
http_port 192.0.2.1:3128Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Add multiplehttp_portparameters to the configuration file to configure that Squid listens on multiple ports and IP addresses:http_port 192.0.2.1:3128 http_port 192.0.2.1:8080
http_port 192.0.2.1:3128 http_port 192.0.2.1:8080Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If you configured that Squid uses a different port as the default (
3128):- Open the port in the firewall:
firewall-cmd --permanent --add-port=port_number/tcp firewall-cmd --reload
# firewall-cmd --permanent --add-port=port_number/tcp # firewall-cmd --reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow - If you run SELinux in
enforcingmode, assign the port to thesquid_port_tport type definition:semanage port -a -t squid_port_t -p tcp port_number
# semanage port -a -t squid_port_t -p tcp port_numberCopy to Clipboard Copied! Toggle word wrap Toggle overflow If thesemanageutility is not available on your system, install the policycoreutils-python-utils package.
- Restart the
squidservice:systemctl restart squid
# systemctl restart squidCopy to Clipboard Copied! Toggle word wrap Toggle overflow
16.6. Additional Resources Copy linkLink copied to clipboard!
- See the
/usr/share/doc/squid-<version>/squid.conf.documentedfile for a list of all configuration parameters you can set in the/etc/squid/squid.conffile together with a detailed description.
Appendix A. Red Hat Customer Portal Labs Relevant to Networking Copy linkLink copied to clipboard!
Bridge Configuration
Network Bonding Helper
Packet capture syntax generator
tcpdump command that selects an interface and then prints information to the console. You need root access to enter the command.
Appendix B. Revision History Copy linkLink copied to clipboard!
| Revision History | |||
|---|---|---|---|
| Revision 0.10-06 | Tue 03 Mar 2020 | ||
| |||
| Revision 0.10-05 | Fri 22 Nov 2019 | ||
| |||
| Revision 0.10-04 | Tue 06 Aug 2019 | ||
| |||
| Revision 0.10-03 | Thu 22 Mar 2018 | ||
| |||
| Revision 0.10-02 | Mon 14 Aug 2017 | ||
| |||
| Revision 0.10-01 | Tue 25 Jul 2017 | ||
| |||
| Revision 0.9-30 | Tue 18 Oct 2016 | ||
| |||
| Revision 0.9-25 | Wed 11 Nov 2015 | ||
| |||
| Revision 0.9-15 | Tue 17 Feb 2015 | ||
| |||
| Revision 0.9-14 | Fri Dec 05 2014 | ||
| |||
| Revision 0.9-12 | Wed Nov 05 2014 | ||
| |||
| Revision 0.9-11 | Tues Oct 21 2014 | ||
| |||
| Revision 0.9-9 | Tue Sep 2 2014 | ||
| |||
| Revision 0.9-8 | Tue July 8 2014 | ||
| |||
| Revision 0-0 | Wed Dec 12 2012 | ||
| |||
B.1. Acknowledgments Copy linkLink copied to clipboard!
Index Copy linkLink copied to clipboard!
Symbols
- /etc/named.conf (see BIND)
A
- authoritative name server (see BIND)
B
- Berkeley Internet Name Domain (see BIND)
- BIND
- additional resources, Online Resources
- installed documentation, Installed Documentation
- common mistakes, Common Mistakes to Avoid
- configuration
- acl statement, Common Statement Types
- comment tags, Comment Tags
- controls statement, Other Statement Types
- include statement, Common Statement Types
- key statement, Other Statement Types
- logging statement, Other Statement Types
- options statement, Common Statement Types
- server statement, Other Statement Types
- trusted-keys statement, Other Statement Types
- view statement, Other Statement Types
- zone statement, Common Statement Types
- directories
- /etc/named/, Configuring the named Service
- /var/named/, Editing Zone Files
- /var/named/data/, Editing Zone Files
- /var/named/dynamic/, Editing Zone Files
- /var/named/slaves/, Editing Zone Files
- features
- Automatic Zone Transfer (AXFR), Incremental Zone Transfers (IXFR)
- DNS Security Extensions (DNSSEC), DNS Security Extensions (DNSSEC)
- Incremental Zone Transfer (IXFR), Incremental Zone Transfers (IXFR)
- Internet Protocol version 6 (IPv6), Internet Protocol version 6 (IPv6)
- multiple views, Multiple Views
- Transaction SIGnature (TSIG), Transaction SIGnatures (TSIG)
- files
- /etc/named.conf, Configuring the named Service, Configuring the Utility
- /etc/rndc.conf, Configuring the Utility
- /etc/rndc.key, Configuring the Utility
- resource record, Name server Zones
- types
- authoritative name server, Name server Types
- primary (master) name server, Name server Zones, Name server Types
- recursive name server, Name server Types
- secondary (slave) name server, Name server Zones, Name server Types
- utilities
- zones
- $INCLUDE directive, Common Directives
- $ORIGIN directive, Common Directives
- $TTL directive, Common Directives
- A (Address) resource record, Common Resource Records
- CNAME (Canonical Name) resource record, Common Resource Records
- comment tags, Comment Tags
- description, Name server Zones
- example usage, A Simple Zone File, A Reverse Name Resolution Zone File
- MX (Mail Exchange) resource record, Common Resource Records
- NS (Nameserver) resource record, Common Resource Records
- PTR (Pointer) resource record, Common Resource Records
- SOA (Start of Authority) resource record, Common Resource Records
- bonding (see channel bonding)
C
- channel bonding
- configuration, Using Channel Bonding
- description, Using Channel Bonding
- parameters to bonded interfaces, Bonding Module Directives
- channel bonding interface (see kernel module)
D
- DHCP, DHCP Servers
- additional resources, Additional Resources
- command-line options, Starting and Stopping the Server
- dhcpd.conf, Configuration File
- dhcpd.leases, Starting and Stopping the Server
- dhcpd6.conf, DHCP for IPv6 (DHCPv6)
- DHCPv6, DHCP for IPv6 (DHCPv6)
- dhcrelay, DHCP Relay Agent
- global parameters, Configuration File
- group, Configuration File
- options, Configuration File
- reasons for using, Why Use DHCP?
- Relay Agent, DHCP Relay Agent
- server configuration, Configuring a DHCP Server
- shared-network, Configuration File
- starting the server, Starting and Stopping the Server
- stopping the server, Starting and Stopping the Server
- subnet, Configuration File
- dhcpd.conf, Configuration File
- dhcpd.leases, Starting and Stopping the Server
- dhcrelay, DHCP Relay Agent
- dig (see BIND)
- DNS
- definition, DNS Servers
- (see also BIND)
- Dynamic Host Configuration Protocol (see DHCP)
K
- kernel module
- bonding module, Using Channel Bonding
- description, Using Channel Bonding
- parameters to bonded interfaces, Bonding Module Directives
- module parameters
- bonding module parameters, Bonding Module Directives
M
- Multihomed DHCP
- host configuration, Host Configuration
- server configuration, Configuring a Multihomed DHCP Server
N
- name server (see DNS)
- named (see BIND)
- NIC
- binding into single channel, Using Channel Bonding
P
- primary name server (see BIND)
R
- recursive name server (see BIND)
- resource record (see BIND)
- rndc (see BIND)
- root name server (see BIND)
S
- secondary name server (see BIND)