Sunday 28 August 2022

Q-in-Q (mis)adventures

    So, sometimes we offer Q-in-Q network services to our customers. Sometimes those services have to go trough subcontractors. And sometimes it can be quite  difficult to get those 3 things to work(Q-in-Q, customers, subcontractors).

What is Q-in-Q

    Q-in-Q(802.1ad) is a layer 2 service which allows you to essentially put  VLANs inside a VLAN.  VLANs are Virtual LANs, in a sense it is a networking layer 2 technology that separates switched traffic, not routed traffic. It is sometimes also called VLAN tag double  stacking. Because that is what it does, it puts another VLAN tag on Ethernet frames that already have a VLAN tag. It is often used in internet service provider networks, so that providers can offer layer2 services to their customers and their customers can use  the full 4096 spread of VLANs. In that respect, the outer VLAN is usually called the S-VLAN or the service provider VLAN, while the multitude of inner VLANs are called C-VLANs, or customer VLANs.



But, I have a story

    So, one customer orders a Q-in-Q service from us. Due to us not being  present at the B location, we have to involve a subcontractor. This has not been  the first nor the last time this customer has ordered a Q-in-Q  service from us. The subcontractor is a weird one. Some of their Q-in-Q tunnels allow native VLAN traffic over the S-VLAN. Others of their Q-in-Q tunnels do not allow native VLAN traffic over the S-VLAN. This is determined by network equipment vendor implementation as well as configuration. There are good reasons why you should not allow native traffic over a S-VLAN and why you should, but that is beyond the point of my story. 

    One day my customer calls me and tells me that their new service is not working. He says he can't reach the devices on the other end. OK, I double check, and I see no faults on my configuration. I also don't see any mac addresses coming from the direction of the  subcontractor on that service. So I call the subcontractor. I eventually after several dosenms of emails and an hour on the phone get the subcontractor to send out their technician. They replace their local device, test everything out, some issue was found and fixed. 

    I call the customer, and it is still not working. The customer said that they told him he had  to put a VLAN on his side, saying that can't be right. He said that if he has to put a VLAN on his side then the access port towards him is in trunk mode. And even when he set the VLAN which happenedd to be a VLAN with the same tag as the S-VLAN tag, it still didn't work.

    That is when it clicked for me. This customer had previously had some Q-in-Q services over us and that same subcontractor, which just worked when he was trying to send native untagged frames over the S-VLAN. As I said earlier, on Q-in-Q this sometimes works and sometimes it does not work. This  customer must have got used to this working.

    I  quickly confirmed with the customer which C-VLAN ID was he testing with on the B-side of the connection. For a test I terminated the S-VLAN on one of our routers, I put the correct C-VLAN on our router, and voila it worked. On this Q-in-Q service there can be no native S-VLAN traffic.

    It was  the customers fault. Doubly so because this customer is properly technologically educated. Nothing, I call the customer, I explain the situation to him. Just don't send native traffic over a Q-in-Q service. It-s a Q-in-Q service, send VLANs trough it.

The lessons

- Always double check  your customers.

- Working with subcontractors is still a pain.

-Avoid sending native traffic over Q-in-Q services if not necessary. It is not a best practice.

Monday 15 August 2022

Home wireless guidelines and considerations in 2022.



    So for my first post I have decided to take every-ones favourite and most hated topic, wireless. Designing a stable, fast and long range wireless network can be a painful task, but I will try to make it a little less painful. however, we will be talking only in the context of home/office wireless. Wireless PTP/PTMP deserve their own post. Also I assume you know basic wireless terms like AP, frequency, etc.

These are just guidelines for you to make better decisions, not a how to. I will not hold you by your hand. However these should help you troubleshoot your wireless issue, as well as help you on your journey to learn to design wireless networks.

    When thinking about wireless there are three golden rules:

1. If you can use a wire, use a wire. 

Wireless is good for practicality, however compared  to wired connections it is a compromise in speed and stability. I mean, wireless uses something as volatile as air as its medium. Wireless signal will be affected by air moisture, wind, pipes in the walls. Do you know where your piping is? Pipes can kill a lot of signal. do you like to microwave your food? A badly placed microwave can completely kill a wifi network. That is why in terms of performance and stability, wired is king. Yes, wireless technology is advancing at a breakneck speed, so is wired techhnology.

2. You get what you paid for.

Cheap wireless APs usually come with cheap construction thus affecting their stability and longevity. Half baked firmware affecting stability and lacking features. Weak CPUs limiting bandwidth. Weak antennas unable to recive a lot of signal power, less conductive materials and less receptive to incoming signals. and sometimes you need to buy more APs(but having too many APs is also bad).

