上面示例一中的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 和端口)。例如:
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
请帮我。
答案1
我使用
ipvsadm -ln
并且我只想显示主机名而不是 IP
你确实意识到你正在明确指示ipvsadm
显示数字 IP 地址而不是主机名,对吗?
-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.