操作系统:CentOS 7.0

使用场景:查看网卡IP地址

使用技巧:没有ifconfig命令,可以使用ip addr show/list查看,或是ip a

没有ifconfig命令,可以安装软件包net-tools; 

使用经验:强烈建设使用ifconfig命令。

命令如:

ifconfig

ip addr show  ip addr list  ip a     

上述两类命令的效果略有差别。

[sky9890@localhost ~]$ ifconfig

eth0: flags=4163  mtu 1500

        inet 192.168.153.128  netmask 255.255.255.0  broadcast 192.168.153.255

        inet6 fe80::d84f:63df:d5a:2641  prefixlen 64  scopeid 0x20

        ether 00:0c:29:65:85:ee  txqueuelen 1000  (Ethernet)

        RX packets 683  bytes 63920 (62.4 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 577  bytes 75167 (73.4 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 64  bytes 5568 (5.4 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 64  bytes 5568 (5.4 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


[sky9890@localhost ~]$ ip a

1: lo: 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: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

    link/ether 00:0c:29:65:85:ee brd ff:ff:ff:ff:ff:ff

    inet 192.168.153.128/24 brd 192.168.153.255 scope global noprefixroute dynamic eth0

       valid_lft 1015sec preferred_lft 1015sec

    inet6 fe80::d84f:63df:d5a:2641/64 scope link noprefixroute 

       valid_lft forever preferred_lft forever


[sky9890@localhost ~]$ ip addr show

1: lo: 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: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

    link/ether 00:0c:29:65:85:ee brd ff:ff:ff:ff:ff:ff

    inet 192.168.153.128/24 brd 192.168.153.255 scope global noprefixroute dynamic eth0

       valid_lft 997sec preferred_lft 997sec

    inet6 fe80::d84f:63df:d5a:2641/64 scope link noprefixroute 

     valid_lft forever preferred_lft forever