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

The method of configuring static IP in Virtual Machine CentOS7

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "the method of configuring static IP in virtual machine CentOS7". In the daily operation, I believe that many people have doubts about the method of configuring static IP in virtual machine CentOS7. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "virtual machine CentOS7 configuration static IP method". Next, please follow the editor to study!

1. Set virtual machine network connection to bridge

2 set the virtual machine network connection to NAT

If it is in NAT network mode, the host sets the network sharing connection first.

Then check the address assigned by vmnet8 at the host terminal

Then configure the virtual network card

Set up NAT segments and gateways

3. Configure static IPvim / etc/sysconfig/network-scripts/ifcfg-ens33

Modify or add red configuration according to local ip, subnet mask and gateway

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=static

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33

UUID=d2cf1677-381e-45a5-958e-361225ca79f6

DEVICE=ens33

ONBOOT=yes

IPADDR=192.168.1.200

NETMASK=255.255.255.0

GATEWAY=192.168.1.1 # if it is bridged, it is configured as the gateway of the host. If it is in NAT network mode, it is configured as the gateway IP in the NAT setting, as shown in the NAT configuration above.

DNS1=8.8.8.8

Then restart the network service

Service network restart3. Modify hostname and add domain name resolution

Hostnamectl modifies hostname

Hostnamectl set-hostname myHostname

Add domain name resolution for hostname

Vim / etc/hosts

192.168.1.200 localhost centos

4. If under win10, the virtual machine ping does not connect to the host, but the host can ping the virtual machine and modify the firewall

Recommended reference method link

5. Set up Ali Cloud Image 1, back up mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.backup2, download the new CentOS-Base.repo to / etc/yum.repos.d/wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo3, and then run yum makecache to generate the cache

Clear cache: yum clean all

Generate cache: yum makecache at this point, the study on "virtual machine CentOS7 configuration static IP method" is over, I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

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

12
Report