: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet127.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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:3f:ab:68 brd ff:ff:ff:ff:ff:ff inet192.168.1.150/24 brd 192.168.1.255 scope global enp0s3 valid_lft forever preferred_lft forever inet192.168.1.151/24 brd 192.168.1.255 scope global secondary enp0s3 valid_lft forever preferred_lft forever inet192.168.1.152/24 brd 192.168.1.255 scope global secondary enp0s3 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe3f:ab68/64 scope link valid_lft forever preferred_lft forever
如你所见,单个网卡已经有3个ip地址了。
让我们ping一下新增的IP地址:
1 2
ping -c 4192.168.1.151
示例输出:
1 2 3 4 5 6 7 8 9 10
PING 192.168.1.151 (192.168.1.151) 56(84) bytes of data. 64 bytes from 192.168.1.151: icmp_seq=1 ttl=64 time=0.048 ms 64 bytes from 192.168.1.151: icmp_seq=2 ttl=64 time=0.075 ms 64 bytes from 192.168.1.151: icmp_seq=3 ttl=64 time=0.077 ms 64 bytes from 192.168.1.151: icmp_seq=4 ttl=64 time=0.077 ms
--- 192.168.1.151 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.048/0.069/0.077/0.013 ms
1 2
ping -c 4192.168.1.152
示例输出:
1 2 3 4 5 6 7 8 9 10
PING 192.168.1.152 (192.168.1.152) 56(84) bytes of data. 64 bytes from 192.168.1.152: icmp_seq=1 ttl=64 time=0.034 ms 64 bytes from 192.168.1.152: icmp_seq=2 ttl=64 time=0.075 ms 64 bytes from 192.168.1.152: icmp_seq=3 ttl=64 time=0.073 ms 64 bytes from 192.168.1.152: icmp_seq=4 ttl=64 time=0.075 ms
--- 192.168.1.152 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.034/0.064/0.075/0.018 ms
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.097 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.073 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.074 ms 64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.075 ms
--- 10.0.0.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3000ms rtt min/avg/max/mdev = 0.073/0.079/0.097/0.014 ms