What should I do if there is no network environment under the Linux terminal system

First step VM setup

The second step must be switched to the root user, either log in directly, or switch

Use the su command to switch to the root user

Since the root user does not have a password at the beginning, first enter: sudo passwd root to initialize the root user password. It may be required to enter the password of the current user, and the root user password and the secondary input of the password will be required. Finally, switch between users through su username.

third step

First of all, the network card configuration information of Linux is in the **/etc/sysconfig/network-scripts** directory. There is a lot of network card information in this directory. The default is

ifcfg-enp0s3 like:

The fourth step is to open the network card automatically open

Vi command vi common command line - Cloud + Community - Tencent Cloud

Modify the content in ifcfg-enp0s3: vi ifcfg-enp0s3 ONBOOT=yes,

Then restart the linux server or start service network restart.

Step 5 Test

ping www.baidu.com

Notice

1. ctrl+c can terminate ping

2. ctrl+z can pause ping, the pause is just to put the process in the background, use the command fg to call it out to the foreground

3. You can also use ping -w 10 ip (domain name) or ping -c 10 ip (domain name)

Don't forget to follow, like, and give me a little encouragement! Forward, Favorite, Like, Three Links

Software test self-study penguin group (chat, water group, do not disturb advertising): 863117796

If reproduced, please indicate the source

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324327326&siteId=291194637