Home >Operation and Maintenance >Linux Operation and Maintenance >How to configure linux ip address?
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.
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:
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:
Double-click the red line under the picture
After double-clicking the underlined part, the following picture will appear: Configure relevant information as required
Double-click OK to complete the configuration. After configuration, restart the service and check the configured 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.
Configure the relevant configuration and exit with ok.
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
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.
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!