3. Coverage-Speed-Cost triangle.

 You can have speed and coverage. You can have Coverage and have it cheap. You can have speed and have it cheap. But you can't have all three. APs, even  some cheap ones can be configured for coverage or speed. But if you need both you will need to buy more APs, which means money for the APs and CAT6 wiring. CAT6 because using CAT5 is just legacy these days.

So which AP do I buy?

    I do not recommend buying any AP  that does not support at least WIFI6(802.11ax) these days. Wifi 6 is the first improvement on the 2.4GHz frequency band since Wifi4 which was released in 2009. There are now affordable Wifi6 APs out of the factories. For the security geeks Wifi6 also comes with WPA3 encryption, which is the first improvement on Wifi security since WPA2 in 2004. I have had good experiences with Ubiquiti Unifi Wifi, so you can have a look at their Unifi6 series.

下一代wifi标准——wifi6正式启用_社会百态_中国历史网 

What are channels and frequency bands?

    To continue further, first we need to understand what are frequency bands. Frequency bands are parts of the wireless electromagnetic spectrum. These include everything from cosmic radiation, light, to human made electromagnetic signals. It is important to note that each of them has different frequencies which give them different physical properties, for us the most important are the bandwidth(speed) of transmission of data, coverage, or rather the ability of the signal to reach far places without obstacles, and the ability of the signal to penetrate obstacles. For our use we will only use the frequency bands that have been legally allowed to use for Wifi in most of the world.

    Now, what are channels? Channels are slices of frequency bands that are used to send data wirelessly. For example in the 2,4GHz band you have channel 1 with a center frequency of 2.412 GHz. Assuming the channel width is 20MHz(more on channel width later), it is important to know that wireless signals are not sent only from the center frequency of channel 1(2.412 GHz). Instead the signal is sent across every frequency on the channel which in case of a channel width of 20MHz is: center frequency+-10MHz. Generally the more frequency you have, the more bandwidth you can achieve.

Frequency bands

    There are 3 frequency bands used for home/office wireless networks. There are the commonly used 2.4GHz and 5GHz bands  as well as the new 6GHz band. Most modern APs support functioning on both the 2.4GHz and 5GHz band at the same. All of the 3 bands 

    The 2.4GHz band is the oldest wifi band in usage. In theory it supports the widest coverage, it is the best at going trough obstacles,it should be the most stable band and in theory it is also the slowest band. But often that is not in reality. The 2.4 GHz band is super congested, it is shared and interferes with bluetooth, microwaves, various other radio equipment, etc... Yes, this is the band that can get killed by turning on a microwave. It only supports 13 channels, which is not enough and can cause overlap and interference. There is a 14th channel but it is supported only in Japan and only on the old Wifi1(802.11b) standard.
However it is still useful if you live in a rural area with a clean spectrum, all you care about is coverage or you have legacy devices which only talk on the 2.4GHz spectrum(like my NEW AC ☺ ).
2.4 GHz comes in 20MHz or 40MHz channel width. More on channel widths later.

2.4GHz pros:
-theoretically wide coverage
-theoretically best at going trough obstacles
-theoretically most stable
-best support for legacy devices

2.4GHz cons:
-very congested
-only 13 channels, only 3 non-overlapping channels among them

-in reality most of its advantages are canceled out by congestion and interference.

G Routers Operating on 2.4GHz - Wireless Home Network Made Easy

    The 5GHz band is for many the solution to the woes of the 2.4GHz band. The 5 GHz band in theory has worse coverage, is less stable, is worse at going trough obstacles. However it is less congested than 2.4 GHz so those disadvantages are often canceled out. Also and more importantly the 5GHz range offers faster bandwidth. However again, because almost every AP from the last decade supports 5GHz, 5GHz has also become congested. Not nearly as congested as 2.4GHz, but enough to become a concern. Also 5GHz has 25 channels, all of which are non overlapping, meaning there is less interference. 5GHz usually comes with 20MHz, 40MHz(default channel width on 5GHz usually) or 80MHz channel widths, however Wifi5 also added support for 160MHz channel widths.

5GHz pros:
-less congested than 2.4GHz
-faster
-25 non overlapping channels
-is actually well supported nowadays
-can have better coverage and stability than 2.4GHz in congested urban areas

5GHz cons:
-has become somewhat congested itself
-less theoretical coverage, stability and obstacle avoidance than 2.4GHz



    The 6GHz range is the newest frequency range introduced in the latest WIFI6E wireless standard. Wifi 6E supported client devices and APs are still few, expensive and far in between. The 6GHz band was introduced because now the 5GHz band has also become congested. The 6GHz band is essentially an extension of the 5GHz band. It adds another 59 channels, non overlapping.
