Enter ip to query and name ip addr You can also enter ifconfig (centOs7 does not have ifconfig command) to view ip, but this command There will be 3 entries, the ip address of centos is the inet value in the ens33 entry.
It is found that ens33 does not have the attribute of inet, so it is impossible to connect to the virtual machine through the IP address.
Next, let’s check the configuration of the ens33 network card: vi /etc/sysconfig/network-scripts/ifcfg-ens33 Pay attention to the space after vi
vi is Linux The meaning of the built-in text editor command to open the file
From the configuration list, you can find that CentOS 7 does not start the network card by default (ONBOOT=no).
Change this item to YES (ONBOOT=yes),
Then press Esc to exit and then enter and exit command: wq Press Enter again ( Note: wq means to save and then exit, we will talk about vi later)
Then restart the network service: sudo service network restart
Then we enter the ip addr command
Original address: https://www.cnblogs.com/technology-huangyan/p/9146699.html
< p>
Enter ip to query named ip addr. You can also enter ifconfig (centOs7 does not have ifconfig command) to view ip, but this command will show 3 entries. The ip address of centos is the inet value in the ens33 entry.
It is found that ens33 does not have the attribute of inet, so it is impossible to connect to the virtual machine through the IP address.
Next, let’s check the configuration of the ens33 network card: vi /etc/sysconfig/network-scripts/ifcfg-ens33 Pay attention to the space after vi
vi is Linux The meaning of the built-in text editor command to open the file
From the configuration list, you can find that CentOS 7 does not start the network card by default (ONBOOT=no).
Change this item to YES (ONBOOT=yes),
Then press Esc to exit and then enter and exit command: wq Press Enter again ( Note: wq means to save and then exit, we will talk about vi later)
Then restart the network service: sudo service network restart
Then we enter the ip addr command
Original address: https://www.cnblogs.com/technology-huangyan/p/9146699.html