Configure network and bind dual network card mode under cent os7 virtual machine

1.cent os7 virtual machine configuration network

1.1.NAT mode

First, set it to nat mode and configure it to dhcp to surf the Internet.

1.2. Bridged network card mode

Configuration method
This article is written very clearly, many of the steps are actually not configured or only need to configure the network card.


Record a problem encountered:
Today, I used the bridge mode on the virtual machine cent os7 to configure static ip to surf the Internet. Because I am a little white + rookie, it has been failing. Record the whole process and my debugging test process. I hope the big guy can Give some answers or enlightenment.

0. Background

The computer is a laptop with only one network card, and then use the wireless network card to connect to the wlan Internet access, install the vm virtual machine, the virtual machine is installed CENT OS7, the goal is to use the bridge mode, configure the static ip, so that the virtual machine can be connected The school’s internal and external networks. Before the virtual machine used NAT mode, and then used dhcp to automatically obtain the ip, there is no problem with the Internet in this way, and both the ping internal and external networks are connected.

1. Connecting to the campus network always fails

First I connect to the campus network, and then configure the virtual machine. The configuration information of the network card ens32 is changed, except for the ip address, the rest are kept consistent with the host, and the ip address is kept on the same network segment. Then use cent os7 to ping the host and successfully ping through, and use the host ping cent os7 to successfully ping through. If you use the host to ping GATEWAY, there will be redirection, and the transmission will fail. If the ping is different, ping Baidu and other internal and external networks cannot be pinged.
** Problems that can be basically eliminated: ** 1. The virtual machine configuration is incorrect, the host configuration is incorrect, this problem has been basically eliminated, the bridge mode configuration must be no problem, the host configuration must be no problem; 2. DNS, GATEWAY, NETWASK If the configuration is incorrect, these configurations are definitely ok; 3. Linux operation problems, certainly no problem; 4. ip configuration (I am not sure if this is okay, but I have checked the problem of ip conflict, not because the ip address is occupied So it fails).

2. Connect the mobile phone hotspot wlan, successful

Next, I changed the campus network to the mobile phone wlan, using the same configuration method as above, and then the host and the virtual machine ping each other, both of them ping through without any problems, ping the gateway, there is a redirect, and there are some errors, but the ping is successful Yes, when I ping Baidu, there is a redirect and errors, but I successfully ping through, log in to the external network, and successfully access.

3. Questions

1. Why is it not possible to use the campus network, just use a mobile phone;
2. What does the redirect mean when pinging the gateway and the external network, and why I receive some errors;

I beg the boss for some hints. Recently, we are going to configure the server running data, but these are completely white. Alas, if a boss can help to give some answers, I would be very grateful, you can bg.

Attached drawing

The screenshot when connecting to the mobile hotspot and pinging the Internet
Insert picture description here

Temporary understanding
Today, I conducted an experiment again, and I felt that it should be caused by the school network. Under the windows host, I changed the dhcp dynamic acquisition ip to a static ip, but it failed to get online. Then I did the same experiment with the mobile phone hotspot, and I was able to surf the Internet successfully, so is it because the school network does not allow static ip under wlan? it's wired

2. Centos 7 binds dual network cards

First of all, I looked at the dual network card configuration in linuxprobe, but it failed. After that, I checked a lot on the Internet and it didn't work. Finally, the configuration was successful according to the entire article. The key is that there is an extra step:
Insert picture description here
before restarting the network has been failing, after following this article, it succeeded, and then if there are problems, remember to restart and try. If successful, use this command to view the information of the bound network card should look like this: cat /proc/net/bonding/bond0

Insert picture description here


Finally, post my configuration:
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
ping Baidu successfully:
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_39805362/article/details/107107510