[Linux] Configure static IP on Centos 8
- VirtualBox 6.1
- CentOS – release 8.1.1911 (Core)
A few time ago I started studying a little bit about SQL Server and in order to do that I wanted to test the Linux Version.
So, after I installed a CentOS release in a VirtualBox Machine, O needed to configure a static IP address.
1 – Configure Network Card
The virtual machine had to both connect Internet and be reachable from my LAN, so to make it possible I configured two different Network Cards inside machine configuration in Virtual Box.
NAT: it allows outbound connections like Internet
Host-only networking: it allows to assign an internal IP address and let the machine be reachable from the PC where you’re running VirtualBox
First of all you have to configure a virtual network adapter inside Virtual Box and give it a range of IP addresses (for instance 192.168.58.X).
After created the adapter, I had to modify virtual machine network property:
2 – Create a connection
Linux gives you a useful tool, called nmtui, to create a new connection.
You just have to type nmtui in Terminal and it will be launched.
Choose “Add” and “Ethernet” option:
Then you have to type a connection name and an IP address, for example:
Click ok and reboot the virtual machine.
To check if the new connection has been created:
To test if the machine is reachable from your workstation, just use ping: