diff options
author | mkorobeinikov <92354771+mkorobeinikov@users.noreply.github.com> | 2023-02-23 07:41:13 +0300 |
---|---|---|
committer | mkorobeinikov <92354771+mkorobeinikov@users.noreply.github.com> | 2023-02-24 05:56:45 +0300 |
commit | 7a8c211c693addad9def253c687239814297385b (patch) | |
tree | 8ee42b594c189a58eba46f4894c670e6ea3946be /docs/configexamples/qos.rst | |
parent | d41d1a73a52d54652ee4da6f4ec9c796d98d6dd2 (diff) | |
download | vyos-documentation-7a8c211c693addad9def253c687239814297385b.tar.gz vyos-documentation-7a8c211c693addad9def253c687239814297385b.zip |
QoS example article
An example of how to set up QOS.
Diffstat (limited to 'docs/configexamples/qos.rst')
-rw-r--r-- | docs/configexamples/qos.rst | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/docs/configexamples/qos.rst b/docs/configexamples/qos.rst new file mode 100644 index 00000000..cb8983ab --- /dev/null +++ b/docs/configexamples/qos.rst @@ -0,0 +1,183 @@ +:lastproofread: 2023-02-18 + +.. _examples-qos: + +########### +QoS example +########### + +Configuration 'dcsp' and shaper using QoS +========================================= + +In this case, we'll try to make a simple lab using QoS and the general ability of the VyOS system. +Before we recommend you noticed the main article about QoS + +| :ref:configuration/trafficpolicy/index:qos + +Using the general schema for example: + +.. image:: /_static/images/qos1.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +We have four hosts on the local network 172.17.1.0/0. All hosts are labeled CS0 by default. We need to replace labels on all hosts except vpc8. +We will replace the labels on the nearest router “VyOS3” using the IP addresses of the sources. + +* 172.17.1.2 CS0 -> CS4 +* 172.17.1.3 CS0 -> CS5 +* 172.17.1.4 CS0 -> CS6 +* 172.17.1.40 CS0 by default + +Next, we will replace only all CS4 labels on the “VyOS2” router. + +* CS4 -> CS5 + +In the end, we will configure the traffic shaper using QoS mechanisms on the “VYOS2” router. + +Configuration: +============== + +Set IP addresses on all VPCs and a default gateway 172.17.1.1. We'll use in this case only static routes. +On the VyOS3 router, we need to change the 'dscp' labels for the VPCs. To do this, we use this configuration. + +.. code-block:: none + + set interfaces ethernet eth0 address '10.1.1.100/24' + set interfaces ethernet eth0 traffic-policy out 'vyos3' + set interfaces ethernet eth1 address '172.17.1.1/24' + set protocols static route 0.0.0.0/0 next-hop 10.1.1.1 + set traffic-policy shaper vyos3 class 10 match ADDRESS10 ip source address '172.17.1.2/32' + set traffic-policy shaper vyos3 class 10 set-dscp 'CS4' + set traffic-policy shaper vyos3 class 20 match ADDRESS20 ip source address '172.17.1.3/32' + set traffic-policy shaper vyos3 class 20 set-dscp 'CS5' + set traffic-policy shaper vyos3 class 30 match ADDRESS20 ip source address '172.17.1.4/32' + set traffic-policy shaper vyos3 class 30 set-dscp 'CS6' + set traffic-policy shaper vyos3 default bandwidth '10%' + set traffic-policy shaper vyos3 default ceiling '100%' + set traffic-policy shaper vyos3 default priority '7' + set traffic-policy shaper vyos3 default queue-type 'fair-queue' + +Main rules: + +* ADDRESS10 change CS0 -> CS4 source 172.17.1.2/32 +* ADDRESS20 change CS0 -> CS5 source 172.17.1.3/32 +* ADDRESS30 change CS0 -> CS6 source 172.17.1.4/32 + + +Check the result + +.. image:: /_static/images/qos2.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +Before the interface eth0 on router VyOS3 + +.. image:: /_static/images/qos3.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +After the interface eth0 on router VyOS3 + +.. image:: /_static/images/qos4.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +On the router, VyOS4 set all traffic as CS4. We have to configure the default class and class for changing all labels from CS0 to CS4 + +.. code-block:: none + + set interfaces ethernet eth0 address '10.2.1.100/24' + set interfaces ethernet eth0 traffic-policy out 'vyos4' + set protocols static route 0.0.0.0/0 next-hop 10.2.1.1 + set traffic-policy shaper vyos4 class 10 bandwidth '100%' + set traffic-policy shaper vyos4 class 10 burst '15k' + set traffic-policy shaper vyos4 class 10 match ALL ether protocol 'all' + set traffic-policy shaper vyos4 class 10 queue-type 'fair-queue' + set traffic-policy shaper vyos4 class 10 set-dscp 'CS4' + set traffic-policy shaper vyos4 default bandwidth '10%' + set traffic-policy shaper vyos4 default burst '15k' + set traffic-policy shaper vyos4 default ceiling '100%' + set traffic-policy shaper vyos4 default priority '7' + set traffic-policy shaper vyos4 default queue-type 'fair-queue' + +Next on the router VyOS2 we will change labels on all incoming traffic only from CS4-> CS6 + +.. image:: /_static/images/qos5.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +.. code-block:: none + + set interfaces ethernet eth0 address '10.1.1.1/24' + set interfaces ethernet eth1 address '10.2.1.1/24' + set interfaces ethernet eth2 address '10.9.9.1/24' + set interfaces ethernet eth2 traffic-policy out 'vyos2' + set protocols static route 172.17.1.0/24 next-hop 10.1.1.100 + set traffic-policy shaper vyos2 class 10 bandwidth '100%' + set traffic-policy shaper vyos2 class 10 burst '15k' + set traffic-policy shaper vyos2 class 10 match VYOS2 ip dscp 'CS4' + set traffic-policy shaper vyos2 class 10 queue-type 'fair-queue' + set traffic-policy shaper vyos2 class 10 set-dscp 'CS5' + set traffic-policy shaper vyos2 default bandwidth '100%' + set traffic-policy shaper vyos2 default burst '15k' + set traffic-policy shaper vyos2 default ceiling '100%' + set traffic-policy shaper vyos2 default priority '7' + set traffic-policy shaper vyos2 default queue-type 'fair-queue' + +.. image:: /_static/images/qos6.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +* 172.17.1.2/24 CS0 + +.. image:: /_static/images/qos7.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +* 172.17.1.2/24 CS0 - > CS4 + +.. image:: /_static/images/qos8.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +* 172.17.1.2/24 CS4 - > CS5 + +.. image:: /_static/images/qos9.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +In the end, on the router “VyOS2” we will set outgoing bandwidth limits between the “VyOS3” and “VyOS1” routers. Let's set a limit for IP 10.1.1.100 = 5 Mbps(Tx). We will check the result of the work with the help of the “iPerf” utility. + +Set up bandwidth limits on the eth2 interface of the router “VyOS2”. + +.. code-block:: none + + + vyos@vyos2# show traffic-policy shaper vyos2 class 20 + bandwidth 5mbit + description "for VyOS3 eth0" + match VyOS3 { + ip { + source { + address 10.1.1.100/32 + } + } + } + +Check the result. + +.. image:: /_static/images/qos10.png + :width: 80% + :align: center + :alt: Network Topology Diagram + +As we see shaper is working and the traffic will not work over 5 Mbit/s.
\ No newline at end of file |