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:
- Make sure you shutdown CentOS properly before we move onto below steps
- Go back to Hyper-V, now we going to create another Virtual network switch
- Click on Virtual switch manager
- From the new prompt screen, highlight New Virtual network switch -> External -> Create Virtual Switch
-
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
- 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
- Now we've done for create external network switch, now we can apply it to CentOS, to let CentOS access to internet
- 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 !
- 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
- Now it's time to give it a try from Vitual machine access to Internet, release the monster !
- Start and connect virtual machine again, try ping to www.baidu.com
-
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