Home  >  Article  >  Operation and Maintenance  >  How to configure the network in linux

How to configure the network in linux

(*-*)浩
(*-*)浩Original
2019-05-30 17:11:1133459browse

Configure Linux network

How to configure the network in linux

Use to enter the configuration file:

 vi /etc/sysconfig/network-scripts/ifcfg-eth0

How to configure the network in linux

The file opened now is the configuration file of the network card. To change the IP address, you must edit this file.

We want to modify the contents of the file, press the letter i key:

Change ONBOOT=no to ONBOOT=yes

Change BOOTPROTO=dhcp Change to BOOTPROTO=static

and add the following lines of characters

IPADDR=192.168.188.128

NETMASK=255.255.255.0

GATEWAY=192.168.47.2

DNS1=119.29.29.29

How to configure the network in linux

Note:

ONBOOT is set to yes, which means that the network card will follow the system Start together

BOOTPROTO is used to set the startup type of the network card. dhcp means automatically obtaining the IP address, static means manually setting the static IP address

IPADDR specifies the IP address (depending on the previously automatically obtained Address)

NETMASK specifies the subnet mask

GATEWAY specifies the gateway

DNS1 specifies the DNS IP address for Internet access

119.29.29.29 is a domestic DNSpod company Provide a public DNS

After completing the above changes, press the Esc key, then enter ":wq" and press Enter to exit the document just now.

Restart the Internet

Restart the network service

How to configure the network in linux

View the IP address (same as seen before)

How to configure the network in linux

Test network connectivity

How to configure the network in linux

Network setup completed!

The above is the detailed content of How to configure the network 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