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

Centos6.9 network configuration of virtualbox on MAC

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Use virtualbox on mac to virtualize virtual machines.

The network requirements for virtual machines are

1. Can communicate with the host.

two。 Virtual machines can communicate with each other.

3. The virtual machine is connected to Internet.

Double network cards are adopted, one network card is bridging mode and the other is nat mode. The configuration is as follows

The first step is to add a NAT network in the virtualbox preferences.

Preferences-> Network-> Click the plus sign on the right to add a NAT network.

The second step is to find the management in the virtualbox toolbar and add only-host

Toolbar-- > Administration-- > Host Network Management-- > create, and click ok after creation.

Step 3: click Settings on the installed centos (in shutdown state)

Set-- > Network-- > add two network cards (you can only add network cards when you are off), namely NAT network and host-only (HOST-Only) network.

The above MAC address will be used in the network card configuration file below, otherwise an error will be reported!

After the above is done, start Centos, go to the management interface, and edit the corresponding configuration file.

The configuration file is under this directory: / etc/sysconfig/network-scripts/, the default network configuration file is: ifcfg-enp0s3 (if it is Centos6, the file name is ifcfg-eth0)

Edit the file ifcfg-enp0s3 (if it is Centos6, the file name is ifcfg-eth0) and change the ONBOOT=no in it to ONBOOT=yes

[root@localhost network-scripts] # pwd/etc/sysconfig/network-scripts [root@localhost network-scripts] # cat ifcfg-eth0DEVICE=eth0HWADDR=08:00:27:3D:1B:C7TYPE=EthernetUUID=194fd333-b868-4Debtel 82f0123aaONBOOTPROTPROTO = dhcp [root @ localhost network-scripts] #

Exit the save and restart the network. Exit is: wq, restart the network service network restart

At this time, you can connect to the public network. Ping Baidu to try.

At this time, it is connected to the public network, but it is still dynamic ip in the same way as the host, but we need a static ip, that is, the second network card we added. At this time, we need to set the static ip.

The file corresponding to the above NAT network card is ifcfg-enp0s3 (if it is Centos6, the file name is ifcfg-eth0), then make a copy of this file and change it to ifcfg-enp0s8 (if it is Centos6, the file name is ifcfg-eth2)

Copy through the copy command, cp ifcfg-enp0s3 ifcfg-enp0s8

If it is Centos6, the command is cp ifcfg-eth0 ifcfg-eth2

After copying, edit the file ifcfg-enp0s8 (or ifcfg-eth2 if it is Centos6) and modify some of the configurations.

The things that need to be modified are

Change BOOTPROTO=dhcp to BOOTPROTO=yes

Change NAME=enp0s3 (or eth0) to NAME=enp0s8 (or eth2)

Change DEVICE=enp0s3 (or eth0) to DEVICE=enp0s8 (or eth2)

UUID also needs to be modified. UUID can generate a new one. Type uuidgen directly on the command line, and enter the result and copy the result.

The HWADDR of the main network card also needs to be modified. Refer to the red box in the screenshot above.

Add

IPADDR=192.168.56.119 (within the ip range of the second Nic added, the first move is 192.168.56.101Murray 192.168.56.255)

NETMASK=255.255.255.0

Note: IPADDR and NETMASK are not written here, but the default dhcp can be used, as follows

[root@localhost network-scripts] # cat ifcfg-eth2DEVICE=eth2HWADDR=08:00:27:82:28:E8TYPE=EthernetUUID=194fd343-b868-4 debenture 82fetel 20082f0123aaONBOOTPROTODROLLEDPROTOD = dhcp [root @ localhost network-scripts] #

After the setup is complete, save and exit. Restart the network, at this time there is also a static ip, you can try to ping the corresponding network.

Ping 192.168.56.1 (gateway is accessible)

Ping 192.168.56.119 (oneself)

Through the host terminal to ping the virtual machine to see if the two communicate, the result is communication, everything ok.

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