[root@localhost ipvsadm]# ipvsadm -h
ipvsadm v1.24 2005/12/10 (compiled with popt and IPVS v1.2.1)
Usage:
ipvsadm -A|E -t|u|f service-address [-s scheduler] [-p [timeout]] [-M netmask]
ipvsadm -D -t|u|f service-address
ipvsadm -C
ipvsadm -R
ipvsadm -S [-n]
ipvsadm -a|e -t|u|f service-address -r server-address [options]
ipvsadm -d -t|u|f service-address -r server-address
ipvsadm -L|l [options]
ipvsadm -Z [-t|u|f service-address]
ipvsadm --set tcp tcpfin udp
ipvsadm --start-daemon state [--mcast-interface interface] [--syncid sid]
ipvsadm --stop-daemon state
ipvsadm -h
Commands:
Either long or short options are allowed.
--add-service -A add virtual service with options
--edit-service -E edit virtual service with options
--delete-service -D delete virtual service
--clear -C clear the whole table
--restore -R restore rules from stdin
--save -S save rules to stdout
--add-server -a add real server with options
--edit-server -e edit real server with options
--delete-server -d delete real server
--list -L|-l list the table
--zero -Z zero counters in a service or all services
--set tcp tcpfin udp set connection timeout values
--start-daemon start connection sync daemon
--stop-daemon stop connection sync daemon
--help -h display this help message
Options:
--tcp-service -t service-address service-address is host[:port]
--udp-service -u service-address service-address is host[:port]
--fwmark-service -f fwmark fwmark is an integer greater than zero
--scheduler -s scheduler one of rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,
the default scheduler is wlc.
--persistent -p [timeout] persistent service
--netmask -M netmask persistent granularity mask
--real-server -r server-address server-address is host (and port)
--gatewaying -g gatewaying (direct routing) (default)
--ipip -i ipip encapsulation (tunneling)
--masquerading -m masquerading (NAT)
--weight -w weight capacity of real server
--u-threshold -x uthreshold upper threshold of connections
--l-threshold -y lthreshold lower threshold of connections
--mcast-interface interface multicast interface for connection sync
--syncid sid syncid for connection sync (default=255)
--connection -c output of current IPVS connections
--timeout output of timeout (tcp tcpfin udp)
--daemon output of daemon information
--stats output of statistics information
--rate output of rate information
--exact expand numbers (display exact values)
--thresholds output of thresholds information
--persistent-conn output of persistent connection info
--sort sorting output of service/server entries
--numeric -n numeric output of addresses and ports
[plain]
view plain copy--add-service -A add virtual service with option
在內(nèi)核的虛擬服務(wù)器表中添加一條新的虛擬服務(wù)器記錄。也就是增加一臺(tái)新的虛擬服務(wù)器
--edit-service -E edit virtual service with options
編輯內(nèi)核虛擬服務(wù)器表中的一條虛擬服務(wù)器記錄
--delete-service -D delete virtual service
刪除內(nèi)核虛擬服務(wù)器表中的一條虛擬服務(wù)器記錄
--clear -C clear the whole table
清除內(nèi)核虛擬服務(wù)器表中的所有記錄
--restore -R restore rules from stdin
恢復(fù)虛擬服務(wù)器規(guī)則
--save -S save rules to stdout
保存虛擬服務(wù)器規(guī)則,輸出為-R 選項(xiàng)可讀的格式
--add-server -a add real server with options
在內(nèi)核虛擬服務(wù)器表的一條記錄里添加一條新的真實(shí)服務(wù)器
--edit-server -e edit real server with options
編輯一條虛擬服務(wù)器記錄中的某條真實(shí)服務(wù)器記錄
--delete-server -d delete real server
刪除一條虛擬服務(wù)器記錄中的某條真實(shí)服務(wù)器記錄
--list -L|-l list the table
顯示內(nèi)核虛擬服務(wù)器表
--zero -Z zero counters in a service or all services
虛擬服務(wù)表計(jì)數(shù)器清零
--set tcp tcpfin udp set connection timeout values
設(shè)置連接超時(shí)值
--start-daemon start connection sync daemon
啟動(dòng)同步守護(hù)進(jìn)程。他后面可以是master 或backup,用來(lái)說(shuō)明LVS Router 是master 或是backup。在這個(gè)功能上也可以采keepalived 的VRRP 功能。
--stop-daemon stop connection sync daemon
停止同步守護(hù)進(jìn)程
--help -h display this help message
顯示幫助信息
Options:
--tcp-service -t service-address service-address is host[:port]
說(shuō)明虛擬服務(wù)器提供的是tcp 的服務(wù)[vip:port] or [real-server-ip:port]
--udp-service -u service-address service-address is host[:port]
說(shuō)明虛擬服務(wù)器提供的是udp 的服務(wù)[vip:port] or [real-server-ip:port]
--fwmark-service -f fwmark fwmark is an integer greater than zero
說(shuō)明是經(jīng)過(guò)iptables 標(biāo)記過(guò)的服務(wù)類型。
--scheduler -s scheduler one of rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,the default scheduler is wlc.
使用的調(diào)度算法,有這樣幾個(gè)選項(xiàng),默認(rèn)的調(diào)度算法是: wlc.
--persistent -p [timeout] persistent service
持久穩(wěn)固的服務(wù)。這個(gè)選項(xiàng)的意思是來(lái)自同一個(gè)客戶的多次請(qǐng)求,將被同一臺(tái)真實(shí)的服務(wù)器處理。timeout 的默認(rèn)值為300 秒
--netmask -M netmask persistent granularity mask
--real-server -r server-address server-address is host (and port)
真實(shí)的服務(wù)器[Real-Server:port]
--gatewaying -g gatewaying (direct routing) (default)
指定LVS 的工作模式為直接路由模式(也是LVS 默認(rèn)的模式
--ipip -i ipip encapsulation (tunneling)
指定LVS 的工作模式為隧道模式
--masquerading -m masquerading (NAT)
指定LVS 的工作模式為NAT 模式
--weight -w weight capacity of real server
真實(shí)服務(wù)器的權(quán)值
--u-threshold -x uthreshold upper threshold of connections
--l-threshold -y lthreshold lower threshold of connections
--mcast-interface interface multicast interface for connection sync
指定組播的同步接口
--syncid sid syncid for connection sync (default=255)
--connection -c output of current IPVS connections
顯示LVS 目前的連接 如:ipvsadm -L -c
--timeout output of timeout (tcp tcpfin udp)
顯示tcp tcpfin udp 的timeout 值 如:ipvsadm -L --timeout
--daemon output of daemon information
顯示同步守護(hù)進(jìn)程狀態(tài)
--stats output of statistics information
顯示統(tǒng)計(jì)信息
--rate output of rate information
顯示速率信息
--thresholds output of thresholds information
--persistent-conn output of persistent connection info
--sort sorting output of service/server entries
對(duì)虛擬服務(wù)器和真實(shí)服務(wù)器排序輸出
--ops -O one-packet scheduling
--numeric -n numeric output of addresses and ports
輸出IP 地址和端口的數(shù)字形式
有兩種命令選項(xiàng)格式,長(zhǎng)的和短的,具有相同的意思。在實(shí)際使用時(shí),兩種都可
以。
-A –add-service 在內(nèi)核的虛擬服務(wù)器表中添加一條新的虛擬服務(wù)器記錄。也
就是增加一臺(tái)新的虛擬服務(wù)器。
-E –edit-service 編輯內(nèi)核虛擬服務(wù)器表中的一條虛擬服務(wù)器記錄。
-D –delete-service 刪除內(nèi)核虛擬服務(wù)器表中的一條虛擬服務(wù)器記錄。
-C –clear 清除內(nèi)核虛擬服務(wù)器表中的所有記錄。
-R –restore 恢復(fù)虛擬服務(wù)器規(guī)則
-S –save 保存虛擬服務(wù)器規(guī)則,輸出為-R 選項(xiàng)可讀的格式
-a –add-server 在內(nèi)核虛擬服務(wù)器表的一條記錄里添加一條新的真實(shí)服務(wù)器
記錄。也就是在一個(gè)虛擬服務(wù)器中增加一臺(tái)新的真實(shí)服務(wù)器
-e –edit-server 編輯一條虛擬服務(wù)器記錄中的某條真實(shí)服務(wù)器記錄
-d –delete-server 刪除一條虛擬服務(wù)器記錄中的某條真實(shí)服務(wù)器記錄
-L|-l –list 顯示內(nèi)核虛擬服務(wù)器表
-Z –zero 虛擬服務(wù)表計(jì)數(shù)器清零(清空當(dāng)前的連接數(shù)量等)
–set tcp tcpfin udp 設(shè)置連接超時(shí)值
–start-daemon 啟動(dòng)同步守護(hù)進(jìn)程。他后面可以是master 或backup,用來(lái)說(shuō)
明LVS Router 是master 或是backup。在這個(gè)功能上也可以采用
keepalived 的
VRRP 功能。
–stop-daemon 停止同步守護(hù)進(jìn)程
-h –help 顯示幫助信息
其他的選項(xiàng):
-t –tcp-service service-address 說(shuō)明虛擬服務(wù)器提供的是tcp 的服務(wù)
[vip:port] or [real-server-ip:port]
-u –udp-service service-address 說(shuō)明虛擬服務(wù)器提供的是udp 的服務(wù)
[vip:port] or [real-server-ip:port]
-f –fwmark-service fwmark 說(shuō)明是經(jīng)過(guò)
iptables 標(biāo)記過(guò)的服務(wù)類型。
-s –scheduler scheduler 使用的調(diào)度算法,有這樣幾個(gè)選項(xiàng)
rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,
默認(rèn)的調(diào)度算法是: wlc.
-p –persistent [timeout] 持久穩(wěn)固的服務(wù)。這個(gè)選項(xiàng)的意思是來(lái)自同一個(gè)客
戶的多次請(qǐng)求,將被同一臺(tái)真實(shí)的服務(wù)器處理。timeout 的默認(rèn)值為300 秒。
-M –netmask netmask persistent granularity mask
-r –real-server server-address 真實(shí)的服務(wù)器[Real-Server:port]
-g –gatewaying 指定LVS 的工作模式為直接路由模式(也是LVS 默認(rèn)的模式)
-i –ipip 指定LVS 的工作模式為隧道模式
-m –masquerading 指定LVS 的工作模式為NAT 模式
-w –weight weight 真實(shí)服務(wù)器的權(quán)值
–mcast-interface interface 指定組播的同步接口
-c –connection 顯示LVS 目前的連接 如:ipvsadm -L -c
–timeout 顯示tcp tcpfin udp 的timeout 值 如:ipvsadm -L –timeout
–daemon 顯示同步守護(hù)進(jìn)程狀態(tài)
–stats 顯示統(tǒng)計(jì)信息
–rate 顯示速率信息
–sort 對(duì)虛擬服務(wù)器和真實(shí)服務(wù)器排序輸出
–numeric -n 輸出IP 地址和端口的數(shù)字形式
[plain]
view plain copy--stat選項(xiàng)是統(tǒng)計(jì)自該條轉(zhuǎn)發(fā)規(guī)則生效以來(lái)的包
1. Conns (connections scheduled) 已經(jīng)轉(zhuǎn)發(fā)過(guò)的連接數(shù)
2. InPkts (incoming packets) 入包個(gè)數(shù)
3. OutPkts (outgoing packets) 出包個(gè)數(shù)
4. InBytes (incoming bytes) 入流量(字節(jié))
5. OutBytes (outgoing bytes) 出流量(字節(jié))
[plain]
view plain copy--rate選項(xiàng)是顯示速率信息
1. CPS (current connection rate) 每秒連接數(shù)
2. InPPS (current in packet rate) 每秒的入包個(gè)數(shù)
3. OutPPS (current out packet rate) 每秒的出包個(gè)數(shù)
4. InBPS (current in byte rate) 每秒入流量(字節(jié))
5. OutBPS (current out byte rate) 每秒入流量(字節(jié))