5 - Configure External network connectivity for Virtual machine

Prerequisites:

  • CentOS7 virtual machine on Hyper-V

Now that we have a CentOS system working on Internal network, that's good. Next let's bring it access to Internet.

 

Configure Internet access for CentOS:

  1. Make sure you shutdown CentOS properly before we move onto below steps
  2. Go back to Hyper-V, now we going to create another Virtual network switch
  3. Click on Virtual switch manager
  4. From the new prompt screen, highlight New Virtual network switch -> External -> Create Virtual Switch
    5 - Configure External network connectivity for Virtual machine
  5.  You will get a new configure sreen. Put name External-VM-Switch ( Whatever the name you like is fine ) for new external switch, Connection type we choose to External networks this time, then choose the network you have on your local host Windows 10, here i am using wireless WIFI, then click OK

    5 - Configure External network connectivity for Virtual machine
  6. Once created the external switch, you can also find it on Network sharing center on your Windows 10 system.
    Windows Home Button -> Control Panel -> Network and sharing center -> Change adapter settings
    5 - Configure External network connectivity for Virtual machine
  7. Now we've done for create external network switch, now we can apply it to CentOS, to let CentOS access to internet
  8. Highlight k8s-master on Hyper-V, right click -> Settings -> highlight Add Hardware - Select network adapter, We are going to add another network device to virtual machine, click on Add
    Note: If you got options Add Hardware, Network Adapter greyed out, that means you haven't shutdown your CentOS system it's still running !
    5 - Configure External network connectivity for Virtual machine
  9. For the new introduced Network adapter, we make it apply to External-VM-Switch this time
    Believe you will notice we now have 2 Network adapter for our Vitual machine now, as below:
    Network Adapter 1 - using switch Internal-VM-Switch - It's for internal access local host remote to virtual machine
    Network Adapter 2 - using switch External-VM-Switch - it's for external access let CentOS wave to Internet
    5 - Configure External network connectivity for Virtual machine
  10. Now it's time to give it a try from Vitual machine access to Internet, release the monster !
  11. Start and connect virtual machine again, try ping to www.baidu.com
    5 - Configure External network connectivity for Virtual machine
  12.  Working as expected, awesome ! Now we have enabled Virtual machine CentOS access to Internet.

    Remebmer to apply the same for another vitual machine k8s-node1 from step 8 to 11

上一篇:linux pread/pwrite


下一篇:C++ 自动锁