Validating Network Address Configuration
To verify the configuration of the network address, you need to use the ip utility. The ip utility is a modern utility that can consider advanced networking features that have been introduced recently. With the ip utility, many aspects of networking can be monitored:
■ Use ip addr to configure and monitor network addresses
■ Use ip route to configure and monitor routing information
■ Use ip link to configure and monitor network link state
To show current network settings, you can use the ip addr show command (which can be abbreviated as ip a s or even as ip a ). The ip command is relatively smart and does not always require you to type the complete option.--RHEL7.0版本以上查看网络配置命令使用ip addr show,以前的命令ifconfig -a不再使用了。
[root@rhel7 ~]# ifconfig -a
-bash: ifconfig: command not found
[root@rhel7 ~]# ip addr show
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP qlen
link/ether :::d8::0a brd ff:ff:ff:ff:ff:ff
inet 192.168.1.111/ brd 192.168.1.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fed8:650a/ scope link
valid_lft forever preferred_lft forever
[root@rhel7 ~]# ip a
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP qlen
link/ether :::d8::0a brd ff:ff:ff:ff:ff:ff
inet 192.168.1.111/ brd 192.168.1.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fed8:650a/ scope link
valid_lft forever preferred_lft forever
[root@rhel7 ~]# ip route
default via 192.168.1.100 dev enp0s3 proto static metric
192.168.1.0/ dev enp0s3 proto kernel scope link src 192.168.1.111 metric
[root@rhel7 ~]# ip link
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback ::::: brd :::::
: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP mode DEFAULT qlen
link/ether :::d8::0a brd ff:ff:ff:ff:ff:ff
[root@rhel7 ~]#
ip -s link: This shows all existing network connections, in addition to statistics about the number of packets that have been sent and associated error messages.
[root@rhel7 ~]# ip -s link
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback ::::: brd :::::
RX: bytes packets errors dropped overrun mcast TX: bytes packets errors dropped carrier collsns : enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP mode DEFAULT qlen
link/ether :::d8::0a brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast TX: bytes packets errors dropped carrier collsns [root@rhel7 ~]#