Home > Operation and Maintenance > CentOS > Centos system cannot ping Baidu

Centos system cannot ping Baidu

王林
Release: 2020-03-19 15:25:16
Original
3474 people have browsed it

Centos system cannot ping Baidu

1. Set the network to bridge mode

Centos system cannot ping Baidu

2. View the required information on the host machine

Centos system cannot ping Baidu

We need three data here: IPv4 address, subnet mask, and default gateway.

(Recommended tutorial: centos usage tutorial)

3. Edit the configuration file

The final name may be different. If it is different, change it yourself.

vi /etc/sysconfig/network-scripts/ifcfg-ens33
Copy after login

Modify your own configuration file according to the following reference configuration file

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
#设置静态ip
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="1f3f4a9a-858d-47f6-b1f5-287ac6457216"
DEVICE="ens33"
ONBOOT="yes"
#输入你想设置的ip地址
IPADDR="192.168.0.202"
PREFIX="24"
#设置网关
GATEWAY="192.168.0.1"
#子网掩码
NETMASK=255.255.255.0
DNS1="8.8.8.8"
IPV6_PRIVACY="no"
Copy after login

Note:

The IPADDR value must be in the same network segment as the IPv4 address in step 2;

GATEWAY is the default gateway in step 2;

NETMASK is the subnet mask in step 2

4. Restart the network

systemctl restart network.service
Copy after login

Related video tutorials Recommended: linux video tutorial

The above is the detailed content of Centos system cannot ping Baidu. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template