Networking Network Devices and Network Connections
Hostname
- “-”, “_ “, and “. " characters are allowed.
- Up to 253 characters.
- Stored in /etc/hostname.
- Can be viewed with several different commands, such as
hostname,hostnamectl,uname, andnmcli, as well as by displaying the content of the /etc/hostname file.
View the hostname:
Lab: Change the Hostname
Server1
- Open /etc/hostname and change the entry to
server10.example.com - Restart the
systemd-hostnamedservice daemon
- confirm
server2
- Change the hostname with hostnamectl:
-
Log out and back in for the prompt to update
-
Change the hostname using nmcli
Hardware and IP Addressing
Ethernet Address
- 48-bit address that is used to identify the correct destination node for data packets transmitted from the source node.
- The data packets include hardware addresses for the source and the destination node.
- Also referred to as the hardware, physical, link layer, or MAC address.
List all network interfaces with their ethernet addresses:
Subnetting
- Network address space is divided into several smaller and more manageable logical subnetworks (subnets).
- Benefits:
- Reduced network traffic
- Improved network performance
- de-centralized and easier administration
- uses the node bits only
- Results in the reduction of usable addresses.
- All nodes in a given subnet have the same subnet mask.
- Each subnet acts as an isolated network and requires a router to talk to other subnets.
- The first and the last IP address in a subnet are reserved. The first address points to the subnet itself, and the last address is the broadcast address.
IPv4
View current ipv4 address:
Classful Network Addressing
See Classful ipv4
IPv6 Address
See ipv6
The ip addr command also shows IPv6 addresses for the interfaces:
Tools:
ping6traceroute6tracepath6
Protocols
- Defined in /etc/protocols
- Well known ports are defined in /etc/services
cat /etc/protocols
TCP and UDP Protocols
See IP Transport and Applications and tcp_ip_basic
ICMP
Send two pings to server 20
Ping the server’s loopback interface:
Send a traceroute to server 20
Or:
ICMPv6
- IPv6 version of ICMP
- enabled by default
Ping and ipv6 address:
Trace a route to an IPv6 address:
Show IPv6 addresses:
Network Manager Service
Default service in RHEL for network:
- interface and connection configuration.
- Administration.
- Monitoring.
NetworkManager daemon
- Responsible for keeping interfaces and connection up and active.
- Includes:
nmclinmtui(text-based)nm-connection-editor(GUI)
- Does not manage loopback interfaces.
Interface Connection Profiles
-
Configuration file on each interface that defines IP assignments and other relevant parameters for it.
-
The networking subsystem reads this file and applies the settings at the time the connection is activated.
-
Connection configuration files (or connection profiles) are stored in a central location under the /etc/NetworkManager/system-connections directory.
-
The filenames are identified by the interface connection names with nmconnection as the extension.
-
Some instances of connection profiles are: enp0s3.nmconnection, ens160.nmconnection, and em1.nmconnection.
On server10 and server20, the device name for the first interface is enp0s3 with connection name enp0s3 and relevant connection information stored in the enp0s3.nmconnection file.
This connection was established at the time of RHEL installation. The current content of the file from server10 are presented below:
- Each section defines a set of networking properties for the connection.
Directives
id
- Any description given to this connection. The default matches the interface name.
uuid
- The UUID associated with this connection
type
- Specifies the type of this connection
autoconnect-priority
- If the connection is set to autoconnect, connections with higher priority will be preferred. A higher number means higher priority. The range is between -999 and 999 with 0 being the default.
interface_name
- Specifies the device name for the network interface
timestamp
- The time, in seconds since the Unix Epoch that the connection was last activated successfully. This field is automatically populated each time the connection is activated.
address1/method
- Specifies the static IP for the connection if the method property is set to manual. /24 represents the subnet mask.
addr-gen-mode/method
- Generates an IPv6 address based on the hardware address of the interface.
View additional directives:
Naming rules for devices are governed by udevd service based on:
- Device location
- Topology
- setting in firmware
- virtualization layer
Understanding Hosts Table
See DNS and Time Synchronization
/etc/hosts file
- Table used to maintain hostname to IP mapping for systems on the local network, allowing us to access a system by simply employing its hostname.
Each row in the file contains an IP address in column 1 followed by the official (or canonical) hostname in column 2, and one or more optional aliases thereafter.
EXAM TIP: In the presence of an active DNS with all hostnames resolvable, there is no need to worry about updating the hosts file.
As expressed above, the use of the hosts file is common on small networks, and it should be updated on each individual system to reflect any changes for best inter-system connectivity experience.
Networking DIY Challenge Labs
Lab: Update Hosts Table and Test Connectivity.
- Add both server10 and server20’s interfaces to both server’s /etc/host files:
- Send 2 packets from server10 to server20’s IP address:
- Send 2 pings from server10 to server20’s hostname:
Lab 15-1: Add New Interface and Configure Connection Profile with nmcli
- Add a third network interface to rhel9server40 in VirtualBox.
- As user1 with sudo on server40, run
ip aand verify the addition of the new interface. - Use the
nmclicommand and assign IP 192.168.0.40/24 and gateway 192.168.0.1
- Deactivate and reactivate this connection manually.
- Add entry server40 to server30’s hosts table.
Lab: Add New Interface and Configure Connection Profile Manually (server30)
Add a third network interface to RHEL9server30 in VirtualBox.
run ip a and verify the addition of the new interface.
Use the nmcli command and assign IP 192.168.0.30/24 and gateway 192.168.0.1
Deactivate and reactivate this connection manually. Add entry server30 to the hosts table of server 40
ping tests to server30 from server 40
Or create the profile manually and restart network manager:
Administration Tools
ip
- Display monitor and manage network interfaces, routing, connections, traffic, etc.
ifup
- Brings up an interface
ifdown
- Brings down an interface
nmcli
- Creates, updates, deletes, activates, and deactivates a connection profile.
nmcli command
- Create, view, modify, remove, activate, and deactivate network connections.
- Control and report network device status.
- Supports abbreviation of commands.
Operates on 7 different object categories.
- general
- networking
- connection (c)(con)
- device (d)(dev)
- radio
- monitor
- agent
3. connection
- Activates, deactivates, and administers network connections.
Options:
show(list connections)up/down(Brings connection up or down)add(a)(adds a connection)edit(edit connection or add a new one)modify(modify properties of a connection)delete(d)(delete a connection)reload(re-read all connection profiles)load(re-read a connection profile)
4. Device
Options:
status(Displays device status)show(Displays info about device(s)
Show all connections, inactive or active:
Deactivate the connection enp0s8:
Note:
Activate the connection enp0s8:
Display the status of all network devices:
Lab: Add Network Devices to server10 and one to server20 using VirtualBox
- Shut down your servers (follow each step for both servers)
- Add network interface in Virtualbox then power on the VMs
- Verify the new interfaces:
Lab: Configure New Network Connection Using nmcli (server20)
- Verify the interface that was added from virtualbox:
- Add connection profile and attach it to the interface:
- Confirm connection status
- Verify ip address
- Check the content of the connection profile