Home >Operation and Maintenance >Linux Operation and Maintenance >How to connect to the Internet in Linux

How to connect to the Internet in Linux

(*-*)浩
(*-*)浩Original
2019-11-04 11:19:228803browse

How to connect to the Internet in Linux

Log in to the Linux system. First use the root account and password to log in to the Linux interface (note: must be an administrator user or authority). If other users log in, use the su command to switch users and enter the password. The result is as shown in the figure below: (Recommended learning: Linux operation and maintenance)

How to connect to the Internet in LinuxModify the Linux ip address. Use the command vi /etc/sysconfig/network-scripts/ifcfg-eth0 to first change the Linux system IP address to a network segment that is allowed to pass by the router or network switch. Then add a command DNS = 8.8.8.8. After modification, press Press the Esc key on the keyboard, enter wq to save and exit , as shown in the following figure:

How to connect to the Internet in Linux

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. 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 to the Internet in Linux

##Linux networking.

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

How to connect to the Internet in Linux

Restart the network card:

Use the command: service network restart to restart . The result is as shown below:

Verification. How to connect to the Internet in LinuxUse the ping Baidu command to check if there is a reply. If there is a reply, it means the connection is successful. The result is as shown below:

How to connect to the Internet in Linux

The above is the detailed content of How to connect to the Internet in Linux. 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
Previous article:How to mount linuxNext article:How to mount linux