The static IP setup under CentOS 8 and Hyper-V is very simple. There are only a few steps before we are up and running.

First we will need to find the IP address of the default Gateway(the host machine) and see which IP addresses will be assigned.

Get the Gateway IP

Just open a Command Prompt(CMD) or PowerShell and then check the IP address of the Virtual Switch Gateway:


You can read more about the Virtual Switch management in this very useful article –

The default IP range of the Virtual Switch by default is under a class B network and ranges from 172.24.XX.XX/16.

In this case the Internal Host IP is this means that we can use it as a gateway in the NetworkManager.

Set the static IP of the VM

First make sure that you are editing the correct interface:

ip a
Network Interface
nmtui-edit eth0

Then edit it from:

eth0 connection edit

To a manual IPv4 configuration:

Restart the NetworkManager

sudo systemctl restart NetworkManager.service
# Or
sudo nmcli networking off
sudo nmcli networking on
Before DHCP assigned IP –
After Static IP –

Overall this is everything that we have to do in order to assign a static IP to CentOS 8 under Hyper-V.

Thanks for reading!

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.