Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the ipvsadm command of linux to linux virtual server management

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the use of linux ipvsadm command linux virtual server management, the article is very detailed, has a certain reference value, interested friends must read it!

The ipvsadm command is used to set up, maintain, or check virtual server tables in the Linux kernel. Linux virtual servers can be used to build scalable network services based on clusters of two or more nodes. The primary node of the cluster redirects the service request to the collection of server hosts that will actually perform the service. Supported features include two protocols (TCP and UDP), three packet forwarding methods (NAT, tunneling and direct routing), and eight load balancing algorithms (roundrobin, weighted loop, minimum connection, weighted minimum connection, location-based) minimum connection, location-based minimum connection, with replication, destination hash, and source hash).

Syntax format: ipvsadm [parameters]

Common parameters:

-A/--add-service add a new virtual service-E/--edit-service edit virtual service-D/--delete-service delete virtual service-C/--clear clears all virtual service rules-R/--restore restore virtual service rule-S/--save save virtual server rule-a/--add-server adds a new real server to a virtual service- E/--edit-server edits a real server-d/--delete-server deletes a real server-virtual service rules in the L/-l/--list display kernel-Z/--zero clears the statistics of forwarded messages-set tcp/tcpfin/udp configures three timeouts (tcp/tcpfin/udp)-start-daemon starts the synchronization daemon. -- stop-daemon stops synchronization daemon-h/--help displays help information-virtual service for t/--tcp-service service-addressTCP protocol-virtual service for u/--udp-service service-addressUDP protocol-f/--fwmark-service fwmark description is a service type marked by iptables. -the scheduling algorithm used by s/--scheduler scheduler has the following options: rr | wrr | lc | wlc | lblc | lblcr | dh | sh | sed | nq. The default scheduling algorithm is: wlc.-p/--persistent [timeout] persistent service. -M/--netmask specifies subnet mask of customer address-r/--real-serverserver-address real server-g/--gatewaying specifies LVS operation mode as direct route mode-i/--ipip specifies LVS operation mode as tunnel mode-m/--masquerading specifies LVS operation mode as NAT mode-weight of w/--weightweight real server-mcast-interface interface specifies multicast synchronization interface -c/--connection displays connections that currently exist in ipvs-6: this option is required if fwmark is using an ipv6 address.

Reference example

Manage virtual services:

Add a virtual service, 192.168.1.100 virtual 80, using the polling algorithm:

[root@linuxcool] # ipvsadm-A-t 192.168.1.100 rr 80-s rr

The algorithm for modifying the virtual service is weighted polling:

[root@linuxcool] # ipvsadm-E-t 192.168.1.100 wrr 80-s wrr

Delete the virtual service:

[root@linuxcool] # ipvsadm-D-t 192.168.1.100lu 80

Manage real-world services:

Add a real server 192.168.1.123, using DR mode, weight 2:

[root@linuxcool] # ipvsadm-a-t 192.168.1.100L 80-r 192.168.1.123-g-w 2

Modify the weight of the real server:

[root@linuxcool] # ipvsadm-a-t 192.168.1.100L 80-r 192.168.1.123-g-w 5

Delete a real server:

[root@linuxcool] # ipvsadm-d-t 192.168.1.100 purl 80-r 192.168.1.123

View statistics:

View the currently configured virtual services and the weights of each RS:

[root@linuxcool ~] # ipvsadm-Ln

View the connections recorded in the current ipvs module (which can be used to observe forwarding):

[root@linuxcool ~] # ipvsadm-lnc

View the forwarding statistics of the ipvs module:

[root@linuxcool ~] # ipvsadm-Ln-- stats |-- rate above is all the content managed by the linux virtual server using linux's ipvsadm command, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report