There are plenty of reasons why you'd need to set up virtual network interfaces on a RHEL 8 / CentOS 8 server or workstation. The process has changed a bit since RHEL 7, but it's still fairly straightforward.In this tutorial you will learn:
- How to Locate Your Network Interfaces
- How to Edit Your Main Network Configuration
- How to Duplicate Your Network Configuration
- How to Create The Virtual Interface Confg
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||RHEL 8 / CentOS 8|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
How to Locate Your Network Interfaces
Before you can start modifying your network interfaces to create a virtual one, you're going to need to find out exactly what they're called. Since RHEL switched to
systemd, interface names aren't as simple as they once were.
ip a to get a full read out of the interfaces on your system. The one you're connected to your network with will have a local IP address listed next to
How to Edit Your Main Network Configuration
Now that you know which interface you're looking to work with, you'll need to modify its configuration file to set up a static IP and make everything work. Open your configuration at
eth0 with the actual name of your interface.
BLUE SKY STUDIOS are looking for Linux Administrator to maintain and support the Studio's 450+ production Linux workstations, including daily interactions with the Studio’s digital animation artists.
LOCATION: Greenwich, Connecticut, USA
First, make any changes that you want to the file, like disabling IP6 support, if you don't want it. Then, change
At the bottom of the file, add entries for
DNS. Configure them to match your network.
Save your configuration, and exit.
How to Duplicate Your Network Configuration
You're going to use that original configuration that you just modified as the template for your new virtual networks.
cd into the
network-scripts directory to make this easier.
# cd /etc/sysconfig/network-scripts/
Then, copy the original to create two virtual network configurations.
# cp ifcfg-eth0 ifcfg-eth0:0 # cp ifcfg-eth0:1
How to Create The Virtual Interface Confg
ifcfg-eth0:0 to modify the
DEVICE attributes to match
eth0:0. Of course, use your actual device's interface in place of
eth0 here too.
Do the same with
ifcfg-eth0:1, this time filling in
eth0:1. For this one, you'll need to change the
IPADDR value too. Use a different IP that isn't used on your network.
When you're ready, and everything looks correct, restart your computer. You can try restarting the
NetworkManager service, but it has a tendency to be uncooperative.
After your computer comes back up, run
ip a again. You should see your virtual address this time, complete with the IP address that you set for it.
If you would like to test that your interface is working, you can send it a ping from another computer on your network.
There you have it! You can create multiple virtual network interfaces as you need. They'll remain active as long as your configurations remain in place.