How to Make Internet Work on a Rocky Linux VirtualBox VM
Recently I needed to make a VirtualBox VM with the Rocky Linux inside (for the record, it was Rocky Linux 8.10 and VirtualBox 7 something). The installation went smoothly. I didn’t change the default settings, only adjusted CPU, memory and HDD. To my surprise despite this off-the-shelf configuration, after I got to the desktop I discovered that the Internet does not work. For example ping 8.8.8.8
gave connect: Network is unreachable
.
As a spoiled Ubuntu user I was sure that I simply need to type my problem into Google to get the solution. To my surprise nothing like “rocky linux in virtual box network configuration”, “network in rocky linux on virtual box” etc. gave any relevant results. I guess Rocky Linux users are just more skilled than Ubuntu users and they don’t ask such trivial question π
For the rest of us, the instructions are below.
Rocky Linux 8 after fresh installation on the VirtualBox has three interfaces lo
, enp0s3
and some virbr0
.
enp0s3
is our VBox NAT adapter, see MAC address:
By default only virbr0
is active and enp0s3
is down:
nmcli general status
Solution is simple, just enable enp0s3
:
nmcli con up enp0s3
To make it survive reboot we need to enable automatic connection.
There should be a nmcli
command to do that, but at this point I realized that there is a neat command nmtui
, so I just navigated through the TUI and set a checkbox π
That’s it, now the Ineternet just worksβ’ β¨
Btw, the same steps apply to Alma Linux and other RHEL derivatives.
References
-
Rocky Linux Documentation: Network Configuration
-
Red Hat Documentation: Configuring IP Networking with nmcli