Hello,
VyOS 1.3.1, dual WAN with failover and SNAT, zone based firewalls, IPSEC VPN.
In attempting to learn to how properly setup QoS I read the support article and forum posts and opted for a shaper policy (with classes) for outbound and a shaper policy attached to an IFB for inbound. Feeling accomplished I ran some tests but everything seemed to be stuck in the default queue. After much self doubt, bashing of head against wall, bleary eyed reading (this was the 3rd 14 hour day in a row) I found in a forum post that said outbound classes couldn’t match the source IP when SNAT is used, it will only be able to match the translated outbound interface, a work around was to mark the packets and use that as a class matcher. Relief flooded me as it appeared logical so must work. I gave it a go and alas the result was the same, the default queue was always used. Here I said a prayer since I was at the end of my tether and stepped away for 30 minutes. Upon my return a forum post was found that indicated marking packets would’t work as a class match if dual WAN failover was in use (which it was) due to the order of how things are mangled (whatever that means). So I removed the failover config and the QoS classes started working as expected. Great, but I need dual WAN failover…
In the future my standard will be to have LAN gateway where all internal zones are firewalled, routed and it will have one external interface without NAT, QoS for Internet based purposes will apply the external interface. Then a WAN gateway will be beyond that for dual WAN failover and SNAT, no QoS.
Now that the background is out of the way, to the original question. Since we have only 1 router and I need SNAT, WAN failover and QoS I’ve opted to use just one queue for WAN outbound and to use a shaper for LAN outbound instead of WAN-IN via IFB. I’d like to know if this a valid way to implement this, or if there is a more acceptable method.
2 WAN interfaces on ETH0 and ETH1 (600Mbps down and 35Mbps up on primary WAN)
bond0 with 8 vif on ETH2-5 (4x 1Gbps)
Since QoS on bond0 has a total of 4Gbps I’m using this as the default ceiling value so as to not limit speeds on traffic between vifs. Then using the WAN download Gbps divided by bond0 Gbps = % used for ceiling on classes.
Some of our vendors require a guaranteed amount of bandwidth for their subnet which is why we need to implement a shaping policy for WAN-IN (which is LAN-OUT).
A network group was created with the RFC1918 IP addresses and this was used to mark WAN packets that were not RFC1918
set policy route NOT-RFC1918-IP rule 10 description "Mark packets NOT from RFC1918-IP"
set policy route NOT-RFC1918-IP rule 10 source group network-group !RFC1918-IP
set policy route NOT-RFC1918-IP rule 10 set mark 19217210
set interfaces ethernet eth0 policy route NOT-RFC1918-IP
It’s interesting that using “!” doesn’t show when using tab to see the autocomplete possibilities when creating the policy route, but it accepted it and it seems to work.
Then the LAN-OUT shaper policy was created, packets marked on the WAN via policy route NOT-RFC1918-IP together with the destination being a particular subnet was used to create different classes (this acting as a marker for packets that traverse the WAN interface and are heading to the internal subnets)
set traffic-policy shaper LAN-OUT bandwidth '4000mbit'
set traffic-policy shaper LAN-OUT class 10 bandwidth '1%'
set traffic-policy shaper LAN-OUT class 10 ceiling '15%'
set traffic-policy shaper LAN-OUT class 10 match CA_LAN2-NET ip destination address '10.254.167.0/24'
set traffic-policy shaper LAN-OUT class 10 match NOT-RFC1918-IP mark 19217210
set traffic-policy shaper LAN-OUT class 10 queue-type 'fq-codel'
set traffic-policy shaper LAN-OUT class 10 queue-limit 1000
set traffic-policy shaper LAN-OUT class 10 priority '1'
set traffic-policy shaper LAN-OUT class 20 bandwidth '4%'
set traffic-policy shaper LAN-OUT class 20 ceiling '15%'
set traffic-policy shaper LAN-OUT class 20 match TESLA_LAN-NET ip destination address '10.254.158.0/24'
set traffic-policy shaper LAN-OUT class 20 match NOT-RFC1918-IP mark 19217210
set traffic-policy shaper LAN-OUT class 20 queue-type 'fq-codel'
set traffic-policy shaper LAN-OUT class 20 queue-limit 1000
set traffic-policy shaper LAN-OUT class 20 priority '3'
set traffic-policy shaper LAN-OUT class 30 bandwidth '1%'
set traffic-policy shaper LAN-OUT class 30 ceiling '15%'
set traffic-policy shaper LAN-OUT class 30 match CA_LAN-NET ip destination address '10.254.157.0/24'
set traffic-policy shaper LAN-OUT class 30 match NOT-RFC1918-IP mark 19217210
set traffic-policy shaper LAN-OUT class 30 burst 128k
set traffic-policy shaper LAN-OUT class 30 queue-type 'fq-codel'
set traffic-policy shaper LAN-OUT class 30 queue-limit 1000
set traffic-policy shaper LAN-OUT class 30 priority '5'
set traffic-policy shaper LAN-OUT default bandwidth '25%'
set traffic-policy shaper LAN-OUT default ceiling '100%'
set traffic-policy shaper LAN-OUT default queue-type 'drop-tail'
set traffic-policy shaper LAN-OUT default burst 128k
set traffic-policy shaper LAN-OUT default priority '7'
set interfaces bonding bond0 vif 20 traffic-policy out LAN-OUT
set interfaces bonding bond0 vif 180 traffic-policy out LAN-OUT
set interfaces bonding bond0 vif 160 traffic-policy out LAN-OUT
...
Drop tail was used for the default policy since this should be mostly traffic between internal VLANs and I didn’t want traffic to be limited due CPU resources.
For WAN-OUT I was unable to come up with a work around to that would allow me to move the policy to the internal interfaces (that is have it match a packet that comes from a particular subnet and is destined for a non-RFC1918 address). So I went with single queue with no classes.
set traffic-policy shaper WAN0-OUT bandwidth '35mbit'
set traffic-policy shaper WAN0-OUT default bandwidth '25%'
set traffic-policy shaper WAN0-OUT default ceiling '100%'
set traffic-policy shaper WAN0-OUT default queue-type 'fq-codel'
set traffic-policy shaper WAN0-OUT default priority '7'
set interfaces ethernet eth0 traffic-policy out WAN0-OUT
The main goal here being that the VOIP traffic will fare well when the outbound connection is saturated.
Is the above a valid solution considering the wan failover and SNAT?
Thank you,
Jacob