上例一中的ipvs规则输出如下:
[root@penguin sbin]# ipvsadm -ln
IP Virtual Server version 1.0.8 (size=65536)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 207.175.44.110:80 rr
-> 192.168.10.5:80 Masq 1 0 0
-> 192.168.10.4:80 Masq 1 0 0
-> 192.168.10.3:80 Masq 1 0 0
-> 192.168.10.2:80 Masq 1 0 0
-> 192.168.10.1:80 Masq 1 0 0
我只想显示主机名和端口(而不是IP和端口)。示例:
[root@penguin sbin]# ipvsadm -ln
IP Virtual Server version 1.0.8 (size=65536)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 207.175.44.110:80 rr
-> webserver-01:80 Masq 1 0 0
-> webserver-02:80 Masq 1 0 0
-> webserver-03:80 Masq 1 0 0
-> webserver-04:80 Masq 1 0 0
-> webserver-05:80 Masq 1 0 0
请帮助我。
答案 0 :(得分:0)
您尝试过
ipvsadm -l
?
根据手册页:
-n,--numeric
Numeric output. IP addresses and port numbers will be printed in numeric format rather than as as host names and services respectively, which is the default. --exact Expand numbers. Display the exact value of the packet and byte counters, instead of only the rounded number in K’s (multiples of 1000) M’s (multiples of 1000K) or G’s (multiples of 1000M). This option is only relevant for the -L command.