If you want to use Linux environment on Windows machine, the most convenient way is to use virtual machine. You must be familiar with the most commonly used software, the famous VMware.
However, this thing is a little bit less intelligent. After installing Linux every time, the network is blocked. Not once can it be installed directly.
Let me simply record what needs to be modified:
First, let's look at the current network card configuration, because I installed the Centos mini version of the system, and the supported commands are limited. I can only use the command of ip addr:
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: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:0c:29:fd:6b:a2 brd ff: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 forever
You can see two network card configurations. One is the local loopback network of lo, which we don't need to care about. The other is the network configuration of ens32. What we need to change is this (here is the configured network card configuration. The newly installed machine has not been configured with the network, so it should be different).
Next, modify the network card configuration of Linux:
Because what we saw above is the ens32 network card, the configuration address of the ens32 network card is / etc / sysconfig / network scripts / ifcfg-ens32. Some systems may not be called ens32, but may be other names.
Open to see the initial configuration of ens32, 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"
There are two configurations that need attention, BOOTPROTO and ONBOOT.
BOOTPROTO is a network type. The possible options are static, dhcp or bootp, respectively corresponding to the statically specified ip address, the ip address obtained through dhcp protocol and the ip address obtained through bootp protocol.
It is changed to static here. Of course, I want to use static IP. Otherwise, the ssh link tool used every time I start up will have to change the IP. It's too troublesome.
ONBOOT needs to be changed to yes, which means whether the system starts automatically to activate the network card. It is generally set to yes. Otherwise, after the system starts, you need to manually enter a command to start the network card.
Next, you need to add the following information:
IPADDR=192.168.128.100 GATEWAY=192.168.128.2 NETMASK=255.255.255.0
First, NETMASK is the subnet mask, which is 255.255 by default 255.0 is OK.
GATEWAY is the GATEWAY address, which needs to be found in VMware's NAT network configuration. You can't fill it in casually, otherwise different GATEWAY networks won't connect.
IPADDR is the address of IPV4, that is, the IP address we finally use, but we can't write it casually. The first three paragraphs need to be consistent with the gateway, and the last one can write one that doesn't 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
The error appears to be that the domain name has not been resolved. I'll PING the IP of the directory search desk to try:
[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: icmp_seq=2 ttl=128 time=80.6 ms 64 bytes from 114.114.114.114: icmp_seq=3 ttl=128 time=70.2 ms
It seems that the network has been connected now. Nine times out of ten domain name resolution is a DNS problem. Modify DNS, VIM / etc / resolv conf :
# Generated by NetworkManager nameserver 114.114.114.114 nameserver 202.96.134.133
The first one is the DNS of the directory lookup station, and the second one is 202.96 134.133 is the DNS of Telecom. Because my network is a telecom network, I give priority to the DNS of Telecom here.
Then restart the network systemctl restart network and try to PING Baidu's domain name again. I have pinged the domain name here. So far, the network configuration of Centos 7 is over. Before installing virtual machines, I searched everywhere on the Internet and changed the configuration blindly. Finally, I don't know how to connect the network. This time, I specially sorted it out and kept it for future reference.