Due to physics, 6GHz provides the fastest bandwidth speeds. However it also has the worst coverage, it is the worst at going trough obstacles and the connection might be somewhat unstable. Like 5GHz it supports  20MHz, 40MHz, 80MHz and 160 MHz channel widths.

6GHz pros:
-almost no congestion
-fastest
-many channels to choose from.

6GHz cons:
-largely unsupported in 2022
-bad coverage, obstacle penetration and stability issues.
-some of the previous uses of the band have not yet been completely removed(so that introduces a tiny bit of congestion)

Channel width

    So, like previously said, channel widths come in sizes of 20MHz, 40MHz, 80 MHz and 160 MHz. Generally, the larger the channel width, the more frequencies there are in a channel, the more data can be sent over that channel. Think of it like comparing a small road with multi lane highways. So you achieve higher bandwidth. So larger is better? No. In this case larger is not always better.

    The larger the channel width, the wireless signal will be weaker. For a larger channel width you will loose coverage distance, the signal will be much more susceptible to interference, and the signal will be worse at penetrating obstacles, like walls etc...

    Why does this happen? The answer is, electricity. A wireless device, like an AP is intentionally designed that it can only send a limited amount of signal towards its antenna.

    So for example., if an antenna on an AP receives 22dBm of electrical signal from it's AP, and that is its maximum. This power of 22dBm will always remain the same. The antenna will spread out that electrical power over the channel width and convert that electrical power into a wireless electromagnetic signal. This is good as it will be a strong signal, although limited in bandwidth. Now another example, the same antenna with the same input power of 22dBm is configured for a channel width of 40MHz. Now the antenna needs to spread its received power over 40MHz, which means the signal will be weaker, however the wireless signal will be able to carry more data increasing bandwidth. For 80 MHz, the antenna will have to spread its electric power even more, and at 160MHz the signal will be very fragile, but there will be a huge bandwidth, a theoretical bandwidth of more than 900Mbps.

    I have tested 160MHz and I have found that I have lost all signal after a single plywood wall was between me and the AP. So I do not recommend using 160MHz unless you plan to put an AP in every room or you will sit in a room with an AP all day.

    Another problem with using large wifi channel widths is that you are using up more of of the frequency band, thus increasing risks of interference, overlap and just generally polluting the spectrum. When IO said that 5GHz has 25 non overlapping channels, I meant it had 25 20MHz non overlapping channels. With 40MHz or higher channels, overlap can be reintroduced. Also, 2.4 GHz has 13 channels, 3 non overlapping, but it can have only  2 overlapping 40MHz channels. Theoretically you could fit an 80MHz channel into 2.4GHz, but nobody does that.  Likewise, 5GHz can only have 12 non overlapping 40MHz channels and 6 non overlapping 80 MHz channels. And only 2 non overlapping 160 MHz channels. There is a bit more space on the 6GHz band.

    So what is my recommendation for which channel widths to use?  

-Use 20MHz on the 2.4GHz  range to achieve maximum legacy support and to achieve maximum coverage. This signal will fill in gaps where other signals can not reach.Not all devices support 40Mhz on the 2.4GHz range.
-On the 5GHz band  use either 40MHz or 80MHz, your call. Ofcourse, 40MhH is a compromise on the side of coverage, while 80MHz will achieve more bandwidth.
-If you happen to be an early adopter of Wifi6E and your router support 6GHz, I would use 80 MHz, 160Mhz is also fine but only if you plan to cash out for an AP in every room.

Do I need a floorplan?

    Well for any good design of a wireless network you will need a floor plan. How thick are the walls? What are the walls made of? Are there any pipes or other large metal objects in the walls? What are the distances and floor dimensions? Where is the microwave? I would need an entire separate post for that.

    However I can share some general guidelines. First of If you plan to buy just one AP, my best advice is that you place it somewhere centrally in the house or office, but away from large metal objects or surfaces. Also place it somewhere high up as most  AP antennas are designed as such that their signal falls down. And if your antenna can be ceiling mounted, mount it to the ceiling.
Second, a good rule of thumb is that if the signal has to penetrate more than 2 walls, 3 at most... Then you need more APs.

So, the end...

    Designing a good wireless network is hard. Designing a wireless network that is both stable and fast is even harder. If you can, you really should consider to use wired connections where possible. Wifi just requires some patience. However if that is not an option, I hope that you have learned something while reading my post. If you have any thoughts, be sure to share them in the comments.

 

User story 1: The client has to pay because their IT guy refuses to replace two patch cables.

 Introduction Actors: $dude - DevOps hired by the client company. $colleague - My colleague, stuck in the same quagmire as I am. To be short...