e1e0.net

sources for e1e0 website
git clone https://git.e1e0.net/e1e0.net.git
Log | Files | Refs

commit 99862637985e08c7de963ecca268e8685dc29181
parent 159c29bd5f3d3bb0d40038ce5259bc86c4f91914
Author: Paco Esteban <paco@onna.be>
Date:   Mon, 29 Jul 2019 17:12:17 +0200

develop the ling wireless link article

Diffstat:
Mcontent/long-wireless-links-and-monitoring.md | 210++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 209 insertions(+), 1 deletion(-)

diff --git a/content/long-wireless-links-and-monitoring.md b/content/long-wireless-links-and-monitoring.md @@ -11,7 +11,7 @@ XXmenuXX ## Intro -Some time ago I built 2 [P-t-P][1] links between some family members buildings. +Some time ago I built 2 [P-t-P][1] links between some family members' buildings. Thing is that my brother and my sister live in an area with no coverage from traditional ISPs, but that is quite close (5.5km on a straight line, with no @@ -129,6 +129,214 @@ I cannot say much about this. What to buy here depends a lot on your particular setup. Remember that the higher the better for the antennas, and remember wind is a thing ... you do not want it to fly away like a plastic bag. +## Build steps + +This is a list of the build steps I took. I started checking the list +mentioned on the [First steps](#first-steps-and-research) section. +Specifically the location of the antennas and the clear line of sight. + +I have to admit that I did a sloppy job on the second link, because I did not +know about the [Fresnel zone][2] back then, but there's some things you can do +to mitigate is effects. + +### Calculate signal strength + +There's a simple way to calculate the signal strength you should see on the +other side of the link (on ideal conditions). This can be taken as a reference +to see if the setup is viable and what conditions and speed negotiation you can +expect between the 2 endpoints of the link. + +The simplified formula to calculate the signal is: + +``` +emitterPower + emitterGain - signalLoss + receiverGain +``` + +I say this is the simplified formula, because it does not take into account +loses on cables and connectors, that's because I choose to use a _"all in one +packet"_ type of antenna, so that makes no sense. This is a huge advantage for +a beginner. Also, because I only take into account the free space loss and not +any other kinds of loss, that would be a lot more difficult to calculate. That +was sufficient for me anyway, as the conditions of line of sight are pretty +good. + +To calculate signal loss, this is the formula: + +``` +loss = 20*log((4*π*d)/λ) +``` + +Being `d` the distance between the 2 endpoints in meters and `λ` the +wavelength, also in meters. If you do not remember how to calculate the +wavelength from the frequency is just: + +``` +λ = C/f +``` + +Being `C` the speed of light in meters per second and `f` the frequency in +Hertz. + +So, as an example, let's say I choose channel `137` which is `5685 MHz`, and +the 2 endpoints are 5.2km apart. That gives us a signal loss of `121.85 dB`. + +According to the antenna datasheet the transmission power is `5 dBm`, the gain +of the antenna is `25 dBi` (that's on average I guess). So putting all that +together I should get on the other end `-66.86 dBm`. This works both ways in +this case, so now we have to check sensitivity. Again according to the +datasheet, there's no problem in any modulation negotiation with this kind of +signal strength (in theory, so to be on the safe side add at least `-3 dB` to +your results). + +### Physical setup and alignment + +With the theory calculations out of the way, knowing that is possible, the fun +part starts, we have to get on the roof now and install the antennas. + +Of course I won't be saying much about this, as this is different for every +single installation. Suffice to say, I had a _"pretty fun time"_ up on ladders +and climbing to places not meant to be climbed ... + +With the antenna installed, before attaching it securely to the pole, it has to +be aligned the right way. + +On the datasheet you'll find radiation plots for your model. The principle is +simple, those are 2D representations of the radiation lobes of the antenna, and +the loss referred to the total gain. So basically you want to point them to +one another as perfectly as possible, specially for parabolic antennas, which +have a very narrow beam. + +Those radiation plots confused me at first as, in case of the PowerBeam there +are 4 of them "Vertical Azimuth", "Vertical Elevation", "Horizontal Azimuth" and +"Horizontal Elevation". This did not make any sense for me in the beginning, +as the azimuth is an horizontal angle and elevation is a vertical one. It +drove me nuts. It turns out it refers to both polarisations of the signal that +those devices create ... Once you understand that is easy, they are just the +same measurement but times 2, one for each polarisation. + +Once you know how many angles you have before starting to loose signal, and +with a bit of the good old trigonometry, you know your margin of error when +pointing the antennas to each other. + +I did this standing behind the antenna and looking as if my line of sight was +the beam. With some fiddling, that should be enough for the horizontal +alignment. For the vertical one, it's easier, because the error margin is +pretty big compared to the distance to the ground, even if you're on a tall +building (again, trigonometry, that angle at 5km is some meters ...). Anyway +with the help of some online tool you can calculate that easily to make it as +precise as possible (search for "antenna downtilt calculator" on your favourite +search engine). + +### Network diagram and configuration + +With the antennas installed, it's time for some configuration. + +This is a basic diagram of the network setup: + +``` + 192.168.1.6/24 + +--------+ + | Bro. | + 192.168.1.2/24 192.168.1.4/24 | Router | + +---------+ +----------+ +--------+ + | Antenna | | Antenna | / 192.168.10.1/24 + ----| AP1 |+++++++++| ST1 |--- + 192.168.1.1/24 ---/ +---------+ +----------+ + +---------+ ++---------+ -| ISP | +|Internet |-/ | Router | ++---------+ +---------+ + | --\ +---------+ +-----------+ + \ --\ | Antenna | | Antenna | + \ --| AP2 |+++++++++| ST2 |-\ + | +---------+ +-----------+ -\ 192.168.1.7/24 + \ 192.168.1.3/24 192.168.1.5/24 +---------+ + +------------+ | Sis. | + | Rpi | | Router | + | Monitoring | +---------+ + +------------+ 192.168.10.1/24 + 192.168.1.10/24 +``` + +All are cable connections but the `++++` ones, which are the 5km links. + +On the routers/APs at the end of the chain I used the same network segment for +both, as hey will be isolated and do NAT. I did this because I have little +control over the ISP router. It is _"reset to defaults"_ from time to time and +that caused me problems before. So setting static routes would be a pain to +maintain. That produces double NAT on my siblings', but that's a small price +to pay for having a stable setup. + +Yes, I know that's a shitty thing to do for an ISP (they break your dhcp +reservations and port forwarding), but most of the ISPs where I live are the +biggest idiots and do the dumbest stuff you can imagine, so that's not even +something for them. + +The PowerBeams are configurable via a web interface that is pretty intuitive. +They can also be configured via an SSH access and editing a text file + some +commands. + +Some things I did: + +* enable WDS (transparent bridge mode), so I see the MAC addresses of all the + chain from my monitoring station. That helps on debugging if something + network goes wrong. +* I enabled SNMP for monitoring, SSH server for access (with public keys) and + NTP so the antennas have the right time (good for logs). +* All 4 antennas are set up on bridge mode. +* The ones connected to the ISP router are set up as "Access Point" and the + other 2 as "Stations" +* The antenna startup wizard asks you for country location. That's because + they apply the necessary regulation restrictions automatically. Do not + cheat here, you can have problems with your local authorities. Besides, if + you do not have good signal within the power output regulations chances are + you're doing something wrong or the conditions of line of sight, etc. are + not really good, so it won't matter and you'll be breaking the law for + nothing (and probably causing problems to other antennas and + installations). + +If you prefer the command line to configure the antennas, log into them via SSH +and edit the file `/tmp/system.cfg`. Then save to `NVRAM` with the command +`cfgmtd -w`. Then reset with `/usr/etc/rc.d/rc.softrestart force`. + +I do not recommend that method at the beginning, until you get familiar with +all the options and configurations possible. You can make a pretty big mess. + +As I said earlier, those antennas have a sort of spectrum analyser you can use +to determine which channel is less busy. It uses some java applet (yes, I know +...) and it has been broken in 2 occasions on some firmware updates. But it +can be of assistance if your spectrum is really busy. + + +### Performance tests + +There are 2 ways to easily test the throughput of the links. The web interface +has a "speed test" built in. You have to put the credentials of the other end +and it can test TX, RX or both. + +The other way (that I like the most) is `iperf(1)`. The antennas have installed +a basic implementation of that tool, so log into the antenna on the other end, +and use `iperf(1)` either as server or client to test both sides of the +communication. + +Play a bit with the channel width. More channel width allows for faster +transfer rates, but a narrow channel increases stability. + +I ended up using `20 MHz` for one of the links and `10 MHz` for the other. +That last one is the one with less than ideal LOS situation. In the end +reducing the channel width and choosing the least busy channel did the trick +and I could get a stable link. + +In the end for the first link I get around `32Mbps` symmetrical. The second +link is a lot more variable depending on the conditions and the interferences +from other stations. I get up to `17Mbps` symmetrical, and is usually more +than `12Mbps`, but on worst case scenario it can get as low as `6Mbps`. Which +is still enough to watch online videos at `1080p` with today's compressions and +is more than enough to do any kind of browsing, email and whatever ... so +I guess is enough. + +### Monitoring + ---- [1]: https://en.wikipedia.org/wiki/Point-to-point_(telecommunications) [2]: https://en.wikipedia.org/wiki/Fresnel_zone