码迷,mamicode.com
首页 > Web开发 > 详细

4 - Configure Internal network connectivity for Virtual machine

时间:2021-06-05 18:04:36      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:option   comm   down   otp   details   tar   图片   apply   upd   

Prerequisites:

  • CentOS7 virtual machine on Hyper-V

Now we have a working CentOS7 virtual machine on Hyper-V. Let‘s configure the Internal network for it, then we can access CentOS from host system (Windows 10) with xshell or MobaXterm.

Check network details from local host Windows 10, which Virtual switch will be followed with. Launch CMD then enter ipconfig.
My local host will be like:

IPv4 address: 192.168.0.113

Subnet mask: 255.255.255.0

技术图片

 

 

 

Setup Internal network:

  1. Create Internal Virtual switch from Hyper-V. Click on Virtual Switch Manager 
    技术图片
  2. On new prompt Virtual switch manager window, highlight New virtual network switch, and select with Internal, then click on Create Virtual Switch
    技术图片
  3.  From next creation screen, enter vitual switch name as Internal-VM-Switch (What name you like will be fine), select to option Internal network, then click on OK
    技术图片

  4. Config IP for Internal-VM-Switch
    Once creasted a virtual network switch on Hyper-V, you can see it from network options and sharing from Control Panel
    Windows Home Button -> Control Panel -> Network and sharing center -> Change adapter settings
    技术图片

  5. Update virtual switch IP to align with Host machine ( Windows 10 )
    Right click on Internal virtual switch -> Properties -> highlight Internet protocol version 4(TCP/IP) -> Properties -> Setup IP and Subnet mask to align with local host Windows 10 -> click OK
    Note: My local host IPv4 range is 192.168.0.113, so the range will be 192.168.0.xxx, here virtual switch IP put up one different with host IP will be fine. Then put up with same subnet mask 255.255.255.0
    技术图片
  6. Now we have Done create Virtual network switch and configure from Hyper-V
  7. Configure network for CentOS, before that, make sure you have shutdown CentOS
  8. Go back to Hyper-V, right click on k8s-master -> settings -> highlight Network Adapter -> Virtual switch make selection to the one we just created Internal-VM-Switch -> click on Apply
    技术图片
  9. Now Start and Connect to vitual machine k8s-master again, login with root user
  10. Config network adapter, enter below command and edit accordingly
    vi /etc/sysconfig/network-scripts/ifcfg-eth0
    技术图片

     

    To sumarrize update/add below fields:

            BOOTPROTO=static
            ONBOOT=yes
            IPADDR=192.168.0.161
            NETMASK=255.255.255.0
            GATEWAY=192.168.0.1
            DNS1=192.168.0.1
            BROADCAST=192.168.0.255

  11. Save above update and quit, enter below command restart network service, then check network details
    systemctl restart network
    ip addr

    技术图片
  12. Now try to ping this CentOS from local host ( Windows 10 ), it‘s working perfectly!
    技术图片
  13. Next connect to CentOS with xshell or MobaXterm, i go with MobaXtern Community Edition since it‘s FREE
    技术图片
  14. So far all good. Next we will configure external network for CentOS to enable Internet access for it.
    Remember to apply the same settings for another virtual machine k8s-node1 from step 7 to 13

4 - Configure Internal network connectivity for Virtual machine

标签:option   comm   down   otp   details   tar   图片   apply   upd   

原文地址:https://www.cnblogs.com/waynewei/p/14851944.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!