So the first thing that you need to know is how to apply non persistent network
configuration on servers. IP address configuration is normally set statically using tools like NMCLI or NMTUI
on Red Hat on workstations, IP address configuration is typically handed out by a DHCP server
for troubleshooting purposes. The IP command is used to set runtime network configuration.
The important task is that you know how to get your IP configuration and
sometimes for analyzing. It's useful if you can do it manually as well.
So how does that work? Well, you need to use the right tools.
Runtime networking is not persistent, but it is useful for analyzing what is going on.
In the past, ifconfig was used. Nowadays ifconfig is obsolete, you should not
use it because it uses outdated methods for addressing and displaying networking.
And for that reason it doesn't display accurate information.
The nettools package which contains ifconfig is not even installed on many modern
distributions anymore. But sometimes you will still find it because of dependency requirements.
The main utility to check and manage networking is the IP utility.
Now let me run a demo in which we can see some
of the most common tasks with this utility for your convenience.
The demo is also on the slide.
So I am going to start using sudo ipa, which is short for IP address show and that
is showing that my network interface is called ens160 and I have an INET address on 192.168.29.14.1.
So I am going to use sudo ip addr add
to add an IP address to my network device.
Dev is specifying which network device and that will be ENS160 and setting it to 10.0.0.1024.
Next I'm going to do what?
Well, I'm going to show you sudo IP a that
is showing that we now have this secondary IP address.
I can use sudo IP link set ens160 down. That
will bring my network interface down. IPA is showing that
the status of the interface is now set to down.
That is temporarily disabling it. If you don't like that too much, don't forget to switch it up again.
How about sudo IP route show?
Well, that is showing the routing table and in this routing
table I can see my default route being set to 192.168.29.2.
I'm not going to use IP route at default via
10.0.0.1 because I don't like to change my default router.
If I change it, I can't get out to the Internet anymore.