Score:0

RHEL 7 in Hyper-V with Proper NAT Configuration Issues

gf flag

I have a RHEL7 VM running on Hyper-V. In my VM, I have a web-based program the I need to access over port 11000. In the VM, the software is configured and is accessible by https://0.0.0.0:11000.

I've tried setting up an external v-switch and internal v-switch, both have not been successful as I cannot even ping the virtual switch from within the VM. I am trying to configure this using a NAT Switch.

Here is how I configured the network interface from the host in powershell.

PS> New-NMSwitch -SwitchType Internal -SwitchName "LINK"
PS> New-NetIPAddress -IPAddress "192.168.122.1" -PrefixLength 24 -InterfaceAlias "vEthernet (LINK)"
PS> New-NetNAT -InternalIPInterfaceAddressPrefix "192.168.122.0/24" -Name "LINK-NETNAT"
PS> Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 11000 -InternalIPAddress "192.168.122.2" -InternalPort 11000 -Protocol TCP -NatName "LINK-NETNAT"

I also allowed the port traffic through Windows firewall:

New-NetFirewallRule -DisplayName "HyperVNAT" -Direction Inbound -LocalPort 11000 -Protocol TCP -Action Allow

All of these commands ran with no issues. I assumed they worked because Network Devices were created with the appropriate parameters provided above.

virbr0 is configured as 192.168.122.1

I setup eth0 as the following:

eth0 is set to manual addressing as IPv4
Address: 192.168.122.2
Gateway: 192.168.122.1
Netmask: 255.255.255.0

DNS and Routes were left as automatic.

Here is a screenshot of ip addr

screenshot - ip addr

When I try to access https://192.168.122.2:11000 I get no response.

From the VM, I can only ping 192.168.122.1 and nothing on the outside.

From the Host, I can ping 192.168.122.1, but no other IP that's inside of the VM. (.122.2 just times out)

My ultimate goal is to be able to access the web interface that is in the VM on port 11000 from the host machine.

Will Roberts avatar
gf flag
This appears to be an issue with the virtual machine environment specifically related to IP tables. Adding rules based on this [post](https://serverfault.com/questions/170079/forwarding-ports-to-guests-in-libvirt-kvm), has allowed me to ping the VM from the host. I think I need to enable other ports to see if it will work.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.