Home >Operation and Maintenance >Linux Operation and Maintenance >How to configure linux ip address?

How to configure linux ip address?

青灯夜游
青灯夜游Original
2020-04-18 13:49:295145browse

How to configure the ip address of linux? The following article will introduce you to four methods of configuring IP addresses in Linux. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to configure linux ip address?

Four ways to configure ip address under Linux

After the Linux system is installed, you can use the command mode in the future Configure the network card IP.

The configuration file is usually the content displayed after /etc/sysconfig/network-scripts/ifcfg-interface-name

ifconfig, lo represents loop.

1. Ifconfig command

The first method is to use the ifconfig command to configure the IP address of the network card. This command is usually used for temporary testing. After the computer is started, the IP address configuration will automatically become invalid. The specific usage is as follows:

Ifconfig ethx ipaddr netmask x.x.x.x

x in ethx represents the fastest Ethernet card, the default first block is 0; ipaddr represents the ip address; x.x.x.x is the subnet mask.
For example, the IP address configured for the network card eth0 is 192.168.1.1 and the subnet mask is 255.255.255.0.

As shown below:

How to configure linux ip address?

Note: The IP address configured in this method will be invalid after the computer is restarted.

2. Neat command

Neat command=redhat-config-network Configure the ip address under the graphic:

How to configure linux ip address?

Double-click the red line under the picture

2-How to configure linux ip address?

After double-clicking the underlined part, the following picture will appear: Configure relevant information as required

How to configure linux ip address?

Double-click OK to complete the configuration. After configuration, restart the service and check the configured IP address.

How to configure linux ip address?

#Note: The IP address configured by this method will still be valid after the computer is restarted.

3. netconfig command

After entering netconfig, the following figure will appear. Click the yes button.

How to configure linux ip address?

Configure the relevant configuration and exit with ok.

3-How to configure linux ip address?

Note: The IP address configured in this method will still be valid after the computer is restarted.

4.vi /etc/sysconfig/network-scripts/ifcfg-ethx

How to configure linux ip address?

After configuration, restart the service, ip The address is configured. In fact, the previous three configuration methods ultimately changed the configuration file under /etc/sysconfig/network-scripts/ifcfg-ethx.

How to configure linux ip address?

Recommended: "linux tutorial"

The above is the detailed content of How to configure linux ip address?. 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