Ubuntu 16.04 Network Configuration File Network Manager Reads
Chapter 1 Configuring the System'south Network
Table of Contents
- 1.1 About Network Interface Names
- ane.ii About Network Configuration Files
- 1.2.1 Well-nigh the /etc/hosts File
- 1.two.2 About the /etc/nsswitch.conf File
- one.2.3 Well-nigh the /etc/resolv.conf File
- i.2.4 Almost the /etc/sysconfig/network File
- 1.3 Nearly Network Interface Configuration Files
- i.4 Network Configuration Tools
- 1.5 Configuring Network Interfaces
- 1.six Configuring Network Routing
Systems connect to the network through unlike network components, particularly network interface cards (NICs) and multiple configuration files. Network configuration files define how these interfaces function in the organisation, as well as how the interfaces collaborate with other devices and systems on the wider network.
This affiliate describes how to configure a organization'south network interfaces and network routing.
1.1 About Network Interface Names
Traditionally, early kernel versions assigned names to network interface devices past assigning a prefix, which is typically based on the device driver, and a number, such as eth0
. With the availability of dissimilar types of devices, this naming schema is no longer efficient. The names do non necessarily correspond to the chassis labels and the names themselves might exist inconsistent across existing network interfaces. The inconsistency would touch embedded adapters on the system every bit well as add together-in adapters. Consequently, server platforms with multiple network adapters could encounter problems managing these interfaces.
Oracle Linux implements a consequent naming scheme for all network interfaces through the udev device managing director. The scheme offers the following advantages:
-
The names of the devices are predictable.
-
Device names persist across organization reboots or later on changes are made to the hardware.
-
Lacking hardware can hands exist identified and thus replaced.
The characteristic that implements consistent naming on devices is enabled in Oracle Linux 8 past default. Network interface names are based on information that is derived from the organisation BIOS; or, alternatively from a device's firmware, arrangement path, or MAC address.
Network interfaces are identified by a proper noun that combines a prefix and a suffix. The prefix depends on the type of network interface:
-
Ethernet network interfaces:
en
-
Wireless local area network (LAN) interfaces:
wl
-
Wireless wide surface area network (WAN) interfaces:
ww
The suffix contains whatever of the post-obit information:
-
An on-lath index number
o
, and thus,n
eno0
. -
A hot-plug slot index number
due south
, and thus,north
ens1
.This naming schema tin also include
f
andfunction
d
that are added to the suffix.device-id
-
The bus and slot number
p
, and thus.omnibus
sn
enp0s8
.This naming schema can also include
f
andfunction
d
that are added to the suffix.device-id
-
The MAC address
x
, and thus,MAC-addr
enx0217b08b
.Note that this naming format is not used by Oracle Linux past default. Even so, administrators tin can implement it as an pick.
1.ii Nigh Network Configuration Files
- 1.two.1 About the /etc/hosts File
- i.2.ii About the /etc/nsswitch.conf File
- 1.2.3 About the /etc/resolv.conf File
- one.2.4 About the /etc/sysconfig/network File
The post-obit are boosted network configuration files that you lot might need to configure on a system.
1.2.i Nearly the /etc/hosts File
The /etc/hosts
file is a database that contains host names and their respective IP addresses. The system uses the file equally one of the sources to perform name and address resolution. If the network uses DNS (Domain Name Service), so the file would contain at to the lowest degree IP address information of the loopback interface.
For more data, see the hosts(v)
transmission page.
1.2.2 About the /etc/nsswitch.conf File
The /etc/nsswitch.conf
file configures how the system uses various databases and proper noun resolution mechanisms. One significant parameter in the file is hosts
, which refers to the sources for resolving names and addresses.
hosts: files dns nis
In the example, the system uses 3 sources for name and address resolution. files
refers to the /etc/hosts
file. dns
and nis
refer to servers. With this definition, the system resolves names and IP addresses past first querying files
. If unsuccessful, the organization then queries a DNS server and a finally NIS server.
Do not modify /etc/nsswitch.conf
directly. To revise the file, practise the following:
-
Enter the changes in
/etc/authselect/user-nsswitch.conf
. -
Run authselect apply-changes .
For more information, see the nsswitch.conf(5)
and the authselect(8)
transmission pages. Run across also Oracle® Linux 8: Setting Upward System Users and Hallmark.
i.two.iii About the /etc/resolv.conf File
The /etc/resolv.conf
file defines how the system uses DNS to resolve host names and IP addresses. This file contains a line specifying the search domains and up to three lines that specify the IP addresses of DNS server, for instance:
search us.mydomain.com mydomain.com nameserver 192.168.154.iii nameserver 192.168.154.4 nameserver 10.216.106.iii
If your system obtains its IP address from a DHCP server, the file would also comprise data obtained from DHCP.
For more information, meet the resolv.conf(v)
manual page.
one.two.4 About the /etc/sysconfig/network File
The /etc/sysconfig/network
file specifies additional data that is valid to all network interfaces on the system, as shown in the following instance:
NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=host20.mydomain.com GATEWAY=192.168.1.ane
For more information, see /usr/share/doc/initscripts*/sysconfig.txt
.
1.three About Network Interface Configuration Files
Each physical and virtual network device on an Oracle Linux organisation has an associated configuration file named ifcfg-
in the interface
/etc/sysconfig/network-scripts
directory, for example:
ls /etc/sysconfig/network-scripts/ifcfg-*
The following output might be displayed:
ifcfg-en0 ifcfg-en1
In this instance, the configuration files for en0
and en1
are ifcfg-en0
and ifcfg-en1
, respectively. The organisation reads these configuration files at boot fourth dimension to configure the network interfaces.
Note
In Oracle Linux 8, network scripts are deprecated. Previous ifup and ifdown scripts have been modified to piece of work through the NetworkManager
utility.
For an interface en1
that uses the Dynamic Host Configuration Protocol (DHCP) to obtain its IP address, the corresponding ifcfg-en1
file might announced as follows:
DEVICE="en1" NM_CONTROLLED="yes" ONBOOT=yes USERCTL=no Blazon=Ethernet BOOTPROTO=dhcp DEFROUTE=yes IPV4_FAILURE_FATAL=yeah IPV6INIT=no Name="Arrangement en1" UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 HWADDR=08:00:27:16:C3:33 PEERDNS=yes PEERROUTES=yes
If the interface is configured with a static IP address, the file would contain entries similar to the post-obit:
DEVICE="en1" NM_CONTROLLED="yes" ONBOOT=yeah USERCTL=no Type=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=aye IPV6INIT=no NAME="System en1" UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 HWADDR=08:00:27:sixteen:C3:33 IPADDR=192.168.i.101 NETMASK=255.255.255.0 BROADCAST=192.168.1.255 PEERDNS=yes PEERROUTES=yes
The following selected configuration parameters are typically used in interface configuration files:
-
BOOTPROTO
-
How the interface obtains its IP address. Its values tin be
dhcp
for DHCP-assigned addresses ornone
for static addresses. -
BROADCAST
-
IPv4 broadcast address.
-
DEFROUTE
-
Whether this interface is the default route.
-
DEVICE
-
Proper name of the concrete network interface device (or a PPP logical device).
-
GATEWAY
N
-
IPv4 gateway address for the interface. As an interface can be associated with several combinations of IP address, network mask prefix length, and gateway address, these are numbered starting from 0.
-
HWADDR
-
Media access control (MAC) address of an Ethernet device.
-
IPADDR
N
-
IPv4 address of the interface.
-
IPV4_FAILURE_FATAL
-
Whether the device is disabled if IPv4 configuration fails.
-
IPV6_DEFAULTGW
-
IPv6 gateway accost for the interface.
-
IPV6_FAILURE_FATAL
-
Whether the device is disabled if IPv6 configuration fails.
-
IPV6ADDR
-
IPv6 address of the interface in CIDR notation, including the network mask prefix length.
-
IPV6INIT
-
Whether to enable IPv6 for the interface.
-
MASTER
-
Specifies the name of the primary bonded interface, of which this interface is a fill-in.
-
NAME
-
Name of the interface equally displayed in the Network Connections GUI.
-
NETWORK
-
IPV4 address of the network.
-
NM_CONTROLLED
-
Whether the network interface device is controlled by the network management daemon,
NetworkManager
. -
ONBOOT
-
Whether the interface is activated at boot time.
-
PEERDNS
-
Whether the
/etc/resolv.conf
file used for DNS resolution contains data obtained from the DHCP server. -
PEERROUTES
-
Whether the information for the routing tabular array entry that defines the default gateway for the interface is obtained from the DHCP server.
-
PREFIX
Northward
-
Length of the IPv4 network mask prefix for the interface.
-
SLAVE
-
Specifies that this interface is a fill-in of a bonded interface.
-
TYPE
-
Interface blazon.
-
USERCTL
-
Whether users other than
root
can control the state of this interface. -
UUID
-
Universally unique identifier for the network interface device.
1.iv Network Configuration Tools
Dissimilar tools are available to configure the network. All of them by and large perform the same functions. You tin can select any tool or a combination of tools to manage the network.
-
Cockpit is a spider web-based configuration tool for managing network configuration, including network interfaces, bonds, teams, bridges, virtual VLANs and the firewall.
-
Networks Connection Editor is a graphical user interface (GUI) that is GNOME-based. The Networks Connection Editor is a subset of the GNOME settings awarding and is launched by using the nm-connection-editor command.
Notation
The GNOME settings application enables you to perform other system configurations, bated from networking. To access, select the network icon at the peak right of the desktop, and then select Settings. Alternatively, you can click Activities, select Prove Applications, and so select Settings.
-
NetworkManager
is a text-based user interface (TUI) that is launched with the nmtui command. While it performs the same functions as the other tools, you navigate the TUI past using the keyboard rather than the mouse device. -
NetworkManager
command line, which consists of the nmcli command and its options. Other commands such every bit ip and ethtool complement nmcli in configuring and managing networks.For more information, meet the
nmcli(i)
,ip(8)
, andethtool(8)
man pages.
Note
The NetworkManager
service and the nmcli command are included in the NetworkManager
parcel. The Network Connections editor is included in the nm-connection-editor
package. Depending on the type of environment y'all selected when you installed Oracle Linux 8, you might need to manually install the NetworkManager
package by running the dnf install NetworkManager control.
ane.5 Configuring Network Interfaces
The following information describes how to configure a NIC by using the tools that were previously described.
Because using Cockpit is intuitive, the following tasks focus on the other tools that are used to configure NICs on an Oracle Linux system. For a tutorial on using Cockpit to configure network interfaces, encounter https://docs.oracle.com/en/operating-systems/oracle-linux/8/obe-cockpit-network/index.html.
How to Employ the Network Connections Editor
-
Launch the editor:
sudo nm-connection-editor
NetworkManager
detects the network devices that are on the organisation and lists them as well as their current states:Figure 1.ane Network Connections
-
To add or remove a connection, employ the plus (+) or minus (-) buttons located at the bottom of the editor window.
If you add a connection, a window that prompts you for the connexion type opens. Select a type, such every bit Ethernet, from the drop-down listing then click Create . The Interface Editor window opens.
Annotation
The same window opens if you edit an existing connection.
Figure i.2 Interface Editor
-
On each tab, enter the necessary information about the interface.
-
Click Salve after you have completed the configuration.
You must specify all of the required information. Otherwise, the settings cannot exist saved and the editor'southward groundwork final window would brandish messages that bespeak the errors.
How to Use the Text Based User Interface
-
Open the text-based user interface.
sudo nmtui
Figure 1.3 TUI Chief Menu
The effigy shows a window containing the main bill of fare of text-based network configuration tool that enables y'all to edit or activate a connexion or fix the system hostname.
To navigate the tool, use the up and downwardly arrow keys, then printing Enter to make a selection
-
To add a connectedness, select Edit a connection , so click Add .
-
After selecting a connexion type, the Edit Connection window opens.
Figure 1.4 Edit Connexion
-
As an option, specify a preferred profile name, as well equally the name of the device.
-
By default, IPv4 and IPv6 configurations are fix to Automated. To modify the setting, select the Automated field and press Enter. From the driblet-down list, select the type of IP configuration that y'all want to implement, such as Transmission. Then, select the respective Bear witness field.
The fields that are displayed depend on the type of IP configuration that is selected. For example, if you want to manually configure an IP accost, selecting Show displays an address field, where you would enter an IP addresses for the interface, equally the following figure illustrates.
Figure one.5 Adding IP Addresses
The effigy shows the options in the Edit Connection window for manually configuring an IPv4 interface.
-
Navigate through all of the fields on the screen to ensure that the required data is specified.
-
Subsequently you lot have edited the connexion, select OK .
How to Use the Command Line
To illustrate the different uses of the nmcli control, this process describes an example of adding and configuring a new Ethernet connection for the enp0s2
device. For more than information nigh the command, see the nmcli(1)
manual page.
Tip
Earlier adding the connectedness, prepare the information you would for the configuration, such as the following:
-
Connectedness name, for instance,
My Work Connection
. The nmcli command works by referring to the connection name rather than the device proper name. If you exercise not set a connection name, then the device's name is used equally the connectedness proper noun. -
IP addresses (IPv4 and, if needed, IPv6)
-
Gateway addresses
-
Other relevant data yous desire to set for the connectedness
-
(Optional): Display the network devices on the organisation.
sudo nmcli device status
The following output is displayed:
DEVICE Type STATE CONNECTION enp0s1 ethernet connected enp0s1 enp0s2 ethernet disconnected -- lo loopback unmanaged
The command shows whether a device is connected or disconnected, and whether managed or unmanaged.
-
(Optional) Display the connection information about the network devices.
sudo nmcli con show [--active]
Output similar to the following is displayed:
Name UUID Type DEVICE enp0s1
nn-nn-nn-nn-nn
ethernet enp0s1 virbr0nn-nn-nn-nn-nn
bridge virbr0 mybondnn-nn-nn-nn-nn
bond bond0The con subcommand is the short class of connexion , and can exist further shortened to c . Specifying the
--agile
option would display merely active devices.Note that in the output,
Proper name
represents the connexion ID. -
Add a new connection.
sudo nmcli con add {
properties
} [IP-info
] [gateway-info
-
properties
-
The connectedness name as specified by the
con-name
argument, the type of connection as specified past thetype
argument, and the interface proper name as specified by theifname
argument. -
IP-info
-
The IPv4 or IPv6 address as specified past either the
ip4
orip6
argument. The address must be in the formataddress/netmask
. The IPv4 address can be in CIDR form, for example,1.2.3.4/24
. -
gateway-info
-
The gateway IPv4 or IPv6 address every bit specified by either the
gw4
orgw6
argument.
For example, to add the connection with the data at the beginning of this procedure, you lot would type:
sudo nmcli con add blazon ethernet ifname enp0s2 \ con-name "My Work Connexion" ip4 192.168.five.10/24 gw4 192.168.5.2
The output would acknowledge that the connection is successfully completed.
-
-
Activate the interface.
sudo nmcli con upwardly "My Piece of work Connectedness"
-
(Optional) Display the configuration properties of the new connection.
sudo nmcli [-o] con show "My Work Connection
The displayed information might appear equally follows:
connection.id: My Work Connectedness connection.uuid:
nn-nn-nn-nn-nn
connectedness.type: 802-three-ethernet connection.interface-name: enp0s2 ... IP4.ADDRESS[1]: 192.168.5.ten IP4.GATEWAY: 192.168.5.2 ...Specifying the
-o
option displays only properties that accept configured values.
After you lot have created the connection, a corresponding configuration file is created in the /etc/sysconfig/networking-scripts
directory. If you run the command ls -lrt /etc/sysconfig/network-scripts/ifcfg* , the output would list the new connexion, for example:
... -rw-r--r--. 1 root root 266 Aug 6 11:03 /etc/sysconfig/network-scripts/ifcfg-My_Work_Connection
1.6 Configuring Network Routing
A system uses its routing table to determine which network interface to use when sending packets to remote systems. For a arrangement with just a single interface, information technology is sufficient to configure the IP address of a gateway arrangement on the local network that routes packets to other networks.
To create a default road for IPv4 network packets, include an entry for GATEWAY
in the /etc/sysconfig/network
file. For case, the post-obit entry configures the IP accost of the gateway system:
GATEWAY=192.0.2.one
If your arrangement has more one network interface, you can specify which interface should be used as follows:
GATEWAY=192.0.two.1 GATEWAYDEV=eth1
A single statement is usually sufficient to define the gateway for IPv6 packets, for instance:
IPV6_DEFAULTGW="2001:db8:1e10:115b::2%en1"
Any changes that you make to /etc/sysconfig/network
do not take effect until you restart the network service:
sudo systemctl restart NetworkManager
Display the routing table.
sudo ip route evidence
The following output might be displayed:
10.0.ii.0/24 dev en1 proto kernel scope link src x.0.two.xv default via 10.0.2.two dev en1 proto static
The sample output shows that packets destined for the local network (10.0.2.0/24
) practise not apply the gateway. The default entry means that any packets destined for addresses exterior the local network are routed through the gateway (10.0.2.two
).
Note
If you previously used the route command to configure routing, note that this command is considered obsolete. Using the ip command is preferred over the road command.
You lot can too use the netstat -rn command to display this information, for example:
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface x.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 en1 0.0.0.0 10.0.two.2 0.0.0.0 UG 0 0 0 en1
To add or delete a road from the tabular array, use the ip route add or ip route del commands. In the following example, the default route is first deleted, and so a new route is added.
sudo ip route del default
sudo ip route add default via ten.0.2.1 dev en1 proto static
sudo ip road evidence
The newly added road is listed when you run ip road show .
ten.0.two.0/24 dev en1 proto kernel scope link src 10.0.2.15 default via 10.0.2.one dev en1 proto static
The ip road get command is useful for querying on which route the organization will send packets to reach a specified IP address, for example:
sudo ip route get 23.6.118.140
The following output might be displayed:
23.six.118.140 via ten.0.two.ii dev en1 src 10.0.2.fifteen cache mtu 1500 advmss 1460 hoplimit 64
In this instance, packets to 23.6.118.140
are sent out of the en1
interface via the gateway 10.0.two.2
.
Notation that whatever changes y'all brand to the routing table by using the ip road command do not persist across system reboots. To configure static routes that persist over organization reboots, yous can create a route-
file ininterface
/etc/sysconfig/network-scripts
for the interface. For example, you would configure a static route for the en1
interface in a file named road-en1
. An entry in these files tin can take the aforementioned format equally the arguments to the ip route add command.
For example, you would ascertain a default gateway entry for en1
past creating an entry similar to the following in road-en1
:
default via 10.0.2.1 dev en1
The following entry in route-en2
defines a route to ten.0.3.0/24
via ten.0.3.1
over en2
:
ten.0.3.0/24 via 10.0.iii.one dev en2
Any changes that you make to a road-
file do not take effect until you restart either the network service or the interface. interface
For more data, see the ip(eight)
and netstat(eight)
manual pages.
Source: https://docs.oracle.com/en/operating-systems/oracle-linux/8/network/ol-netconf.html
0 Response to "Ubuntu 16.04 Network Configuration File Network Manager Reads"
Postar um comentário