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 to set the network of centos6.5 in virtual machine VirtualBox

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to set up the network of centos6.5 in virtual machine VirtualBox". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to set up the network of centos6.5 in the virtual machine VirtualBox.

Virtual machine network configuration

Only the network card 1: mode nat (corresponding to ifcfg-eth0) is set by default.

We can also set up network card 2 and network card 3. It can be set after the system installation is complete.

The network card 2 sets the loop network card to realize the virtual machine and the host to form a local area network (corresponding to ifcfg-eth1), so that it can form a local area network even if there is no router, and ssh connection can be carried out.

Host is required to install microsoftloopbackadapter. Participate in the appendix.

The network card 3 is set to connect to the Internet and form a local area network (corresponding to ifcfg-eth2) with the host. You need to rely on the network and have a real router.

2. Eth setting in centos

Enter the / etc/sysconfig/network-scripts directory, and only ifcfg-eth0 is available by default.

Copy ifcfg-eth0 to ifcfg-eth1 and modify it to:

Device=eth1#hwaddr=08:00:27:31:f1:dctype=ethernet#uuid=b8f8e76e-1f8b-4cf5-9261-493bfc6b04efonbootpropyesnmparts controlledbootprotoprotozoites cipaddr = "192.168.12.10" gateway= "192.168.12.1"

Copy ifcfg-eth0 to ifcfg-eth2 and modify it to:

Device=eth2#hwaddr=08:00:27:31:f1:dctype=ethernet#uuid=b8f8e76e-1f8b-4cf5-9261-493bfc6b04efonboot=yesnm_controlled=yesbootproto=dhcp

After saving, use the command: servicenetworkrestart to restart the network service. If ifcfg-eth1 and ifcfg-eth2 are displayed in green, the settings are successful.

Example of the contents of the Nic file:

Device=eth0 / / indicate device name bootprot=static / / boot type dhcp | staticbroadcast=192.168.1.203 / / broadcast address hwaddr=00:06:5b:fe:df:7c / / hardware mac address ipaddr=192.168.0.2 / / ip address netmask=255.255.255.0 / / Subnet Mask network=192.168.0.0 / / Network address gateway=192.168.0.1 / / Gateway address onboot=yes / / whether to start the application of type=ethernet / / network type

To verify the results, you can enter ifconfig to verify:

[root@localhost network-scripts] # ifconfigeth1 link encap:ethernet hwaddr 08:00:27:e9:68:b0 inet addr:192.168.12.10 bcast:192.168.12.255 mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fee9:68b0/64 scope:link up broadcast running multicast mtu:1500 metric:1 rx packets:1682 errors:0 dropped:0 overruns:0 frame:0 tx packets:775 errors:0 dropped:0 overruns : 0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:134511 (131.3 kib) tx bytes:109027 (106.4 kib) eth2 link encap:ethernet hwaddr 08:00:27:2e:18:7a inet addr:192.168.36.85 bcast:192.168.36.255 mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe2e:187a/64 scope:link up broadcast running multicast mtu:1500 metric:1 rx packets: 885 errors:0 dropped:0 overruns:0 frame:0 tx packets:42 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:72712 (71.0 kib) tx bytes:4156 (4.0 kib) lo link encap:local loopback inet addr:127.0.0.1 mask:255.0.0.0 inet6 addr: 1thumb 128 scope:host up loopback running mtu:16436 metric:1 rx packets:12 Errors:0 dropped:0 overruns:0 frame:0 tx packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 rx bytes:1028 (1.0 kib) tx bytes:1028 (1.0 kib)

It shows that eth1 and eth2 are successful.

Appendix:

The method of installing Microsoft microsoftloopbackadapter (Loop Network Card) on windows7

1. Click the start icon, enter hdwwiz in the search, right-click the program in the search results, and start using the "run as administrator" mode.

two。 According to the operating system wizard, select install the hardware I manually selected from the list (Advanced).

3. In the hardware list, select Network Adapter.

4. Select the "microsoft" vendor and select "microsoftloopbackadapter" in the list of network adapters on the right, and then follow the wizard to complete the installation.

5. After the installation is complete, check the hardware manager, there will be a new network card, this is the virtual network card.

Next, you need to do some configuration:

Open the Network and sharing Center-> change the adapter settings, find the network with microsoftloopbackadapter, right-click the properties, select internet Protocol version 4 (tcp/ipv4), click the properties below, and edit as:

The gateway here is defined by myself, which is 192.168.12.1. Of course, it can be changed to something else, such as 192.168.13.1. The ip of the host here is 192.168.12.2, which cannot be set to this in the virtual machine. This corresponds to the virtual machine eth1, and the ip of eth1 is also derived here. Just save it after modification.

Note that the loopback network card is best set up before setting up the virtual machine network.

At this point, I believe you have a deeper understanding of "how to set up the network of centos6.5 in the virtual machine VirtualBox". 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

Development

Wechat

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

12
Report