The ifconfig command can be used to view information such as Linux active network adapters and IP addresses, subnet masks, or MAC addresses
[Root@localhost ~]# Ifconfig
Eth0 Link encap:ethernet hwaddr 08:00:27:d4:71:2d
inet addr:192.168.1.104 bcast:255.255.255.255 mask:255.255.255.0
Inet6 ADDR:FE80::A00:27FF:FED4:712D/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:1693 errors:0 dropped:0 overruns:0 frame:0
TX packets:255 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:118346 (115.5 KiB) TX bytes:53987 (52.7 KiB)
Interrupt:10 Base address:0xd020
Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up loopback RUNNING mtu:16436 metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:672 (672.0 b) TX bytes:672 (672.0 b)
Eth0 is a Linux host of a network card, lo is the local loop
Ifconfig eth0 up #可以用于启动网卡
Ifconfig eth0 down #可以用于禁用网卡
Ifconfig eth0 192.168.1.101 #可以给主机制定静态地址
If you want to use DHCP assignment, you can use the Dhclient command
Enter dhclient directly in the terminal: