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

Virtual machine network settings commonly used in CentOS

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article focuses on "CentOS commonly used virtual machine network settings", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the network settings of virtual machines commonly used in CentOS.

Power off: shutdown-h now

Restart: reboot

Network settings: vi / etc/sysconfig/network-sripts/ifcfg-eth0 # sets network connection type, IP, gateway, subnet mask

Vi / etc/sysconfig/network # set the hostname

Vi / etc/resolv.conf # set up DNS

Restart the network service after service network restart # is set up

Virtual machine network settings:

Method 1: use bridging, set IP (same network segment as host), subnet mask (255.255.255.0), gateway (same as host) in / etc/sysconfig/network-sripts/ifcfg-eth0, open ONBOOT=yes, set BOOTPROTO=static. If the rest is not moved, the two-way access between the host and the virtual machine can be realized.

Method 2: use the network address translation NAT, set the BOOTPROTO=dhcp in / etc/sysconfig/network-sripts/ifcfg-eth0, open the ONBOOT=yes, and share the host network without setting the rest. When the host is using a wired network, the virtual machine can access the host, and the host cannot access the virtual machine. When the host is using the WiFi network, the virtual machine and the host can be accessed in both directions.

/ etc/sysconfig/network does not need to be set.

The DNS address in / etc/resolv.conf will be obtained automatically, which is consistent with that of the host

At this point, I believe you have a deeper understanding of "CentOS commonly used virtual machine network settings". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report