none
hyper-v , can't connect to internet from virtual machine

    Question

  • Hi,

    I'm new in hyper-v and i have some problems in a new created virtual machine, i want to connect the virtual machine in same subnet with physical server ( 192.168.20.x ), virtual switch has 192.168.37.1 IP, if i set IP manually ( from 192.168.20.x ) to virtual switch or in virtual machine, nothing works ( ping,trace, share etc ) and don't know why.

    Server ( 2012R2 ) gets DHCP from a router

    Virtual switch in hyper v is "external" created with "allow management operating system.." but vm don't get any IP from router.

    How can i set/get manually/auto IP from same subnet with physical server ( 192.168.20.x )  ?

    Monday, February 27, 2017 9:35 AM

All replies

  • Hi,

    If your Hyper-V server has IP example 192.168.0.20 then the Virtual Machines will also be on that network 192.168.0.X as default. Virtual switch will also be on that network because when you create virtual switch you are pointing to physical network adapter. If that network adapter is on 192.168.0.0 network and you are not using VLANs than everything will work out-of-the-box

     What do you mean by virtual switch has 192.168.37.1 and hyper-v has 192.168.20.X?







    • Edited by Nedim Mehic Monday, February 27, 2017 11:57 AM
    Monday, February 27, 2017 11:52 AM
  • I agree with Nedim that your explanation is not clear.  Virtual switches do not have IP addresses.  When you create an external virtual switch on a NIC on the host, all IP protocols are removed from that NIC and replaced with Microsoft's virtual switch protocol.  There is no way to assign an IP address to the virtual switch.  If you have made changes to the network settings of the physical NIC after you created the virtual switch on that NIC, you have created a completely unsupported/unworkable environment.

    Networking in the virtual environment works the same as networking in the physical environment.  When you create an external virtual switch on the host and share the switch with the host OS, the host receives a virtual NIC.  You configure that virtual NIC the same as you would a physical NIC.  The configuration can be handled either by DHCP or static assignment.

    Please post the text output from ipconfig /all for the working host and the non-working VM.


    . : | : . : | : . tim

    Monday, February 27, 2017 1:11 PM
  • Hi,

    That is the problem, virtual machine don't gets any IP address from DHCP router/server, don't work even i manually set the IP from router subnet.

    If i check "Allow Other Network Users to Connect Through This Computer’s Internet Connection" in physical NIC, virtual switch from hyper-v automatically gets 192.168.37.1 IP and i can connect to internet. if i manually set IP to vm from dhcp router, the connection to the internet won't work.

    In my case, nothing works out-of-the-box and i don't know why


    Monday, February 27, 2017 3:02 PM
  • Hi,

    Sorry for my unclear explanation.

    It's a windows server 2012 r2 ( with hyper-v role )

    This is configuration from physical windows 2012r2 with hyper-v manager, connection to internet is ok with 192.168.20.10 to physical NIC :

    Windows IP Configuration

       Host Name . . . . . . . . . . . . : WinSrv2012
       Primary Dns Suffix  . . . . . . . :
       Node Type . . . . . . . . . . . . : Hybrid
       IP Routing Enabled. . . . . . . . : No
       WINS Proxy Enabled. . . . . . . . : No

    Ethernet adapter vEthernet (VirtualSwitch):

       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
       Physical Address. . . . . . . . . : 14-02-EC-07-F6-CF
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::9450:c1a0:4349:93ff%26(Preferred)
       Autoconfiguration IPv4 Address. . : 169.254.147.255(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.0.0
       Default Gateway . . . . . . . . . :
       DHCPv6 IAID . . . . . . . . . . . : 437519084
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-20-38-C8-3B-14-02-EC-07-F6-CF
       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled

    Ethernet adapter Embedded LOM 1 Port 1:

       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet #4
       Physical Address. . . . . . . . . : 14-02-EC-07-F6-CC
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::e4eb:19fd:(Preferred)
       IPv4 Address. . . . . . . . . . . : 192.168.20.10(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . : 192.168.20.1
       DHCPv6 IAID . . . . . . . . . . . : 252969708
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-20-38-C8-3B-14-02-EC-07-F6-CF
       DNS Servers . . . . . . . . . . . : 192.168.20.1
       NetBIOS over Tcpip. . . . . . . . : Enabled

    Ethernet adapter Embedded LOM 1 Port 3:

       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet #3
       Physical Address. . . . . . . . . : 14-02-EC-07-F6-CE
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes

    Ethernet adapter Embedded LOM 1 Port 2:

       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet #2
       Physical Address. . . . . . . . . : 14-02-EC-07-F6-CD
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes

    Tunnel adapter isatap.{1F5FA11F-BCE4-41A7-9449-7983FDE3776C}:

       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes

    Tunnel adapter Teredo Tunneling Pseudo-Interface:

       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes

    Tunnel adapter isatap.{C21DFF2E-B35A-42DA-BBD9-CF7B16D7CCA0}:

       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
       
       This is config from VM with no connection to internet :


    host name...............win-srv
    primary dns suffix .....
    node type...............mixed
    IP routing enabled......no
    WINS proxy enabled......no

    Ethernet adapter ethernet 5:

    connection-specific DNS suffic......:
    description..........................microsoft hyper-v Network #5
    physical address.....................00-15-5d-73-05
    DHCP enabled.........................no
    autoconfiguration enabled............yes
    link-local IPv6 address..............
    IPv4 address.........................192.168.20.20(preferred)
    subnet mask..........................255.255.255.0
    default gateway......................192.168.20.1
    DNS servers..........................192.168.20.1
    NetBIOS over Tcpip...................enabled

    tunnel adapter isatap

    media state.......................media disconected
    connection-specific DNS suffix....
    description.......................microsoft ISATAP adapter #2
    physical address..................00-00-00-00-00-00-00-E0
    DHCP enabled......................no
    autoconfiguration enabled.........yes

    Monday, February 27, 2017 7:30 PM
  •   Did you look at the config of the guest before you posted it? It shows that the guest has an IP of 192.168.20.20 . That is what you have been telling us does not happen. Did you set it to this value manually?

       If the vm works if you set the host to use ICS and get an IP of 192.168.137.x , I would guess that you have bridged the external network to the wrong NIC of the server. It should be bridged to the NIC which has the Broadcom Gigabit NIC which has the 192.168.20.10 IP address.


    Bill

    Tuesday, February 28, 2017 3:38 AM
  • Hi,

    I set the address manually for guest NIC , and didn't work, then i posted it here

    i have bridged the NIC ( 192.168.20.10 ) from begining, but this will create a different subnet and i don't want that

    strange is why this configuration is not working, everything is fine ( i think ), the virtual switch should act like a switch, i set the IPs manually, should i enable another service or another role on guest machine or physical machine?

    Tuesday, February 28, 2017 7:08 AM
  • "Server ( 2012R2 ) gets DHCP from a router"

    According to the output of ipconfig, no, the server is not getting DHCP.  It is configured with a static address.

    Furthermore, the host is using one NIC (working) to connect to the internet, and the virtual switch is configured on another NIC.  Do you have a network cable connected from this second to the router so there is a physical connection between the VM and the router?


    . : | : . : | : . tim

    Tuesday, February 28, 2017 1:56 PM
  • Hi,

    I set the address manually for guest NIC , and didn't work, then i posted it here

    i have bridged the NIC ( 192.168.20.10 ) from begining, but this will create a different subnet and i don't want that

    strange is why this configuration is not working, everything is fine ( i think ), the virtual switch should act like a switch, i set the IPs manually, should i enable another service or another role on guest machine or physical machine?

      That makes no sense at all to me. If your external virtual switch is bridged to the Broadcom Gigabit NIC which has the IP address 192.168.20.10, all of the guests attached to that switch will get there IP addresses from DHCP on the physical router and will be in that same subnet. They would not be in a different subnet as you claim.

      Perhaps it would be better if you told us what you want to achieve rather than what you have done.

      As Tim said, when you enabled "Allow management......." so that the host had a vNIC on your switch, it did not get an IP from the router. This confirms that your virtual switch is not bridged to the physical network which contains the router.


    Bill

    Wednesday, March 01, 2017 3:35 AM
  • May be you should check if you chose  the correct virtual switch on your Hyper-V manager.

    On the Hyper-V manager Go to settings -> Network Adapter -> then choose the virtual switch you want

    Thursday, June 21, 2018 11:50 AM
  • Hi 

    I think you are using 192.168.20.10 for your hyper-v host  that is configured on Ethernet adapter Embedded LOM 1 Port 1

    May I know the adapter on the Hyper-V host which is used to create the vSwitch?

    Also I see except Ethernet adapter Embedded LOM 1 Port 1 other adapters status are media disconnected

    Please check the physical connectivity to the switch. Also ensure that the port on the switch where this interface will connect is allowed the required vLAN

    Regards,
    Bala N

    Thursday, June 21, 2018 12:14 PM