Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Linux can not find IP solutions with ifconfig
Today on the virtual machine, enter ifconfig found can not find the IP. .
[root@localhost xws]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2199 bytes 340131 (332.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2199 bytes 340131 (332.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
1, view the configuration file is correct, if correct, perform 2
[root@localhost xws]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ls
2, view the file contents ifconfig-lo
[root@localhost xws]# vi ifcfg-lo
ifcfg-lo profile among the following:
3, using the command to obtain a dynamic IP dhclient
dhclient command uses Dynamic Host Configuration Protocol configuring network interfaces dynamic network parameters.
grammar | dhclient (option) (parameters) |
---|---|
Options | 0: Specifies the port number dhcp client listening; -d: always run the program in foreground; -q: Quiet mode, do not print any error message; -r: release ip address. |
parameter | Network interfaces: network operation |
Examples | dhclient -r # release IP dhclient to obtain the IP # |
[root@localhost xws]# dhclient -v
After executing ifconfig command again to see the IP