Article title: commands for viewing ip addresses in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I believe everyone knows a lot about how to view ip addresses in Linux. today I will introduce you to the urgent commands for Linux to view ip addresses for your reference. The following is a detailed introduction.
Ifconfig
Command for viewing IP addresses in Linux -- ifconfig
The ifconfig command is used to view and change the network interface address and parameters.
$ Ifconfig-
Lo0: flags = 849 mtu 8232
Inet 127.0.0.1 netmask ff000000
Hme0: flags = 863 mtu 1500
Inet 211.101.149.11 netmask ffffff00 broadcast 211.101.149.255
Ether 8: 0: 20: a7: 4d: 21
The system displays the network interface name, interface status (up or down ),
Interface IP address, mask, and other information
Change the IP address of the network interface:
# Ifconfig hme0 down
# Ifconfig hme0 211.101.149.233 netmask 255.255.255.0 up
First, use the down command parameter to temporarily stop the service of the network interface hme0, and then run the Linux command to view the ip address ifconfig
The interface allocates a new IP address and mask, and starts the network interface service.
You can also change the IP address of the machine by changing the IP address value in the file/etc/hosts and restarting the system.
/Etc/hosts/: 211.101.149.11 sampdt
Define the host name in/etc/hostname. hme0 and IP address.
If the NIC is changed or the NIC is added, the interface service cannot be started automatically. you need to manually create the Nic service:
# Ifconfig hme0 plumb
In Linux, you can view the ip address to create a network port service for the interface le0.
Correspondingly, ifconfig with the unplumb parameter can be used to stop the service and disable the network.
Netconfig is used to set IP addresses.