[内容] Linux 网卡 IP 地址的显示

方法一:ip 命令

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic 
       valid_lft 563315sec preferred_lft 44695sec
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr 
       valid_lft 2591846sec preferred_lft 604646sec
    inet6 fe80::21c:42ff:fec9:3c81/64 scope link 
       valid_lft forever preferred_lft forever

或者:

# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic 
       valid_lft 563315sec preferred_lft 44695sec
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr 
       valid_lft 2591846sec preferred_lft 604646sec
    inet6 fe80::21c:42ff:fec9:3c81/64 scope link 
       valid_lft forever preferred_lft forever

或者:

# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic 
       valid_lft 563315sec preferred_lft 44695sec
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr 
       valid_lft 2591846sec preferred_lft 604646sec
    inet6 fe80::21c:42ff:fec9:3c81/64 scope link 
       valid_lft forever preferred_lft forever

方法二:ifconfig 命令

# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.10.129  netmask 255.255.255.0  broadcast 10.10.10.255
        inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::21c:42ff:fec9:3c81  prefixlen 64  scopeid 0x20<link>
        inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007  prefixlen 64  scopeid 0x0<global>
        ether 00:1c:42:c9:3c:81  txqueuelen 1000  (Ethernet)
        RX packets 698666  bytes 485434755 (462.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 372557  bytes 699406543 (667.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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 73792  bytes 394285172 (376.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 73792  bytes 394285172 (376.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

方法三:iwconfig 命令

# iwconfig 
lo        no wireless extensions.

eth0      no wireless extensions.