我试图在mininet中找出ping命令的时间戳。每当我ping某个主机时,我得到的结果类似于以下内容:
mininet> h1 ping h2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=1.17 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=1.48 ms
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.426 ms
64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=0.059 ms
64 bytes from 10.0.0.2: icmp_seq=5 ttl=64 time=0.089 ms
64 bytes from 10.0.0.2: icmp_seq=6 ttl=64 time=0.301 ms
但我希望结果像这样;
10:13:29.421875 Reply from 10.0.0.1: bytes=32 time=3889ms TTL=238
10:13:29.468750 Reply from 10.0.0.1: bytes=32 time=3738ms TTL=238
10:13:29.468751 Reply from 10.0.0.1: bytes=32 time=3379ms TTL=238
我可以从linux命令提示符轻松获取此信息,但我没有从mininet提示符中获取它。是否有可能在mininet提示符下获得ping时间戳。
答案 0 :(得分:0)
答案 1 :(得分:0)
使用
man ping
你会看到其中一个选项是:
-D Print timestamp (unix time + microseconds as in gettimeofday) before each line.
如果你不想从mininet调用任何脚本,你可以简单地得到时间戳:
h1 ping h2 -D
此命令将在结果之前显示UNIX时间戳,例如:
[1524446605.745780] 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=3.70 ms
[1524446606.743407] 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.479 ms
[1524446607.743291] 64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.070 ms
[1524446608.742918] 64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=0.076 ms
[1524446609.743254] 64 bytes from 10.0.0.2: icmp_seq=5 ttl=64 time=0.070 ms
[1524446610.743064] 64 bytes from 10.0.0.2: icmp_seq=6 ttl=64 time=0.067 ms
[1524446611.743123] 64 bytes from 10.0.0.2: icmp_seq=7 ttl=64 time=0.072 ms
[1524446612.742662] 64 bytes from 10.0.0.2: icmp_seq=8 ttl=64 time=0.072 ms
您可以找到一些方法将此时间戳传输到您喜欢的表单