If you want to use the Linux environment on a Windows machine, the most convenient way is to use virtual machines, the most commonly used software you are certainly not unfamiliar, the well-known VMware.

However, this thing is a little bit not so smart, every time after installing Linux, the network is not working, not once can be installed directly to use.

I simply record what needs to be modified:

First, let’s look at the current nic configuration. Because I am installing Centos mini, I can only use the IP addr command.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0 C :29:fd:6b:a2 BRD FF: FF: FF: FF: FF inet 192.168.128.100/24 BRD 192.168.128.255 Scope Global noprefixRoute ens32 valid_lft forever preferred_lft forever inet6 fe80::e1c0:881a:5ae3:f915/64 scope link noprefixroute valid_lft forever preferred_lft foreverCopy the code

You can see two network adapter configurations, one is the local loopback network of LO, which we do not need to care about, and the other is the network configuration of ENS32, which we need to change (here is the configured network adapter configuration, the newly installed machine has not configured the network, so the display will be different).

Next, modify the Linux nic configuration:

The configuration address of ens32 nic is /etc/sysconfig/network-scripts/ifcfg-ens32.

Open up the ens32 initial configuration, as follows:

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
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="ens32"
UUID="6e1b5eaf-21ab-486b-8378-3f0fd92bf969"
DEVICE="ens32"
ONBOOT="yes"
Copy the code

There are two configurations that need to be noticed: BOOTPROTO and ONBOOT.

BOOTPROTO is a network type. The possible options are static, DHCP, and BOOTP. The IP address obtained through DHCP and BOOTP respectively corresponds to the IP address specified in the static state.

I’m going to change it to static, because I want to use static IP, otherwise I have to change the IP every time I start the SSH link tool, which is too much trouble.

ONBOOT must be set to yes, which indicates whether the nic is automatically activated during system startup. Otherwise, you need to manually enter a command to start the NIC after the system starts.

Next, you need to add the following information:

IPADDR = 192.168.128.100 GATEWAY = 192.168.128.2 NETMASK = 255.255.255.0Copy the code

NETMASK is the subnet mask. 255.255.255.0 is the default.

GATEWAY is the GATEWAY address, which should be found in the NAT network configuration of VMware. Otherwise, different networks will not be able to pass the GATEWAY.

IPADDR is the IPV4 address, that is, the final IP address used, but cannot be written randomly, the first three paragraphs must be consistent with the gateway, and the last one should be written randomly, which does not exist.

Next, restart systemctl restart network.

Then try ping Baidu:

[root@localhost ~]# ping www.baidu.com
ping: www.baidu.com: Name or service not known
Copy the code

PING the domain name from directory Assistance

[root@localhost ~]# ping 114.114.114.114 ping 114.114.114.114 (114.114.114.114) 56(84) bytes of data. 64 bytes from 114.114.114.114: icmp_seq=1 TTL =128 time=55.3 ms 64 bytes from 114.114.114.114.114: Icmp_seq =2 TTL =128 time=80.6 ms 64 bytes from 114.114.114.114: ICmp_seq =3 TTL =128 time=70.2 msCopy the code

Vim /etc/resolv.conf:

# Generated by NetworkManagerNameserver 114.114.114.114 nameserver 202.96.134.133Copy the code

The first one is the DNS of directory Assistance, and the second one, 202.96.134.133, is the DNS of Telecom. Since my network is telecom’s network, I choose the DNS of Telecom first.

Then restart the network systemctl restart network and try to PING baidu domain name again. I have pinged the domain name successfully, so now, the network configuration of Centos 7 is finished. Finally, I don’t know how to get through the network. This time, I will make a special arrangement for future reference.