![ipvsadm - 如何显示主机名和端口?](https://linux22.com/image/724343/ipvsadm%20-%20%E5%A6%82%E4%BD%95%E6%98%BE%E7%A4%BA%E4%B8%BB%E6%9C%BA%E5%90%8D%E5%92%8C%E7%AB%AF%E5%8F%A3%EF%BC%9F.png)
上面示例一中的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.