2.1.3. Selecting Network Configuration Methods
- To configure an interface using NetworkManager's text user interface tool, nmtui, proceed to Section 2.2, “Using the Text User Interface, nmtui”
- To configure an interface using NetworkManager's command-line tool, nmcli, proceed to Section 2.3, “Using the NetworkManager Command Line Tool, nmcli”
- To configure a network interface manually, see Section 2.4, “Using the Command Line Interface (CLI)”.
- To configure a network using graphical user interface tools, proceed to Section 2.5, “Using NetworkManager with the GNOME Graphical User Interface”
2.2. Using the Text User Interface, nmtui
The text user interface tool nmtui can be used to configure an interface in a terminal window. Issue the following command to start the tool:
~]$ nmtui
The text user interface appears. Any invalid command prints a usage message.
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.
2.3. Using the NetworkManager Command Line Tool, nmcli
The command‐line tool nmcli can be used by both users and scripts for controlling NetworkManager. The basic format of a command is as follows:
nmcliwhere OBJECT can be one ofOPTIONS
OBJECT {COMMAND
| help }
general
, networking
, radio
, connection
, or device
. The most used options are: -t, --terse
for use in scripts, the -p, --pretty
option for users, and the -h, --help
option. Command completion has been implemented for nmcli, so remember to press Tab whenever you are unsure of the command options available. See the nmcli(1)
man page for a complete list of the options and commands.
The nmcli tool has some built-in context-sensitive help. For example, issue the following two commands and notice the difference:
~]$ nmcli help
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }
OPTIONS
-t[erse] terse output
-p[retty] pretty output
-m[ode] tabular|multiline output mode
-f[ields] <field1,field2,...>|all|common specify fields to output
-e[scape] yes|no escape columns separators in values
-n[ocheck] don't check nmcli and NetworkManager versions
-a[sk] ask for missing parameters
-w[ait] <seconds> set timeout waiting for finishing operations
-v[ersion] show program version
-h[elp] print this help
OBJECT
g[eneral] NetworkManager's general status and operations
n[etworking] overall networking control
r[adio] NetworkManager radio switches
c[onnection] NetworkManager's connections
d[evice] devices managed by NetworkManager
~]$ nmcli general help
Usage: nmcli general { COMMAND | help }
COMMAND := { status | hostname | permissions | logging }
status
hostname [<hostname>]
permissions
logging [level <log level>] [domains <log domains>]
In the second example above the help is related to the object general
.
The
nmcli-examples(5)
man page has many useful examples. A brief selection is shown here:
To show the overall status of NetworkManager:
nmcli general status
To control NetworkManager logging:
nmcli general loggingTo show all connections:
nmcli connection show
To show only currently active connections, add the
-a, --active
option as follows: nmcli connection show --active
To show devices recognized by NetworkManager and their state:
nmcli device status
Commands can be shortened and some options omitted. For example the command:
nmcli connection modify id 'MyCafe' 802-11-wireless.mtu 1350
Can be reduced to the following command:
nmcli con mod MyCafe 802-11-wireless.mtu 1350
The
id
option can be omitted because the connection ID (name) is unambiguous for nmcli in this case. As you become familiar with the commands, further abbreviations can be made. For example: nmcli connection add type ethernetcan be reduced to:
nmcli c a type eth
Note
Remember to use tab completion when in doubt.
Starting and Stopping an Interface Using nmcli
The nmcli tool can be used to start and stop any network interface, including masters. For example:
nmcli con up id bond0 nmcli con up id port0 nmcli dev disconnect iface bond0 nmcli dev disconnect iface ens3
Note
It is recommended to use
nmcli dev disconnect iface iface-name
rather than nmcli con down id id-string
because disconnection places the interface into a “manual” mode, in which no automatic connection will be started until the user tells
NetworkManager to start a connection or until an external event like a carrier change, hibernate, or sleep, occurs.
The nmcli Interactive Connection Editor
The nmcli tool has an interactive connection editor. To use it, enter the following command:
~]$ nmcli con edit
You will be prompted to enter a valid connection type from the list
displayed. After entering a connection type you will be placed at the nmcli prompt. If you are familiar with the connection types you can add a valid connection 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
For adding and editing a new connection profile, the following format applies:
nmcli con edit [type new-connection-type] [con-name new-connection-name]
Type
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. The format is as follows: describe setting.property
For example:
nmcli> describe team.config
2.3.1. Understanding the nmcli Options
Many of the nmcli commands are self-explanatory, however a few command options are worth a moments study:
type
— The 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. Press Tab to see a list of them or see theTYPE_SPECIFIC_OPTIONS
list in thenmcli(1)
man page. Thetype
option is applicable after the following:nmcli connection add
andnmcli connection edit
. con-name
— The name assigned to a connection profile.- If you do not specify a connection name, one will be generated as follows:
type
-ifname[-number]The connection name is the name of a connection profile and should not be confused with the interface name that denotes a device (wlan0, ens3, em1, and so on). Users can however 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. Theid
option also refers to the connection profile name. id
— An identification string assigned by the user to a connection profile.- The ID can be used in
nmcli connection
commands to identify a connection. The NAME field in the output always denotes the connection ID (name). It refers to the same connection profile name that thecon-name
does. uuid
— A unique identification string assigned by the system to a connection profile.- The UUID can be used in
nmcli connection
commands to identify a connection.
2.3.2. Connecting to a Network Using nmcli
To list the currently available network connections, issue a command as follows:
~]$ 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 wlan0
Note that the 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 wlan0.
Adding an Ethernet connection means creating a configuration profile
which is then assigned to a device. Before creating a new profile,
review the available devices as follows:
~]$ nmcli dev status
DEVICE TYPE STATE CONNECTION
ens3 ethernet disconnected --
ens9 ethernet disconnected --
lo loopback unmanaged --
Adding a Dynamic Ethernet Connection
To add an Ethernet configuration profile with dynamic
IP
configuration, allowing DHCP
to assign the network configuration, a command in the following format can be used: nmcli connection add type ethernet con-name connection-name ifname interface-name
For example, to create a dynamic connection profile named my-office, issue a command as follows:
~]$ nmcli con add type ethernet con-name my-office ifname ens3
Connection 'my-office' (fb157a65-ad32-47ed-858c-102a48e064a2) successfully added.
NetworkManager will set its internal parameter connection.autoconnect
to yes
. NetworkManager will also write out settings to /etc/sysconfig/network-scripts/ifcfg-my-office
where the ONBOOT directive will be set to yes
.
Note that manual changes to the ifcfg file will not be noticed by NetworkManager until the interface is next brought up. See Section 1.9, “Network Configuration Using sysconfig Files” for more information on using configuration files.
To bring up the Ethernet connection, issue a command as follows:
~]$ nmcli con up my-office
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
Review the status of the devices and connections:
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens3 ethernet connected my-office
ens9 ethernet disconnected --
lo loopback unmanaged --
To change the host name sent by a host to a
DHCP
server, modify the dhcp-hostname
property as follows:
~]$ nmcli con modify my-office my-office ipv4.dhcp-hostname host-name ipv6.dhcp-hostname host-name
To change the
IPv4
client ID sent by a host to a DHCP
server, modify the dhcp-client-id
property as follows:
~]$ nmcli con modify my-office my-office ipv4.dhcp-client-id client-ID-string
There is no dhcp-client-id
property for IPv6
, dhclient creates an identifier for IPv6
. See the dhclient(8)
man page for details.
To ignore the
DNS
servers sent to a host by a DHCP
server, modify the ignore-auto-dns
property as follows:
~]$ nmcli con modify my-office my-office ipv4.ignore-auto-dns yes ipv6.ignore-auto-dns yes
See the
nm-settings(5)
man page for more information on properties and their settings.
Example 2.1. Configuring a Dynamic Ethernet Connection Using the Interactive Editor
To configure a dynamic Ethernet connection using the interactive editor, issue commands as follows:
~]$ nmcli con edit type ethernet con-name ens3
===| nmcli interactive connection editor |===
Adding a new '802-3-ethernet' connection
Type 'help' or '?' for available commands.
Type 'describe [<setting>.<prop>]' for detailed property description.
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb
nmcli> describe ipv4.method
=== [method] ===
[NM property description]
IPv4 configuration method. If 'auto' is specified then the appropriate automatic method (DHCP, PPP, etc) is used for the interface and most other properties can be left unset. If 'link-local' is specified, then a link-local address in the 169.254/16 range will be assigned to the interface. If 'manual' is specified, static IP addressing is used and at least one IP address must be given in the 'addresses' property. If 'shared' is specified (indicating that this connection will provide network access to other computers) then the interface is assigned an address in the 10.42.x.1/24 range and a DHCP and forwarding DNS server are started, and the interface is NAT-ed to the current default network connection. 'disabled' means IPv4 will not be used on this connection. This property must be set.
nmcli> set ipv4.method auto
nmcli> save
Saving the connection with 'autoconnect=yes'. That might result in an immediate activation of the connection.
Do you still want to save? [yes] yes
Connection 'ens3' (090b61f7-540f-4dd6-bf1f-a905831fc287) successfully saved.
nmcli> quit
~]$
The default action is to save the connection profile as
persistent. If required, the profile can be held in memory only, until
the next restart, by means of the save temporary
command.
Adding a Static Ethernet Connection
To add an Ethernet connection with static
IPv4
configuration, a command in the following format can be used: 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.
For example, a command to create a static Ethernet connection with only
IPv4
address and gateway is as follows:
~]$Optionally, at the same time specifynmcli 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 as follows:
~]$NetworkManager will set its internal parameternmcli 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.method
to manual
and 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 will be set to yes
.
Note that manual changes to the ifcfg file will not be noticed by NetworkManager until the interface is next brought up. See Section 1.9, “Network Configuration Using sysconfig Files” for more information on using configuration files.
To set two
IPv4
DNS
server addresses:
~]$ nmcli con mod test-lab ipv4.dns "8.8.8.8 8.8.4.4"
Note that this will replace any previously set DNS
servers. To set two IPv6
DNS
server addresses:
~]$ nmcli con mod test-lab ipv6.dns "2001:4860:4860::8888 2001:4860:4860::8844"
Note that this will replace any previously set DNS
servers. Alternatively, to add additional DNS
servers to any previously set, use the +
prefix as follows:
~]$ 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"
To bring up the new Ethernet connection, issue a command as follows:
~]$ nmcli con up test-lab ifname ens9
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
Review the status of the devices and connections:
~]$ nmcli device status
DEVICE TYPE STATE CONNECTION
ens3 ethernet connected my-office
ens9 ethernet connected test-lab
lo loopback unmanaged --
To view detailed information about the newly configured connection, issue a command as follows:
~]$ nmcli -p con show test-lab
===============================================================================
Connection profile details (test-lab)
===============================================================================
connection.id: test-lab
connection.uuid: 05abfd5e-324e-4461-844e-8501ba704773
connection.interface-name: ens9
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.timestamp: 1410428968
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.secondaries:
connection.gateway-ping-timeout: 0
[output truncated]
The use of the -p, --pretty
option adds a title banner and section breaks to the output.
Example 2.2. Configuring a Static Ethernet Connection Using the Interactive Editor
To configure a static Ethernet connection using the interactive editor, issue commands as follows:
~]$ nmcli con edit type ethernet con-name ens3
===| nmcli interactive connection editor |===
Adding a new '802-3-ethernet' connection
Type 'help' or '?' for available commands.
Type 'describe [>setting<.>prop<]' for detailed property description.
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb
nmcli> set ipv4.addresses 192.168.122.88/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]: yes nmcli> nmcli> save temporary
Saving the connection with 'autoconnect=yes'. That might result in an immediate activation of the connection. Do you still want to save? [yes] no
nmcli> save
Saving the connection with 'autoconnect=yes'. That might result in an immediate activation of the connection. Do you still want to save? [yes] yes Connection 'ens3' (704a5666-8cbd-4d89-b5f9-fa65a3dbc916) successfully saved.
nmcli> quit ~]$The default action is to save the connection profile as persistent. If required, the profile can be held in memory only, until the next restart, by means of the
save temporary
command.
Locking a Profile to a Specific Device
To lock a profile to a specific interface device, the commands used
in the examples above include the interface name. For example:
nmcli connection add type ethernet con-name connection-name ifname interface-nameTo make a profile usable for all compatible Ethernet interfaces, issue a command as follows:
nmcli connection add type ethernet con-name connection-name ifname "*"
Note that you have to use the
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.
To lock a profile to a specific MAC address, use a command in the following format:
nmcli connection add type ethernet con-name "connection-name" ifname "*" mac 00:00:5E:00:53:00
Adding a Wi-Fi Connection
To view the available Wi-Fi access points, issue a command as follows:
~]$ nmcli dev wifi list
SSID MODE CHAN RATE SIGNAL BARS SECURITY
FedoraTest Infra 11 54 MB/s 98 ▂▄▆█ WPA1
Red Hat Guest Infra 6 54 MB/s 97 ▂▄▆█ WPA2
Red Hat Infra 6 54 MB/s 77 ▂▄▆_ WPA2 802.1X
* Red Hat Infra 40 54 MB/s 66 ▂▄▆_ WPA2 802.1X
VoIP Infra 1 54 MB/s 32 ▂▄__ WEP
MyCafe Infra 11 54 MB/s 39 ▂▄__ WPA2
To create a Wi-Fi connection profile with static
IP
configuration, but allowing automatic DNS
address assignment, issue a command as follows: ~]$nmcli con add con-name MyCafe ifname wlan0 type wifi ssid MyCafe \
ip4 192.168.100.101/24 gw4 192.168.100.1
To set a WPA2 password, for example “caffeine”, issue commands as follows: ~]$nmcli con modify MyCafe wifi-sec.key-mgmt wpa-psk
~]$nmcli con modify MyCafe wifi-sec.psk caffeine
See the Red Hat Enterprise Linux 7 Security Guide for information on password security.
To change Wi-Fi state, issue a command in the following format:
~]$ nmcli radio wifi [on | off ]
Changing a Specific Property
To check a specific property, for example
mtu
, issue a command as follows:
~]$ nmcli connection show id 'MyCafe' | grep mtu
802-11-wireless.mtu: auto
To change the property of a setting, issue a command as follows:
~]$ nmcli connection modify id 'MyCafe' 802-11-wireless.mtu 1350
To verify the change, issue a command as follows:
~]$ nmcli connection show id 'MyCafe' | grep mtu
802-11-wireless.mtu: 1350
Note that NetworkManager refers to parameters such as
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.
2.3.3. Configuring Static Routes Using nmcli
To configure static routes using the nmcli tool, the command line or the interactive editor mode can be used.
Example 2.3. Configuring Static Routes Using nmcli
To configure a static route for an existing Ethernet connection using the command line, enter a command as follows:
~]# nmcli connection modify eth0 +ipv4.routes "192.168.122.0/24 10.10.10.1"
This will direct traffic for the 192.168.122.0/24
subnet to the gateway at 10.10.10.1
Example 2.4. Configuring Static Routes Using nmcli Editor
To configure a static route for an Ethernet connection using the interactive editor, issue commands as follows:
~]$ nmcli con edit type ethernet con-name ens3
===| nmcli interactive connection editor |===
Adding a new '802-3-ethernet' connection
Type 'help' or '?' for available commands.
Type 'describe [>setting<.>prop<]' for detailed property description.
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, ipv4, ipv6, dcb
nmcli> set ipv4.routes 192.168.122.0/24 10.10.10.1
nmcli>
nmcli> save persistent
Saving the connection with 'autoconnect=yes'. That might result in an immediate activation of the connection.
Do you still want to save? [yes] yes
Connection 'ens3' (704a5666-8cbd-4d89-b5f9-fa65a3dbc916) successfully saved.
nmcli> quit
~]$
2.4. Using the Command Line Interface (CLI)
2.4.1. Configuring a Network Interface Using ifcfg Files
Interface configuration files control the software interfaces for
individual network devices. As the system boots, it uses these files to
determine what interfaces to bring up and how to configure them. These
files are usually named
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.
Static Network Settings
To configure an interface with static network settings using
ifcfg
files, for an interface with the name eth0, create a file with name ifcfg-eth0
in the /etc/sysconfig/network-scripts/
directory as follows:
DEVICE=eth0 BOOTPROTO=none ONBOOT=yes PREFIX=24 IPADDR=10.0.1.27Optionally specify the hardware or MAC address using the
HWADDR
directive. Note that this may influence the device naming procedure as explained in Chapter 8, Consistent Network Device Naming. You do not need to specify the network or broadcast address as this is calculated automatically by ipcalc.
Dynamic Network Settings
To configure an interface with dynamic network settings using
ifcfg
files, for an interface with name em1, create a file with name ifcfg-em1
in the /etc/sysconfig/network-scripts/
directory as follows:
DEVICE=em1 BOOTPROTO=dhcp ONBOOT=yesOptionally specify the hardware or MAC address using the
HWADDR
directive. Note that this may influence the device naming procedure as explained in Chapter 8, Consistent Network Device Naming.
To configure an interface to send a different host name to the
DHCP
server, add the following line to the ifcfg
file. DHCP_HOSTNAME=hostname
To configure an interface to ignore routes sent by a
DHCP
server, add the following line to the ifcfg
file. PEERDNS=noThis will prevent network service from updating
/etc/resolv.conf
with the DNS
servers received from a DHCP
server.
To configure an interface to use particular
DNS
servers, set PEERDNS=no
as described above and add lines as follows to the ifcfg
file:
DNS1=ip-address DNS2=ip-addresswhere ip-address is the address of a
DNS
server. This will cause the network service to update /etc/resolv.conf
with the DNS
servers specified.
NetworkManager will by default call the
DHCP
client, dhclient, when a profile has been set to obtain addresses automatically, or when an interface configuration file has BOOTPROTO set to dhcp
. Where DHCP
is required, an instance of dhclient
is started for every Internet protocol, IPv4
and IPv6
, on an interface. Where NetworkManager is not running, or not managing an interface, then the legacy network service will call instances of dhclient
as required.
Configuring a DHCP Client
2.4.2. Configuring a Network Interface Using ip Commands
The ip utility can be used to assign
IP
addresses to an interface. The command takes the following form: ip addr [ add | del ] address dev ifname
Assigning a Static Address Using ip Commands
To assign an
IP
address to an interface, issue a command as root
as follows:
~]#Further examples and command options can be found in theip address add 10.0.0.3/24 dev eth0
The address assignment of a specific device can be viewed as follows: ~]#ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether f0:de:f1:7b:6e:5f brd ff:ff:ff:ff:ff:ff inet 10.0.0.3/24 brd 10.0.0.255 scope global global eth0 valid_lft 58682sec preferred_lft 58682sec inet6 fe80::f2de:f1ff:fe7b:6e5f/64 scope link valid_lft forever preferred_lft forever
ip-address(8)
manual page.
Configuring Multiple Addresses Using ip Commands
As the ip utility
supports assigning multiple addresses to the same interface it is no
longer necessary to use the alias interface method of binding multiple
addresses to the same interface. The ip command to assign an address can be repeated multiple times in order to assign multiple address. For example:
~]#ip address add 192.168.2.223/24 dev eth1
~]#ip address add 192.168.4.223/24 dev eth1
~]#ip addr
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 52:54:00:fb:77:9e brd ff:ff:ff:ff:ff:ff inet 192.168.2.223/24 scope global eth1 inet 192.168.4.223/24 scope global eth1
The commands for the ip utility are documented in the
ip(8)
manual page.
Note
ip commands given on the command line will not persist after a system restart.
2.4.3. Static Routes and the Default Gateway
Static routes are for traffic that must not, or should not, go
through the default gateway. Routing is often handled by devices on the
network dedicated to routing (although any device can be configured to
perform routing). Therefore, it is often not necessary to configure
static routes on Red Hat Enterprise Linux servers or clients. Exceptions
include traffic that must pass through an encrypted VPN tunnel or
traffic that should take a specific route for reasons of cost or
security. 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. The default gateway is traditionally a
dedicated network router.
Note
To expand your expertise, you might also be interested in the Red Hat System Administration I (RH124) training course.
Configuring Static Routes Using the Command Line
If static routes are required, they can be added to the routing table by means of the
ip route add
command and removed using the ip route del
command. The more frequently used ip route
commands take the following form: ip route [ add | del | change | append | replace ] destination-address
See the ip-route(8)
man page for more details on the options and formats.
Use the
ip route
command without options to display the IP
routing table. For example:
~]$ 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 eth0 proto kernel scope link src 192.168.122.126
To add a static route to a host address, in other words to a single
IP
address, issue a command as root
:
ip route add 192.0.2.1 via 10.0.0.1 [dev
ifname]
Where 192.0.2.1 is the IP
address of the host in dotted decimal notation, 10.0.0.1 is the next hop address and ifname is the exit interface leading to the next hop.
To add a static route to a network, in other words to an
IP
address representing a range of IP
addresses, issue the following command as root
:
ip route add 192.0.2.0/24 via 10.0.0.1 [dev
ifname]
where 192.0.2.0 is the 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.
Static route configuration can be stored per-interface in a
/etc/sysconfig/network-scripts/route-interface
file. For example, static routes for the eth0 interface would be stored in the /etc/sysconfig/network-scripts/route-eth0
file. The route-interface
file has two formats: ip command arguments and network/netmask directives. These are described below.
See the
ip-route(8)
man page for more information on the ip route
command.
Configuring The Default Gateway
The default gateway is determined by the network scripts which parse the
/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.
The default route can thus be indicated by means of the GATEWAY
directive, either globally or in interface-specific configuration files.
However, in Red Hat Enterprise Linux the use of the global
/etc/sysconfig/network
file is deprecated, and specifying the gateway should now only be done in per-interface configuration files.
In dynamic network environments, where mobile hosts are managed by NetworkManager, gateway information is likely to be interface specific and is best left to be assigned by
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.
2.4.4. Configuring Static Routes in ifcfg files
Static routes set using ip
commands at the command prompt will be lost if the system is shutdown
or restarted. To configure static routes to be persistent after a system
restart, they must be placed in per-interface configuration files in
the
/etc/sysconfig/network-scripts/
directory. The file name should be of the format route-ifname
. There are two types of commands to use in the configuration files; ip commands as explained in Section 2.4.4.1, “Static Routes Using the IP Command Arguments Format” and the Network/Netmask format as explained in Section 2.4.4.2, “Network/Netmask Directives Format”.
2.4.4.1. Static Routes Using the IP Command Arguments Format
If required in a per-interface configuration file, for example
/etc/sysconfig/network-scripts/route-eth0
, define a route to a default gateway on the first line. This is only required if the gateway is not set via DHCP
and is not set globally in the /etc/sysconfig/network
file:
default via 192.168.1.1 dev
interface
where 192.168.1.1 is the
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.
If a route to a remote network is required, a static route can be
specified as follows. Each line is parsed as an individual route:
10.10.10.0/24 via 192.168.1.1 [dev
interface]
where 10.10.10.0/24 is the network address and prefix length of the remote or destination network. The address 192.168.1.1 is the
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.
The following is an example of a
route-interface
file using the ip command arguments format. The default gateway is 192.168.0.1
, interface eth0 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 eth0 10.10.10.0/24 via 192.168.0.10 dev eth0 172.16.1.10/32 via 192.168.0.10 dev eth0
In the above example, packets going to the local
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.
Specifying an exit interface is optional. It can be useful if you
want to force traffic out of a specific interface. For example, in the
case of a VPN, you can force traffic to a remote network to pass through
a tun0 interface even when the interface is in a different subnet to the destination network.
Important
If the default gateway is already assigned by
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.
2.4.4.2. Network/Netmask Directives Format
You can also use the network/netmask directives format for
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
is the network address of the remote network or host to be reached.NETMASK0=255.255.255.0
is the netmask for the network address defined withADDRESS0=10.10.10.0
.GATEWAY0=192.168.1.1
is the default gateway, or anIP
address that can be used to reachADDRESS0=10.10.10.0
The following is an example of a
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=10.10.10.0 NETMASK0=255.255.255.0 GATEWAY0=192.168.0.10 ADDRESS1=172.16.1.10 NETMASK1=255.255.255.0 GATEWAY1=192.168.0.10
Subsequent static routes must be numbered sequentially, and must not skip any values. For example,
ADDRESS0
, ADDRESS1
, ADDRESS2
, and so on.
2.5. Using NetworkManager with the GNOME Graphical User Interface
In Red Hat Enterprise Linux 7, NetworkManager
does not have its own graphical user interface (GUI). The network
connection icon on the top right of the desktop is provided as part of
the GNOME Shell and the Network settings configuration tool is provided as part of the new GNOME control-center GUI. The old nm-connection-editor GUI is still available for certain tasks.
2.5.1. Connecting to a Network Using a GUI
There are two ways to access the Network settings window of the control-center application:
- Press the Super key to enter the Activities Overview, type
control network
, as seen in Figure 2.2, “The Network utility being selected in GNOME” and then press Enter. The Network settings tool appears. Proceed to Section 2.5.2, “Configuring New and Editing Existing Connections”. - Click on the GNOME Shell network connection icon in the top right-hand corner of the screen to open its menu.
When you click on the GNOME Shell network connection icon, you are presented with:
- 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.
If you are connected to a network, this is indicated by the symbolic ON
button. Clicking anywhere on the level of the button will toggle the
state of the button. If you change the button from ON to OFF you will
disconnect that network connection.
Click Network Settings. The Network settings tool appears. Proceed to Section 2.5.2, “Configuring New and Editing Existing Connections”.
2.5.2. Configuring New and Editing Existing Connections
The Network settings window shows the connection status, its type and interface, its
IP
address and routing details, and so on.
The Network settings
window has a menu on the left-hand side showing the available network
devices or interfaces. This includes software interfaces such as for
VLANs, bridges, bonds, and teams. On the right-hand side, the connection profiles
are shown for the selected network device or interface. A profile is a
named collection of settings that can be applied to an interface. Below
that is a plus and a minus button for adding and deleting new network
connections, and on the right a gear wheel icon will appear for editing
the connection details of the selected network device or VPN connection.
To add a new connection, click the plus symbol to open the Add Network Connection window and proceed to Section 2.5.2.1, “Configuring a New Connection”.
Editing an Existing Connection
Clicking on the gear wheel icon of an existing connection profile in the Network settings window opens the Network details window, from where you can perform most network configuration tasks such as
IP
addressing, DNS
, and routing configuration.
2.5.2.1. Configuring a New Connection
In the Network settings window, click the plus sign below the menu to open the Add Network Connection window. This displays a list of connection types that can be added.
Then, to configure:
- Bond connections, click the Bond entry and proceed to Section 4.6.1, “Establishing a Bond Connection”;
- Bridge connections, click the Bridge entry and proceed to Section 6.4.1, “Establishing a Bridge Connection”;
- VLAN connections, click the VLAN entry and proceed to Section 7.5.1, “Establishing a VLAN Connection”; or,
- Team connections, click the Team entry and proceed to Section 5.13, “Creating a Network Team Using a GUI”.
2.5.3. Connecting to a Network Automatically
For any connection type you add or configure, you can choose whether you want NetworkManager to try to connect to that network automatically when it is available.
Procedure 2.1. Configuring NetworkManager to Connect to a Network Automatically When Detected
- Press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network settings tool appears. - Select the network interface from the left-hand-side menu.
- Click on the gear wheel icon of a connection profile on the right-hand side menu. If you have only one profile associated with the selected interface the gear wheel icon will be in the lower right-hand-side corner. The Network details window appears.
- Select the Identity menu entry on the left. The Network window changes to the identity view.
- 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.
2.5.4. System-wide and Private Connection Profiles
NetworkManager stores all connection profiles. A profile is a named collection of settings that can be applied to an interface. NetworkManager stores these connection profiles for system-wide use (system connections), as well as all user connection profiles. Access to the connection profiles is controlled by permissions which are stored by NetworkManager. See the
nm-settings(5)
man page for more information on the connection
settings permissions
property. The permissions correspond to the 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"This can also be set using graphical user interface tools. In nm-connection-editor, there is the corresponding All users may connect to this network check box on the General tab, and in the GNOME control-center Network settings Identity window, there is the Make available to other users check box.
NetworkManager's
default policy is to allow all users to create and modify system-wide
connections. Profiles that should be available at boot time cannot be
private because they will not be visible until the user logs in. For
example, if user
user
creates a connection profile 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.
To restrict connections and networking, there are two options which can be used alone or in combination:
The combination of these two options provides fine-grained security and control over networking. See the
- 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.
Note that VPN connections are always created as private-per-user, since they are assumed to be more private than a Wi-Fi or Ethernet connection.
Procedure 2.2. Changing a Connection to Be User-specific Instead of System-Wide, or Vice Versa
Depending on the system's policy, you may need root privileges on
the system in order to change whether a connection is user-specific or
system-wide.
- Press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network settings tool appears. - Select the network interface from the left-hand-side menu.
- Click on the gear wheel icon of a connection profile on the right-hand side menu. If you have only one profile associated with the selected interface the gear wheel icon will be in the lower right-hand-side corner. The Network details window appears.
- Select the Identity menu entry on the left. The Network window changes to the identity view.
- Select the Make available to other users check box to cause NetworkManager to make the connection available system-wide.Conversely, clear the Make available to other users check box to make the connection user-specific.
2.5.5. Configuring a Wired (Ethernet) Connection
To configure a wired network connection, press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network settings tool appears.
Select the Wired network interface from the left-hand-side menu 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. You can edit the default Wired profile by clicking the gear wheel icon. You can create a new wired connection profile by clicking the Add Profile button. Connection profiles associated with a selected interface are shown on the right-hand side menu.
When you add a new connection by clicking the NetworkManager
creates a new configuration file for that connection and then opens the
same dialog that is used for editing an existing connection. The
difference between these dialogs is that an existing connection profile
has a Details and Reset
menu entry. In effect, you are always editing a connection profile; the
difference only lies in whether that connection previously existed or
was just created by NetworkManager when you clicked .
button, 2.5.5.1. Configuring the Connection Name, Auto-Connect Behavior, and Availability Settings
Many settings in the Editing dialog are common to all connection types, see the Identity view (or the General tab if using nm-connection-editor):
- 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
1500
and does not generally need to be specified or changed. - Firewall Zone — If required, select a different firewall zone to apply. See the Red Hat Enterprise Linux 7 Security Guide for more information on firewall zones.
- Connect Automatically — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See Section 2.5.3, “Connecting to a Network Automatically” 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 2.5.4, “System-wide and Private Connection Profiles” for details.
- Automatically connect to VPN when using this connection — Select this box if you want NetworkManager to auto-connect to the selected VPN connection when this connection profile is connected. Select the VPN from the drop-down menu.
Saving Your New (or Modified) Connection and Making Further Configurations
Once you have finished editing your wired connection, click the NetworkManager apply the changes. If the profile is OFF, set it to ON or select it in the network connection icon's menu. See Section 2.5.1, “Connecting to a Network Using a GUI” for information on using your new or altered connection.
button to save your customized configuration. If the profile was in use while being edited, power cycle the connection to make
You can further configure an existing connection by selecting it in the Network window and clicking the gear wheel icon to return to the editing dialog.
Then, to configure:
- port-based Network Access Control (PNAC), click the 802.1X Security tab and proceed to Section 2.5.10.1, “Configuring 802.1X Security”;
IPv4
settings for the connection, click the IPv4 Settings tab and proceed to Section 2.5.10.4, “Configuring IPv4 Settings”; or,IPv6
settings for the connection, click the IPv6 Settings tab and proceed to Section 2.5.10.5, “Configuring IPv6 Settings”.
2.5.6. Configuring a Wi-Fi Connection
This section explains how to use NetworkManager to configure a Wi-Fi (also known as wireless or 802.11a/b/g/n) connection to an Access Point.
To configure a mobile broadband (such as 3G) connection, see Section 2.5.8, “Establishing a Mobile Broadband Connection”.
Quickly Connecting to an Available Access Point
The easiest way to connect to an available access point is to click
on the network connection icon to activate the network connection icon's
menu, locate the Service Set Identifier (SSID) of the access point in the list of Wi-Fi
networks, and click on it. 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. If you are
unsure, try connecting to each type in turn. Finally, 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 2.5.10.2, “Configuring Wi-Fi Security”.
If NetworkManager
connects to the access point successfully, the network connection icon
will change into a graphical indicator of the wireless connection's
signal strength.
You can also edit the settings for one of these auto-created access
point connections just as if you had added it yourself. The Wi-Fi page of the Network window has a History button. Clicking it reveals a list of all the connections you have ever tried to connect to. See Section 2.5.6.2, “Editing a Connection, or Creating a Completely New One”
2.5.6.1. Connecting to a Hidden Wi-Fi Network
All access points have a Service Set Identifier (SSID) to identify them. However, an access point may be configured not to broadcast its SSID, in which case it is hidden, and will not show up in NetworkManager's list of Available
networks. You can still connect to a wireless access point that is
hiding its SSID as long as you know its SSID, authentication method, and
secrets.
To connect to a hidden wireless network, press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network window appears. Select Wi-Fi from the menu and then select Connect to Hidden Network to cause a dialog to appear. If you have connected to the hidden network before, use the Connection drop-down to select it, and click . If you have not, leave the Connection drop-down as , enter the SSID of the hidden network, select its Wi-Fi security method, enter the correct authentication secrets, and click .
For more information on wireless security settings, see Section 2.5.10.2, “Configuring Wi-Fi Security”.
2.5.6.2. Editing a Connection, or Creating a Completely New One
You can edit an existing connection that you have tried or succeeded in connecting to in the past by opening the Wi-Fi page of the Network
dialog and selecting the gear wheel icon to the right of the Wi-Fi
connection name. If the network is not currently in range, click History to display past connections. When you click the gear wheel icon the editing connection dialog appears. The Details window shows the connection details.
To configure a new connection whose SSID is in range, first attempt to connect to it by opening the Network window, selecting the Wi-Fi menu entry, and clicking the connection name (by default, the same as the SSID). If the SSID is not in range, see Section 2.5.6.1, “Connecting to a Hidden Wi-Fi Network”. If the SSID is in range, the procedure is as follows:
- Press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network settings tool appears. - Select the Wi-Fi interface from the left-hand-side menu entry.
- Click the Wi-Fi connection profile on the right-hand side menu you want to connect to. A padlock symbol indicates a key or password is required.
- If requested, enter the authentication details.
Configuring the SSID, Auto-Connect Behavior, and Availability Settings
To edit a Wi-Fi connection's settings, select Wi-Fi in the Network page and then select the gear wheel icon to the right of the Wi-Fi connection name. Select Identity. The following settings are available:
- 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.
The following settings are common to all connection profiles:
- Connect automatically — Select this box if you want NetworkManager to auto-connect to this connection when it is available. See Section 2.5.3, “Connecting to a Network Automatically” 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 2.5.4, “System-wide and Private Connection Profiles” for details.
Saving Your New (or Modified) Connection and Making Further Configurations
Once you have finished editing the wireless connection, click the Section 2.5.1, “Connecting to a Network Using a GUI” for details on selecting and connecting to a network.
button to save your configuration. Given a correct configuration, you
can connect to your modified connection by selecting it from the network
connection icon's menu. See
You can further configure an existing connection by selecting it in the Network window and clicking the gear wheel icon to reveal the connection details.
Then, to configure:
- security authentication for the wireless connection, click Security and proceed to Section 2.5.10.2, “Configuring Wi-Fi Security”;
IPv4
settings for the connection, click IPv4 and proceed to Section 2.5.10.4, “Configuring IPv4 Settings”; or,IPv6
settings for the connection, click IPv6 and proceed to Section 2.5.10.5, “Configuring IPv6 Settings”.
2.5.7. Establishing a VPN Connection
IPsec, provided by Libreswan,
is the preferred method for creating a VPN in Red Hat
Enterprise Linux 7. The GNOME graphical user interface tool described
below requires the NetworkManager-libreswan-gnome package. If required, to ensure this package is installed issue the following command as
root
:
~]# yum install NetworkManager-libreswan-gnome
See Red Hat Enterprise Linux 7 System Administrator's Guide for more information on how to install new packages in Red Hat Enterprise Linux 7.
Establishing a Virtual Private Network (VPN) enables communication
between your Local Area Network (LAN), and another, remote LAN. This is
done by setting up a tunnel across an intermediate network such as the
Internet. The VPN tunnel that is set up typically uses authentication
and encryption. After successfully establishing a VPN connection using a
secure tunnel, a VPN router or gateway performs the following actions
upon the packets you transmit:
- 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.
The receiving VPN router strips the header information, decrypts the
data, and routes it to its intended destination (either a workstation
or other node on a network). Using a network-to-network connection, the
receiving node on the local network receives the packets already
decrypted and ready for processing. The encryption and decryption
process in a network-to-network VPN connection is therefore transparent
to clients.
Because they employ several layers of authentication and encryption,
VPNs are a secure and effective means of connecting multiple remote
nodes to act as a unified intranet.
Procedure 2.3. Adding a New VPN Connection
You can configure a new VPN connection by opening the Network window and selecting the plus symbol below the menu.
- Press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network settings tool appears. - Select the plus symbol below the menu. The Add Network Connection window appears.
- Select the VPN menu entry. The view now changes to offer configuring a VPN manually, or importing a VPN configuration file.The appropriate NetworkManager VPN plug-in for the VPN type you want to configure must be installed. See Section 2.5.7, “Establishing a VPN Connection”.
- Click the Choose a VPN Connection Type assistant.button to open the
- Select the VPN protocol for the gateway you are connecting to from the menu. The VPN protocols available for selection in the menu correspond to the NetworkManager VPN plug-ins installed. See Section 2.5.7, “Establishing a VPN Connection”.
- The Add Network Connection window changes to present the settings customized for the type of VPN connection you selected in the previous step.
Procedure 2.4. Editing an Existing VPN Connection
You can configure an existing VPN connection by opening the Network window and selecting the name of the connection from the list. Then click the button.
- Press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network settings tool appears. - Select the VPN connection you want to edit from the left hand menu.
- Click the Configure button.
Configuring 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 Section 2.5.3, “Connecting to a Network Automatically” 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 2.5.4, “System-wide and Private Connection Profiles” 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.
Configuring the VPN Tab
- Gateway
- The name or
IP
address of the remote VPN gateway. - Group name
- The name of a VPN group configured on the remote gateway.
- User password
- If required, enter the password used to authenticate with the VPN.
- Group password
- If required, enter the password used to authenticate with the VPN.
- User name
- If required, enter the user name used to authenticate with the VPN.
- 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 IPsec negotiations.
- Domain
- If required, enter the Domain Name.
Saving Your New (or Modified) Connection and Making Further Configurations
Once you have finished editing your new VPN connection, click the NetworkManager apply the changes. If the profile is OFF, set it to ON or select it in the network connection icon's menu. See Section 2.5.1, “Connecting to a Network Using a GUI” for information on using your new or altered connection.
button to save your customized configuration. If the profile was in use while being edited, power cycle the connection to make
You can further configure an existing connection by selecting it in the Network window and clicking Configure to return to the Editing dialog.
Then, to configure:
IPv4
settings for the connection, click the IPv4 Settings tab and proceed to Section 2.5.10.4, “Configuring IPv4 Settings”.
2.5.8. Establishing a Mobile Broadband Connection
You can use NetworkManager's mobile broadband connection abilities to connect to the following 2G and 3G services:
- 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).
Your computer must have a mobile broadband device (modem), which the
system has discovered and recognized, in order to create the
connection. Such a device may be built into your computer (as is the
case on many notebooks and netbooks), or may be provided separately as
internal or external hardware. Examples include PC card, USB Modem or
Dongle, mobile or cellular telephone capable of acting as a modem.
Procedure 2.5. Adding a New Mobile Broadband Connection
You can configure a mobile broadband connection by opening the Network Connections tool and selecting the Mobile Broadband tab.
- Press the Super key to enter the Activities Overview, type
nm-connection-editor
and then press Enter. The Network Connections tool appears. - Click the Choose a Connection Type menu opens.button. The
- Select themenu entry.
- Click Set up a Mobile Broadband Connection assistant.to open the
- 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 Section 2.5.8.1, “Configuring the Mobile Broadband Tab”.
Procedure 2.6. Editing an Existing Mobile Broadband Connection
Follow these steps to edit an existing mobile broadband connection.
- Press the Super key to enter the Activities Overview, type
nm-connection-editor
and then press Enter. The Network Connections tool appears. - Select the Mobile Broadband tab.
- Select the connection you want to edit and click the Edit button.
- 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 Section 2.5.3, “Connecting to a Network Automatically” 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 2.5.4, “System-wide and Private Connection Profiles” 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 mobile broadband-specific settings by referring to Section 2.5.8.1, “Configuring the Mobile Broadband Tab”.
Saving Your New (or Modified) Connection and Making Further Configurations
Once you have finished editing your mobile broadband connection, click the NetworkManager apply the changes. If the profile is OFF, set it to ON or select it in the network connection icon's menu. See Section 2.5.1, “Connecting to a Network Using a GUI” for information on using your new or altered connection.
button to save your customized configuration. If the profile was in use while being edited, power cycle the connection to make
You can further configure an existing connection by selecting it in the Network Connections window and clicking Edit to return to the Editing dialog.
Then, to configure:
- Point-to-point settings for the connection, click the PPP Settings tab and proceed to Section 2.5.10.3, “Configuring PPP (Point-to-Point) Settings”;
IPv4
settings for the connection, click the IPv4 Settings tab and proceed to Section 2.5.10.4, “Configuring IPv4 Settings”; or,IPv6
settings for the connection, click the IPv6 Settings tab and proceed to Section 2.5.10.5, “Configuring IPv6 Settings”.
2.5.8.1. Configuring the Mobile Broadband Tab
If you have already added a new mobile broadband connection using the assistant (see Procedure 2.5, “Adding a New Mobile Broadband Connection” for instructions), you can edit the Mobile Broadband tab to disable roaming if home network is not available, assign a network ID, or instruct NetworkManager to prefer a certain technology (such as 3G or 2G) when using the connection.
- 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; and/or
- 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.
CDMA and EVDO have fewer options. They do not have the
APN
, Network ID
, or Type
options.
2.5.9. Establishing a DSL Connection
This section is intended for those installations which have a DSL
card fitted within a host rather than the external combined DSL modem
router combinations typical of private consumer or SOHO installations.
Procedure 2.7. Adding a New DSL Connection
You can configure a new DSL connection by opening the Network Connections window, clicking the button and selecting DSL from the Hardware section of the new connection list.
- Press the Super key to enter the Activities Overview, type
nm-connection-editor
and then press Enter. The Network Connections tool appears. - Click thebutton.
- The Choose a Connection Type list appears.
- Selectand press the button.
- The Editing DSL Connection 1 window appears.
Procedure 2.8. Editing an Existing DSL Connection
You can configure an existing DSL connection by opening the Network Connections window and selecting the name of the connection from the list. Then click the button.
- Press the Super key to enter the Activities Overview, type
nm-connection-editor
and then press Enter. The Network Connections tool appears. - Select the connection you want to edit and click the Edit button.
Configuring 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 Section 2.5.3, “Connecting to a Network Automatically” 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 2.5.4, “System-wide and Private Connection Profiles” 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.
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
Once you have finished editing your DSL connection, click the NetworkManager apply the changes. If the profile is OFF, set it to ON or select it in the network connection icon's menu. See Section 2.5.1, “Connecting to a Network Using a GUI” for information on using your new or altered connection.
button to save your customized configuration. If the profile was in use while being edited, power cycle the connection to make
You can further configure an existing connection by selecting it in the Network Connections window and clicking Edit to return to the Editing dialog.
Then, to configure:
- The MAC address and MTU settings, click the Wired tab and proceed to Section 2.5.5.1, “Configuring the Connection Name, Auto-Connect Behavior, and Availability Settings”;
- Point-to-point settings for the connection, click the PPP Settings tab and proceed to Section 2.5.10.3, “Configuring PPP (Point-to-Point) Settings”;
IPv4
settings for the connection, click the IPv4 Settings tab and proceed to Section 2.5.10.4, “Configuring IPv4 Settings”.
2.5.10. Configuring Connection Settings
2.5.10.1. Configuring 802.1X Security
802.1X security is the name of the IEEE standard for port-based Network Access Control (PNAC). It is also called WPA Enterprise. Simply put, 802.1X security is a way of controlling access to a logical network
from a physical one. All clients who want to join the logical network
must authenticate with the server (a router, for example) using the
correct 802.1X authentication method.
802.1X security is most often associated with securing wireless
networks (WLANs), but can also be used to prevent intruders with
physical access to the network (LAN) from gaining entry. In the past,
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.
802.1X provides a framework for WLAN and LAN access control and
serves as an envelope for carrying one of the Extensible Authentication
Protocol (EAP) types. An EAP type is a protocol that defines how
security is achieved on the network.
You can configure 802.1X security for a wired or wireless connection type by opening the Network window (see Section 2.5.1, “Connecting to a Network Using a GUI”) and following the applicable procedure below. Press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Network settings tool appears. Proceed to Procedure 2.9, “For a Wired Connection” or Procedure 2.10, “For a Wireless Connection”:
Procedure 2.9. For a Wired Connection
- Select a Wired network interface from the left-hand-side menu.
- Either click onto add a new network connection profile for which you want to configure 802.1X security, or select an existing connection profile and click the gear wheel icon.
- Then select Security and set the symbolic power button to ON to enable settings configuration.
Procedure 2.10. For a Wireless Connection
- Select a Wireless network interface from the left-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.
- From the drop-down menu select one of the following security methods:, , or .
- Refer to Section 2.5.10.1.1, “Configuring TLS (Transport Layer Security) Settings” for descriptions of which extensible authentication protocol (EAP) types correspond to your selection in the Security drop-down menu.
2.5.10.1.1. Configuring TLS (Transport Layer Security) Settings
With Transport Layer Security, the client and server mutually
authenticate using the TLS protocol. The server demonstrates that it
holds a digital certificate, the client proves its own identity using
its client-side certificate, and key information is exchanged. Once
authentication is complete, the TLS tunnel is no longer used. Instead,
the client and server use the exchanged keys to encrypt data using AES,
TKIP or WEP.
The fact that certificates must be distributed to all clients who
want to authenticate means that the EAP-TLS authentication method is
very strong, but also more complicated to set up. Using TLS security
requires the overhead of a public key infrastructure (PKI) to manage
certificates. The benefit of using TLS security is that a compromised
password does not allow access to the (W)LAN: an intruder must also have
access to the authenticating client's private key.
NetworkManager does not determine the version of TLS supported. NetworkManager gathers the parameters entered by the user and passes them to the daemon, wpa_supplicant,
that handles the procedure. It in turn uses OpenSSL to establish the
TLS tunnel. OpenSSL itself negotiates the SSL/TLS protocol version. It
uses the highest version both ends support.
Selecting an Authentication Method
Select from one of following authentication methods:
- Select TLS for Transport Layer Security and proceed to Section 2.5.10.1.2, “Configuring TLS Settings”;
- Select FAST for Flexible Authentication via Secure Tunneling and proceed to Section 2.5.10.1.4, “Configuring Tunneled TLS Settings”;
- Select Tunneled TLS for Tunneled Transport Layer Security, otherwise known as TTLS, or EAP-TTLS and proceed to Section 2.5.10.1.4, “Configuring Tunneled TLS Settings”;
- Select Protected EAP (PEAP) for Protected Extensible Authentication Protocol and proceed to Section 2.5.10.1.5, “Configuring Protected EAP (PEAP) Settings”.
2.5.10.1.2. 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.
2.5.10.1.3. 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
- Username
- Enter the user name to be used in the authentication process.
- Password
- Enter the password to be used in the authentication process.
2.5.10.1.4. 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
- Username
- Enter the user name to be used in the authentication process.
- Password
- Enter the password to be used in the authentication process.
2.5.10.1.5. 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
- Username
- Enter the user name to be used in the authentication process.
- Password
- Enter the password to be used in the authentication process.
2.5.10.2. Configuring Wi-Fi Security
- Security
- Password
- Enter the password to be used in the authentication process.
2.5.10.3. Configuring PPP (Point-to-Point) Settings
- Configure 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).
2.5.10.4. Configuring IPv4 Settings
The IPv4 Settings tab allows you to configure the method used to connect to a network, to enter
IP
address, route, and DNS
information as required. The IPv4 Settings
tab is available when you create and modify one of the following
connection types: wired, wireless, mobile broadband, VPN or DSL. If you
need to configure IPv6
addresses, see Section 2.5.10.5, “Configuring IPv6 Settings”. If you need to configure static routes, click the button and proceed to Section 2.5.10.6, “Configuring Routes”.
If you are using
DHCP
to obtain a dynamic IP
address from a DHCP
server, you can simply set Method to .
Setting the Method
Available IPv4 Methods by Connection Type
When you click the Method drop-down menu, depending on the type of connection you are configuring, you are able to select one of the following
IPv4
connection methods. All of the methods are listed here according to which connection type, or types, they are associated with:
- Method
DHCP
server to assignIP
addresses. You do not need to fill in the DHCP client ID field.DHCP
server to assignIP
addresses but you want to assignDNS
servers manually.DHCP
server and you do not want to assignIP
addresses manually. Random addresses will be assigned as per RFC 3927 with prefix169.254/16
.10.42.x.1/24
range, aDHCP
server andDNS
server are started, and the interface is connected to the default network connection on the system with network address translation (NAT).IPv4
is disabled for this connection.- Wired, Wireless and DSL Connection Methods
IP
addresses manually.- Mobile Broadband Connection Methods
IP
address andDNS
servers automatically.IP
address automatically, but you want to manually specifyDNS
servers.- VPN Connection Methods
IP
address andDNS
servers automatically.IP
address automatically, but you want to manually specifyDNS
servers.- DSL Connection Methods
IP
address andDNS
servers automatically.IP
address automatically, but you want to manually specifyDNS
servers.
For information on configuring static routes for the network connection, go to Section 2.5.10.6, “Configuring Routes”.
2.5.10.5. Configuring IPv6 Settings
- Method
IPv6
settings for this connection.DNS
servers manually.DHCPv6
directly to create a stateful configuration.IP
addresses manually.DHCP
server and you do not want to assignIP
addresses manually. Random addresses will be assigned as per RFC 4862 with prefixFE80::0
.- Addresses
DNS
servers.
For information on configuring static routes for the network connection, go to Section 2.5.10.6, “Configuring Routes”.
2.5.10.6. Configuring Routes
A host's routing table will be automatically populated with routes
to directly connected networks. The routes are learned by examining the
network interfaces when they are “up”.
This section describes entering static routes to networks or hosts
which can be reached by traversing an intermediate network or
connection, such as a VPN tunnel or leased line. In order to reach a
remote network or host, the system is given the address of a gateway to
which traffic should be sent.
When a host's interface is configured by
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
.
Configuring Static Routes
To set a static route, open the Section 2.5.1, “Connecting to a Network Using a GUI” for instructions on how to do that.
or settings window for the connection you want to configure. See - Routes
IP
address of a remote network, sub-net, or host.IP
address entered above.IP
address of the gateway leading to the remote network, sub-net, or host entered above.- When Automatic is ON, routes from
RA
orDHCP
are 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.
Configuring Host Names Using nmcli
The NetworkManager tool nmcli can be used to query and set the static host name in the
/etc/hostname
file. Note that at time of writing, changing the host name in this way will not be noticed by hostnamectl.
To query the static host name, issue the following command:
~]$ nmcli general hostname
To set the static host name to my-server, issue the following command as root
:
~]# nmcli general hostname my-server
To force hostnamectl to notice the change in the static host name, restart hostnamed
as root
:
~]# systemctl restart systemd-hostnamed
2.1.3. Selecting Network Configuration Methods
- To configure an interface using NetworkManager's text user interface tool, nmtui, proceed to Section 2.2, “Using the Text User Interface, nmtui”
- To configure an interface using NetworkManager's command-line tool, nmcli, proceed to Section 2.3, “Using the NetworkManager Command Line Tool, nmcli”
- To configure a network interface manually, see Section 2.4, “Using the Command Line Interface (CLI)”.
- To configure a network using graphical user interface tools, proceed to Section 2.5, “Using NetworkManager with the GNOME Graphical User Interface”
Nice Blog Post !
ResponderEliminar