In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to set up a fixed IP in the Hyper-V virtual machine. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
Set virtual machine fixed IP
You need to set a fixed network segment and static IP for the virtual machine. I use the network segment of 192.168.137.X here.
Ubuntu 18.04 uses netplan as the network configuration management, no need to restart the system
Sudo vi / etc/netplan/50-cloud-init.yamlnetwork: ethernets: eth0: addresses: [192.168.137.200/24] gateway4: 192.168.137.1 dhcp4: true optional: true version: 2sudo netplan apply
DNS configuration (you can do without changing it)
DNS still uses resolv.conf
Sudo vi / etc/resolv.conf
Virtual network settings on Hyper-V
Open the virtual switch manager on Hyper-V:
Create a new virtual network switch, select the internal network, click OK, and enter a name:
Right-click the setting options for the virtual machine to be set, pop up the box below, select the virtual switch of the newly created ubuntu, click OK, and then restart the virtual machine to take effect:
Network settings on the physical machine
I use win10 on this computer. Open Control Panel-> Network and sharing Center-> change adapter settings.
Find the virtual network switch that has just been added to hyper-v, right-select Properties-> Select the following IPv4 protocol-- > set the following IP address and subnet mask. The rest can be left blank. The IP address must be the setting of 192.168.X.1. Here is the network segment we just set on ubuntu, which needs to be consistent.
After the above settings are set, the virtual machine can be accessed on the local physical machine, as shown in the 192.168.137.200 under our ping. It can be seen that ping can be connected, and then you can use terminals such as xshell to connect:
Set the virtual machine to connect to the public network
If you need to access the public network on the virtual machine, in Control Panel-> Network and sharing Center-> change Adapter Settings, select the network card used by the physical machine at this time, right-click the sharing option, select the check box below, select our new network on hyper-v, and click OK, so that our virtual machine can share access to the external network after the operation.
Finally, you can use ping www.baidu.com in the virtual machine for authentication.
PS: if you can directly ping Baidu's ip, but if ping www.baidu.com is not available, you need to configure DNS.
Ping 163.177.151.110 # An ip of Baidu modifies DNS as follows: [root@centos7 ~] # cat / etc/resolv.conf # Generated by NetworkManagersearch mshome.netnameserver 8.8.8.8nameserver 8.8.4.4
The above is how to set the fixed IP in the Hyper-V virtual machine, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.