Hello, and welcome to today's video presentation on using the "ip" command on Oracle Linux
8.
This video aims to provide information about using the "ip" command to collect and set
network details for Oracle Linux 8.
So let us get started.
In this exercise, the host system is a fully patched Oracle Linux 8 instance on Oracle
Cloud Infrastructure.
This instance also has a secondary VNIC added for use in this demonstration.
Additional information on Virtual Cloud Networks and attaching VNICs to an instance is outside
this video's scope, but available in our Oracle Cloud content located at oracle.com/goto/linuxcloudlearning.
Start by opening a terminal and connect to your host system.
The "ip" command is a Linux utility for system and network administrators to configure network
interfaces.
It is important to note that any network changes made using the "ip" command do not persist
across system reboots.
Start by getting a list of the system's network devices and their link-layer information by
typing "ip link show."
The output displays the loopback device, ens3 (primary NIC), ens5 (secondary NIC), and a
few others.
We will focus on the secondary NIC, ens5, for the remainder of this video to avoid disrupting
our active network connection.
To show the link-layer information for a single device, type "ip link show dev ens5."
It displays the device STATUS, MTU, MAC address, and other link-layer information.
To get statistics such as "receive" and "transmit" for this device type, "ip -s link ls ens5."
To display a listing of only active and running devices, type "ip link ls up."
Besides gathering data, the "ip link" command can take a network device online and offline.
Since the ens5 device is already online, take it offline by typing "ip link set ens5 down."
The command fails to run as it needs elevated privileges.
Running the "ip" command as root or using sudo is required when configuring or modifying
the network devices' status.
Try again by typing "sudo ip link set ens5 down."
Running "ip link show dev ens5" confirms the device is offline as indicated by the missing
UP status.
Bring the device online by typing "sudo ip link set ens5 up."
Running "ip link show dev ens5" will again show the status as UP.
For more details on the "ip link" command options, type "ip link help."
With the "ip link" command covered, we can move on to the "ip addr" or "ip address" command.
Type the command "ip addr" or "ip a" or "ip addr show" to get a listing of network devices
and their IP address information.
To show the information for a single device, type "ip addr show dev ens5."
Besides providing the IP address, the previous commands also demonstrate how to use abbreviations
for the "ip" command options.
Using abbreviations saves typing extra keystrokes once familiar with the syntax of the commands.
The "ip addr" command also allows the adding and deleting of a device's IP addresses.
To demo this functionality, stop the ens5 device by typing "sudo ip link set ens5 down."
Verify the device is down by typing "ip addr show dev ens5" and checking the status.
Next, remove the assigned IP address by typing "sudo ip addr del 10.0.32.6/24 dev ens5."
Then type "ip addr show dev ens5" to see the IP address is no longer assigned.
Assign an IP address back to the system by typing "sudo ip addr add 10.0.32.18/24 dev
ens5."
Confirm the assignment by typing "ip addr show dev ens5."
Restart the ens5 device by typing "sudo ip link set ens5 up."
Check that the connection is working by typing "ping -c 3 -I ens5 10.0.32.2", sending three
packets to the network default gateway.
The packets fail.
The packets fail because the ens5 interface is associated with an Oracle Cloud Infrastructure
VNIC.
That VNIC has a predefined IP address of 10.0.32.6, not the IP address we assigned of 10.0.32.18.
Fix the IP address assignment by stopping the network device again, removing the current
IP address, and adding the correct address.
[ silent while typing ... "sudo ip link set ens5 down" ]
[ silent while typing ... "sudo ip addr del 10.0.32.18/24 dev ens5" ]
[ silent while typing ... "sudo ip addr add 10.0.32.6/24 dev ens5" ]
[ silent while typing ... "sudo ip link set ens5 up" ]
[ silent while typing ... "ping -c 3 -I ens5 10.0.32.2" ]
Test the network, and it should be working again.
The last two "ip" commands we cover in this video is "ip route" and "ip neigh."
The "ip route" command allows a network administrator to view and modify the network routing table.
To see all the routes, type "ip route list."
The line starting with 10.0.32.0/24 defines the route for the ens5 network.
To determine the route taken for a specific IP address such as the ens5 gateway (10.0.32.2),
type "ip route get 10.0.32.2."
The output displays the route will travel through device ens5 as expected.
Whereas typing "ip route get 192.168.30.1" shows the packets are going through ens3 and
its default gateway of 192.168.2.1.
Lastly, the "ip neigh" command displays the neighbor entries, also called ARP (Address
Resolution Protocol) tables.
To show the neighbor tables, type "ip neigh show."
The output shows the MAC addresses of devices that are part of the system and their state.
For ARP tables, the state of a device can be one of four values.
The state of REACHABLE signifies a valid, reachable entry until the timeout expires.
A value of PERMANENT signifies an everlasting entry that only an administrator can remove.
The state of STALE signifies a valid, yet unreachable entry.
The Linux kernel checks a STALE device's state at the first transmission.
A value of DELAY signifies that the kernel is still waiting for validation from the stale
entry.
The "ip route" and "ip neigh" commands have other command options to manipulate the routing
or APR table, but covering those options is outside this video's scope.
Beyond the "ip" command, Oracle Linux 8 has a few additional network tools useful to system
and network administrators.
The "arping" command sends ARP requests to a neighbor host.
The "ethtool" command controls network driver and hardware settings.
And lastly, the "ss" command displays socket statistics.
One way of using these tools is to use "ss" to determine the active ssh sessions on a
system by typing "ss | grep -i ssh."
That completes this video introduction on using the "ip" command and a few other networking
utilities.
Learn more about the "ip" command and other networking tools syntax by reviewing the manual
pages and help commands listed at the end of this video.
Thank you for watching this video and enjoy using Oracle Linux 8.
Please check our additional information on Oracle Linux 8 in the Oracle Linux 8 Documentation
or Oracle Linux Learning Library.