Somewhat theoretical QoS question

I'm trying to wrap my head around networking and setting up QoS. I think I figured out why it wasn't behaving the way I thought it would on my network and I fixed the problem, but I'm interested in knowing if the way I think it is working is the way it is ACTUALLY working.

Lets say, for argument sake because it is simple, that I was trying to provide high priority to basic web browsing (HTTP, port 80).

If I understand this right here's how the communication would unfold:            
Computer-------------------------Router--------------------------Web Server

                               HTTP REQUEST (2-3kb)
port 17623>>>>>------------------------------------------->>>>>port 80

                               HTTP RESPONSE (1000-2000kb)
port 17623<<<<<-------------------------------------------<<<<<port 80

So basically:

Computer ( connects to
      Computer's port:  17682 (random)
      Google's port:  80

Computer uploads an HTTP request to Google
Computer downloads the HTTP response from Google

Open in new window

So what just happened here was the computer UPLOADED data to Google on port 80. Then Google sent data to the computer (the computer DOWNLOADED that data). The downloaded packets were destined for the computer on a randomized local port that was used for that one session. The router opened a hole in its firewall and did the appropriate NAT translation to make this communication possible.

So two data streams are happening here:

1.    Data going outbound to Google on Port 80
2.    Data coming inbound to a computer on Port 17682

My router has the ability to specify "Priority-based" QoS by specifying:
        1. Port range and protocol (TCP or UDP)
        2. "Upstream" or "Downstream"
        3. "High", "Medium" or "Low" priority

This means if I wanted to prioritize the UPLOADING, I could create a rule:
        Port 80,     Upstream,  TCP,   High priority

But to prioritize the DOWNLOADING, it would be much more difficult. The port that is used is random every time.

This makes it quite difficult to do QoS optimization for downloads based on port-number alone. Right?

I was having issues where my QoS "prioritization" rules seemed to have no effect. In my case it was a VoIP PBX I was prioritizing but I ended up solving the issue by setting up IP-based prioritization instead (all traffic to one IP is prioritized over all other traffic), which appears to be working. I was wondering if this was the reason why.
LVL 31
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aaron TomoskyDirector of Solutions ConsultingCommented:
I think the other way is only possible with layer 7 (think that's right) application layer traffic. So the router knows its a VoIP packet when it comes in and can tag it with a priority. I've done this with meraki gear once but mostly just use port based tagging for VoIP phones on their own switch port. So anything to that port gets tagged. I jus assumed it worked for the way back... Maybe not.
Not knowing your router it is totally possible that it can tag based on the either the source or destination ports.  This is typically how it is done.  When the response, the source port is 80 (http), so you router should tag it.

However, you do realize that QoS settings are ignored within the public Internet.  So once the outbound traffic leaves your router there is no QoS.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Frosty555Author Commented:
My router is an RV042, it's "QoS" is pretty primitive, indeed it was only added in a recent firmware update. It does not support application layer QoS, the only options it has are:

"Interface" - WAN1, or WAN2 (it's a dual WAN router)
"Service" - A selection of TCP/UDP, and a Port Range. No mention of whether it is source or destination
"Direction" - Either "upstream" or "downstream"
"IP Range" - local network IP, not the remote network.
Minimum Rate - a Minimum guaranteed kbps
Maximum Rate - a Maximum guaranteed kbps, or "0" for unlimited
"Enabled" - a flag to enable or disable the rule.

I guess the problem here is that the router doesn't indicate source vs. destination port. So either it can tag packets as high priority based on:

1. The source port only (upstream = port 17683, downstream = port 80)
2. The destination port only (upstream = port 80, downstream = port 17683)
3. Try to pick one or the other intelligently based on the "Direction" that was specified
4. Both ports, prioritizing if either one of them matches.

I guess #4 makes the most sense but I have no idea if that is what the router is actually doing or not.

>However, you do realize that QoS settings are ignored within the public Internet.  So once the outbound traffic leaves your router there is no QoS.
I understand. This QoS is just for contention on the Internet by various devices on my local network (e.g. my VoIP server is trying to handle a call, but in the next room somebody is downloading a big file). In general my internet is good enough to handle VoIP on its own.
--> I guess #4 makes the most sense but I have no idea if that is what the router is actually doing or not.

Unless the programmer that wrote the code is, umm how do I say this kindly, not too bright, he is going to tag the packet based on either the src or dst port matching.  So if you setup tcp port 80, it will look at both src or dst port for a match.

I will have to read up on the RV042, I thought that its "QoS" was more bandwidth control, which based on your description above makes sense.  That is, it does not tag the IP frames with QoS priority, but just makes sure that if you set max. bandwidth that type of traffic never exceeds that bandwidth usage or if you set min. bandwidth, that type of traffic will always get at least that.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking Protocols

From novice to tech pro — start learning today.