Home  >  Article  >  Operation and Maintenance  >  How to connect computers with Linux system to the Internet

How to connect computers with Linux system to the Internet

王林
王林Original
2019-11-16 10:13:1114020browse

How to connect computers with Linux system to the Internet

1. Log in to the Linux system. First use the root account and password to log in to the Linux interface (note: it must be an administrator user or authority). If another user logs in, use the su command to switch users and enter the password. The result is as shown below:

How to connect computers with Linux system to the Internet

2. Modify the Linux ip address. Use the command vi /etc/sysconfig/network-scripts/ifcfg-eth0 to first change the Linux system IP address to the network segment allowed by the router or network switch. Add a command DNS = 8.8.8.8. After the modification is completed, press the Esc key on the keyboard. , enter wq to save and exit, as shown in the following figure:

How to connect computers with Linux system to the Internet

3. Verify whether Linux is connected to the Internet. Use the ping command to directly ping a website. If the host cannot be identified, it means that it is not connected to the Internet. Here we take ping Baidu as an example. The result is as shown in the figure below, which means that it is not connected to the Internet:

How to connect computers with Linux system to the Internet

4 , Linux networking. Command vi /etc/resolv.conf and write nameserver 8.8.8.8 in the opened text. The result is as shown in the figure:

How to connect computers with Linux system to the Internet

5. Restart the network card: Use the command: service network restart, the result is as shown below:

How to connect computers with Linux system to the Internet

6. Verification. Use the ping Baidu command to check whether there is a reply. If there is a reply, it means the connection is successful. The result is as shown below:

How to connect computers with Linux system to the Internet

Note:

The set IP must be able to connect to the external network, that is, it can pass through switching equipment such as routers.

After the configuration is completed, some systems do not take effect and need to restart the network card service.

Recommended tutorial: linux tutorial

The above is the detailed content of How to connect computers with Linux system to the Internet. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn