Sharing of knowledge points in the field of primary systems and networks

Mondo Education Updated on 2024-02-20

After the virtual machine is installed, the important steps and the article on error correction ideas for ping cannot be connected to the Internet are shared

1.Log in as the root user.

2.Configure the network in two ways

3.Turn off the firewall (optional).

4.Configure the yum source.

5.Modify hostname and hosts

Here's CentOS 7 as an example:

1.Log in as the root user.

Note: If you are ubntu, you first need to log in with the account and password you created, and then configure the password for the root account Command: sudo passwd root

is the root user.

is a normal user.

2.Configure the network.

The old way:

Modify the configuration file in the above directory.

The original configuration.

After the modification.

Change to dns1, otherwise it will not take effect.

Finally, restart the network service: systemctl restart network

ip a to see if you have obtained the address Use the cmd of the computer to ping the IP to see if it works. If you use the xshell connection, all future operations will be executed on it.

DNS profile path: etc resolvConf can be viewed with cat with echo' '>> file name appended directly.

New method: Connect using nmcli.

3.Turn off the firewall (optional) and turn off selinux

Command: systemctl stop firewalld systemctl disabled firewalld

Then enter vi, etc, sysconfig, selinux, and i. Enforcing is changed to selinux=disabled

4.Configure the yum source.

Where the yum source is placed: cd etc yumrepos.d/

Here I'm backing up mv etc yum. firstrepos.d/centos-base.repo /etc/yum.repos.d/centos-base.repo.backup (go to Don't delete) and add Ali's centos source.

Yum Clean All clears the cache and runs Yum MakeCache to generate a new cache.

yum update is an update package.

5.Modify hostname and hosts

Modify hostname 1vim /etc/hostname

2.sudo hostnamectl set-hostname (recommended).

Modify hosts: vim etc hosts

Ping can't get through the Internet error correction idea.

1.Check whether there is any ARP information (ping the gateway first and then checking the ARP).

2.Check whether the IP address has been obtained.

3.View routes.

4.Check the DNS

1.Check whether there is any ARP information.

If you don't receive it, check if the network card is up

Command: ip link set ens36 up

Ubuntu needs to be manually up

2.Check whether the IP address has been obtained.

Temporary IP method for the NIC: ifconfig "NIC" Example: ifconfig ens36 102.2.10/24

Permanent configuration is modified in the configuration file.

Or add the IP address:

ip address add x.x.x.x 24 dev network card.

3.View routes.

ip route

Add default route IP route add default via Gateway

Delete route: IP Route del "Deleted Content".

4.Check the Domain Name System (DNS).

At this point you should ping the pass 88.8.8, if the ping doesn't work, that's the problem of domain name resolution.

Check dns: cat etc resolvconf

Related Pages