In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
1 introduction to QoS
QoS (Quality of Service) means that a network can make use of various basic technologies to provide better service for specified network communications. It is a security mechanism of the network and a technology used to solve the problems of network delay and congestion. Under normal circumstances, if the network is only used for specific unlimited applications, there is no need for QoS, such as Web applications, or E-mail settings. However, it is necessary for key applications and multimedia applications. When the network is overloaded or congested, QoS can ensure that the important traffic will not be delayed or discarded, and at the same time ensure the efficient operation of the network. For example, increase the priority of all data packets in QQ and set the dont_drop option to ensure that QQ will not be dropped when the network environment is poor.
2 QoS operation method
There are three QoS-related operation commands, add (qosruleadd), delete (qosruledel), and view (qoss).
2.1 add
The following is a command to add ip rules:
# qosruleadd en1 ip 192.168.31.1 192.168.31.5 SRC 5 no
Where "en1" represents the network interface, and "ip" indicates the type of packet the rule is aimed at, followed by the IP address range. The IP address range is followed by a method and indicates that this rule is valid for source addresses (SRC), destination addresses (DEST), or all addresses (BOTH). Method is followed by priority, ranging from 1 to 7. Finally, whether to turn on the dont_drop option and the no packet loss option, "yes" means that the packet will not be lost by the protocol stack.
For the packet type of tcp or udp, you need to add the corresponding port number range, as follows:
# qosruleadd en1 tcp 192.168.31.1 192.168.31.5 1000 10010 BOTH 4 yes
2.2 View
See the use of the qoss command, as shown in figure 2.1.
Figure 2.1 qoss View
2.3 Delete
When deleting, you need to use the Nic name and the corresponding serial number, even if you use qoss to check the serial number, as follows:
# qosruledel en1 0
3 implementation principle of QoS
3.1 QoS network level
The QoS layer sits between the TCP/IP protocol stack and the netjob, parsing each packet submitted to and from the protocol stack. And operate according to the specified rules for different types of packets, the basic structure is shown in figure 3.1.
Figure 3.1 QoS network hierarchy
3.2 QoS data structure
There are mainly two types of data related to QoS: rule structure and QoS interface structure. The rule structure is divided into TCP, UDP and IP, with a total of four structures, as shown in listing 3.1 of the program.
Listing 3.1 QoS data structure
Typedef struct {
LW_LIST_LINE QOSRI_lineManage; / * IP rule management linked list * /
INT QOSRI_iRule
INT QOSRI_iCmpMethod; / * srouce, destination, both * /
Ip4_addr_t QOSRI_ipaddrHboS; / * starting IP address of IP segment * /
Ip4_addr_t QOSRI_ipaddrHboE; / * IP address at the end of IP segment * /
U8returt QOSRI_ucPrio; / * QoS priority * /
U8returt QOSRI_ucDontDrop; / * QoS reliable service * /
} _ _ QOS_RULE_IP
Typedef _ _ QOS_RULE_IP * _ _ PQOS_RULE_IP
Typedef struct {
LW_LIST_LINE QOSRU_lineManage; / * UDP rule management linked list * /
INT QOSRU_iRule
INT QOSRU_iCmpMethod; / * srouce, destination, both * /
Ip4_addr_t QOSRU_ipaddrHboS; / * starting IP address of IP segment * /
Ip4_addr_t QOSRU_ipaddrHboE; / * IP address at the end of IP segment * /
U16encrypt QOSRU_usPortHboS; / * Port start host sequence * /
U16encrypt QOSRU_usPortHboE; / * Port end * /
U8returt QOSRU_ucPrio; / * QoS priority * /
U8returt QOSRU_ucDontDrop; / * QoS reliable service * /
} _ _ QOS_RULE_UDP
Typedef _ _ QOS_RULE_UDP * _ _ PQOS_RULE_UDP
Typedef struct {
LW_LIST_LINE QOSRT_lineManage; / * TCP rule management linked list * /
INT QOSRT_iRule
INT QOSRT_iCmpMethod; / * srouce, destination, both * /
Ip4_addr_t QOSRT_ipaddrHboS; / * starting IP address of IP segment * /
Ip4_addr_t QOSRT_ipaddrHboE; / * IP address at the end of IP segment * /
U16encrypt QOSRT_usPortHboS; / * Port start host sequence * /
U16encrypt QOSRT_usPortHboE; / * Port end * /
U8returt QOSRT_ucPrio; / * QoS priority * /
U8returt QOSRT_ucDontDrop; / * QoS reliable service * /
} _ _ QOS_RULE_TCP
Typedef _ _ QOS_RULE_TCP * _ _ PQOS_RULE_TCP
/ *
QoS network interface structure
* /
Typedef struct {
LW_LIST_LINE QOSNI_lineHash; / * hash Table * /
LW_LIST_LINE_HEADER QOSNI_ QosrnRule [_ _ QOS_NETIF_RULE_MAX]; / * Rule Table * /
CHAR QOSNI_ cname [if _ NAMESIZE]; / * Network interface name * /
BOOL QOSNI_bAttached; / * whether it is connected * /
} _ _ QOS_NETIF_CB
Typedef _ _ QOS_NETIF_CB * _ _ PQOS_NETIF_CB
3.3 QoS insertion rule flow
When a new rule is inserted, the corresponding QoS interface structure is created according to the network interface name and placed in the QoS hash table. Similarly, the QoS interface is saved in the corresponding network interface structure, so that the corresponding rules can be found when the network interface has data exchange. As shown in figure 3.2.
Figure 3.2 Block diagram of QoS hash table structure
Then save the corresponding rules to the rule list of the QoS interface structure, and then add the rules with the same network interface name to the linked list, as shown in figure 3.3.
Figure 3.3 QoS rule linked list
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.