Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does CentOS7 connect to the network in the way of NAT in VM12

2025-04-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Today, the editor will share with you the relevant knowledge points about how CentOS7 in VM12 connects to the network by NAT. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

1. The first step must be to install vm and centos. I used vm12 and 64-bit centos7.

Install centos7 on vmware (picture and text):

2. After they are all installed

1) the network link setting of the local host will have two more connections, and vmnet8 will be used for vmnet1 and vmnet8,nat. We will set its ip in detail later.

2) start vm and click "Virtual Network Editor" under "Edit"

Check vmnet8 and set the subnet and subnet mask, as shown in figure 1, where I use the default value. Then click "nat Settings" in figure 2.

Set the gateway as shown in the red circle in the figure, and the default value is also used here.

3) set the ip of the vmnet8 of the host. Here, the ip address of vmnet8 must be set to the same network segment as the subnet in step 2, and the gateway must be the same.

4) set the network adaptation of the virtual machine to nat mode

5) start the virtual machine, set the ip of the virtual machine, etc., and set it manually

Use the command:

# vim / etc/sysconfig/network-scripts/ifcfg-eno16777736

Edit the configuration file as follows:

Type=ethernetbootproto=staticdefroute=yespeerdns=yespeerroutes=yesipv4_failure_fatal=yesipv6init=noipv6_autoconf=noipv6_defroute=noipv6_peerdns=noipv6_peerroutes=noipv6_failure_fatal=noname=eno16777736uuid=61255d3d-2573-44ce-8109-8f61866f48cadevice=eno16777736onboot=yesipaddr=192.168.202.66netmask=255.255.255.0 gateway=192.168.202.2

The ip here needs to be in the same network segment as the ip of the vmnet8 in the host, and the gateway is the same.

6) set the dns of the virtual machine

# vim / etc/networkmanager/networkmanager.conf modify the file to add the "dns=none" option in the main section:

[main] plugins=ifcfg-rhdns=none

Networkmanager reloads the above modified configuration

# systemctl restart networkmanager.service

Manual modification / etc/resolv.conf

# generated by networkmanager# no nameservers found; try putting dns servers into your# ifcfg files in / etc/sysconfig/network-scripts like so:nameserver 192.168.8.150nameserver 192.168.8.8nameserver 8.8.8.8nameserver 114.114.114.11 domain=lab.foo.com bar.foo.com restart the virtual machine network card # service network restart

3. In this way, you can ping each other with the host and access the public network.

These are all the contents of the article "how CentOS7 in VM12 connects to the network in the way of NAT". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report