I spoke briefly about wireless in a previous post. Here, I’ll discuss some observations from on-the-job learning.

Frequencies

In our setting, the main frequencies we use are 2.4GHz and 5GHz, which is newer. There a pros and cons to each which, although known in theory, can still require on-site experimentation and measurement (with a wifi analyzer) to find the best options. Also, some devices deployed still can’t use 5GHz, so we have to keep that in mind as well.

2.4GHz has lower bandwidth, so it can’t carry data as quickly, BUT it isn’t disrupted as much by walls and has a longer range the 5GHz.  5GHz is faster BUT it has less range and has a harder time getting through walls. This means that knowledge of the AP (access point) placement, as well as the design of the building and expected working areas, is required to determine which frequency to use. Fortunately, the devices we deploy have (at least) two antennae, so we can broadcast on both frequencies.

We also have to be mindful of the standards supported by the devices themselves. This is seen in the “letters” that often follow the channel or frequency listing. The letters reference that actual IEEE standard for the technology – 802.11, 802.11b, 802.11a, 802.11g, 802.11n, and so on. Newer technologies support higher link rates, and different frequencies, but older devices may not support them. We’ve had a few locations where we’ve had to use older, slower technologies because that’s all that was supported on the client devices themselves.

Channel Width

Moving along, we also have Channel Width – this is essentially how “wide” our signal is allowed to be within the frequency we’re using. For example, 2.4GHz is a range of frequencies from 2.4GHz to 2.5GHz – a 100 MHz range. The more channels we have, the more devices can communicate, BUT the more likely they are to interfere with each other, and the less bandwidth available to them. So channel width is a tradeoff between channel overlap and bandwidth – the more bandwidth we allow, the fewer channels available.

 Wifi Network Type

In our setting, we have three WiFi network types available – bridge, ad hoc, and mesh.

In Bridge networks, the Access Point is basically just a “bridge” back to the main network device (a firewall in our case). If we use integrated Access Points, we can define all of the wifi information on the firewall, plug the APs in, and they’ll just work. If we use other-vendor APs, we have to define the SSID etc. on the AP, which, when connected to by a wireless device, “bridges” the signal back to the firewall.

I’ve only seen an Ad Hoc network once – this is when the devices just communicate directly with each other over wifi. We only had to do it when the network died, so we got the sales PC wirelessly talking to the sales printer. It was ugly and I don’t recommend it at all if other options are available.

Finally, there’s Mesh wifi. We’ve only had to use it when there’s no easy way to get a wired connection from the APs back to the main network. In Mesh Networking, the AP doesn’t just wireless communicate with the client devices; it also uses a wireless connection to get back to the main network hub.

Conclusion

All that said, we’re fortunate in that, for the most part, our wifi setup is pretty straightforward. We configure the SSID and password on the firewall, plug in our (same-vendor) APs, and done. It’s rare that we have to do much more than that.

I’ll say up front that I’ve had less experience with these, but hopefully it’ll be somewhat useful. I’ll address Wireless up front, as all the rest are some type of wired media.

Wireless/WiFi

This is WiFi/Wireless that’s used by cell phones, tablets, and wifi-enabled laptops & desktops. It has the advantage of not requiring a wire (obviously), but it has a few downsides as well. In my experience, I always prefer wired if I can because of these downsides. First, walls and distance become a factor that can make wifi unreliable or unavailable. Also, the transmission speeds tend to be lower due to the signal being attenuated over distances & through obstacles. Also, it can technically be less secure as it’s easier for a less tech-savvy user to use an insecure connection method which allows their traffic to be intercepted. But obviously, the advantage of being mobile and able to use the device is much superior to the downsides in certain settings.

The rest of these are wired methods

Ethernet

This is the common “computer cable” you’re used to – Cat5, Cat6, “networking cable”, “weird phone cable”, etc. The Cat-* just indicates which generation the cable is. Higher numbers are later generation and are faster & more modern. Compatibility can be an issue, so don’t assume that buying a more recent cable will automatically make the connection faster, as the other network equipment may not support it.

Ethernet uses the RJ-45, which, when on the phone with non-tech savvy folks, I will summarize as “a wider phone connection, but too large to fit into a phone jack).

Ethernet is cheap and common, but there are length restrictions to it – you can’t run an ethernet cable hundreds of feet and expect a good connection (though I’ve had customers try that). After a few hundred feet, you’ll need SOMETHING to boost the signal – either a switch or a dedicated device.

For longer runs, we use:

Fiber

Fiberoptic cable uses one (or more; usually more) tiny, thin glass threads to send the signal along at near-light speed. While it can handle longer distances and is much faster than ethernet, it’s a lot more fragile (since the inside is glass threads instead of copper wires). So we either 1) use it in short runs to connect switches to each other, since that’s usually locked away in a network closet, or 2) run it through conduit longer distances to provide fast connections more remote locations.

Coax[ial] Cable

You’re probably used to seeing this as the Cable connection for the TVs. We don’t use it ourselves, but it is commonly used by ISPs to connect their cable run to their equipment, which we then bridge to our equipment either with Ethernet or Fiber. I see it as something of a tradeoff between Ethernet and Fiber – it has the long-range of Fiber and the sturdiness of Ethernet, with a price that’s probably in the middle (although I haven’t priced it out in a while). But it’s not as fast as Fiber, so, since we CAN get fiber and run it, we tend to use that for the backbone of our networks (connecting our switches to each other and eventually to the firewall/routers), as fiber doesn’t have as much issue with traffic congestion as cable does.

SFP Modules

Fortunately, most of our equipment comes with “SFP” module interfaces. This is a great feature on our equipment where it comes with an empty port. Into that port we plug an SFP (small form-factor pluggable) module which functions like a converter to ethernet, fiber, coax (and other) interfaces. So if we decide to swap what cable/wire we want to use, we can just replace the SFP module instead of the entire device. As indicated above, this is usually starting with an Ethernet SFP and then switching to a Fiber SFP when we need to handle more traffic.

Here’s some pics of SFP modules (shared with Creative Commons licenses)

Ethernet SFP module
Fiber SFP

In my last post, I discussed different devices that move your piece of information (“packets”) around your network, and also out to OTHER networks on the internet. In this post, I’ll look at a few different TYPEs of packets and what they do. Additionally, some protocols use custom “Ports” – not a physical port like a plug, but a software-defined port which is added as a “tag” to the network traffic to help the network devices understand what it is & where it’s going.

Ping

Ping is great for troubleshooting connection issues (which will be discussed more in a later post). Ping sends a packet out to an IP address that’s designated in the command and reports how long it takes to get a response, OR the error that arises if no response is given. There’s also the helpful -a flag which will try to resolve the Hostname for the IP via DNS (see below).

Tracert

Tracert is great for 1) determining how the traffic is flowing from your PC to the remote IP and 2) see where the connection is “breaking down” if it’s not resolving. It’s a pretty brilliant piece of software under the hood – basically, it increments the number of allowed “hops” (moves from one IP to another) and builds the chain that way. So first it tries to go to your destination IP but only allows 1 hop – so it’ll stop at the next IP in the chain (either your switch or router, probably), which then will report that there’s no more allowed hops and will give its name/IP. Then, tracert increments the allowed hops to ‘2’ so it will get to the next device IP, which will report on itself. It does this until it finally gets to its destination, and then reports the full list of IPs & hostnames. OR, if it fails to reach, you can see WHERE the failure occurred – somewhere AFTER the last successful IP/device.

SSL/TLS

Secure Sockets Layer and Transport Layer Security are cryptographic protocols for increasing security of network traffic. While the encryption methods & authentication systems are outside the scope of this post, they use a series of secret keys to encrypt & decrypt the data at each end of the traffic. Many older protocols will have a version with “S” appended to the end, indicating that it’s the Secure version.

SMTP/SMTPS

This is an actual data protocol, versus a troubleshooting one. In our setting, Simple Mail Transfer Protocol is used by 1) email servers delivering & receiving email to each other and 2) hacked computers sending spam. So on our firewalls, we ALLOW a local email server to send SMTP traffic, but BLOCK anything else from doing so.

A variant of SMTP is SMTPS (the S is for Secure) which is more secure as it uses TLS (Transport Layer Security) to authenticate the servers to each other to prevent security leaks. SMTP uses port 25, while SMTPS uses port 465. Some common email providers use alternate ports for SMTPS.

HTTP/HTTPS

This is your “web browsing” traffic – hence all webpages start with “HTTP(s)://). Hyper Text Transfer Protocol allows you to click on webpages and go to other webpages, or download something, etc. HTTP uses ports 80, while HTTPS (secure) uses 443.

FTP

File Transfer Protocol is used for transferring files from one system to another. It uses ports 20 & 21, based on what exactly is being done in the protocol (setting up the connection, reading files, or writing/sending them).

SSH

Secure SHell is used to remotely connect to other systems via a command line. It uses port 22. It’s helpful for remotely managing and working on other systems without having to setup a full Graphical User Interface. It can also be used to transfer files (SCP, SFTP).

DNS

Domain Name System is used to resolve IP address (like 64.233.177.138) to a Hostname (in this case, “google.com”). Computers only know numbers, while Humans prefer names. DNS is the “glue” to convert one to the other. It uses port 53.

DHCP

Dynamic Host Configuration Protocol, usually on ports 67 & 68, is used to determine what IP address a new device on the network will have assigned. A dedicated DHCP server is responsible for assigning the minimum information required to devices that ask. Generally, that’s

  1. The IP address (what’s my local address on this network),
  2. The subnet mask, used to determine how large the local network is so a device knows if an IP is nearby OR if it needs to send the traffic to
  3. The IP of the Default Gateway, which is a routing device that will handle traffic needing to leave the local network.

The local PC will get its IP address, and then use the Subnet Mask to calculate what OTHER IPs will be on its local network. That way, if it needs to communicate with something directly, it’ll do so. Otherwise, it’ll know the IP address of the Default Gateway and will send the network traffic to THAT IP and allow the Gateway to handle moving it to its correct destination. Every device on the way will use this same structure to get the packet to where it needs to go.

This is already longer than I had intended, but this hopefully addresses the more commonly encountered ports & protocols.

This is the first of (hopefully) a serious of learnings, observations, troubleshooting steps, and informative stories learned at my new IT job.  While the job is generally “all IT related”, most of it is network-related due to the interconnectedness of everything among my employer’s systems. So, most of these posts will probably be somewhat network-related. Also, this will hopefully be used to for my CompTIA Continuing Ed credits if I end up not getting Security+ for that.

In this first post, I want to discuss the various pieces of networking hardware and their purposes. All of these are items I work with regularly at work, but they can also be encountered in a home setup.

Routers

                Routers handle…routing. That is, when a piece of information needs to travel on the network (aka a “packet”), the routers handle moving that packet FROM one network TO another (this differentiates them from Switches, below). In a later post I’ll discuss how the equipment knows what to do, but in the meantime just think of a router as a device that helps packets move outside their home network and find where they should go next.

                Many devices include a routing function – firewalls, dedicated routers, and so on. In a home setting, your ISP-provided equipment includes a router so that packets can get outside your home to the rest of the internet.

Switches

                A switch is, basically, a way to plug multiple network connections into a single device, which is then itself plugged in via a single cable somewhere else. A common setup might be that each PC/smart TV/etc. on a single floor of a building is plugged into a single switch for that floor (or, in a smaller building, a switch for the entire building). Then, the switch has a single cable run from it to another destination (a “master” switch, or a router/firewall). This removes the requirement to have EVERY cable from EVERY device plugged into your firewall/router.

Firewalls

                I’ve mentioned firewalls several times. These are a security device that handles packet/traffic flow according to pre-determined rules setup inside it. I think of a firewall as “a device that routes packets from one port to another based on the rules you set”. In my settings, the firewall sits between the switch(es), which are plugged into its “LAN” ports, and the ISP equipment, which is plugged into the firewall’s “WAN” port(s). Inside the software of the firewall, we determine what traffic can flow where (LAN to WAN and vice-versa) according to business needs.

                More advanced firewalls can also have routing functions, switching functions, DHCP/DNS functions, and more.

Access Points (APs)

                In our settings, APs are wireless APs. Via an ethernet cable run from the firewall/switch to the AP, the AP then broadcasts a WiFi signal for wireless devices to connect to. Based on the setup, they either expand an existing WiFi network, OR serve an independent wifi signal that’s routed back via the ethernet cable to the main network.

VPN

                Virtual Private Networks (VPNs) are a (usually) software-defined network that runs on computer. In  our setting, it’s an app that, after logging into it, connects via an encrypted tunnel to a firewall somewhere else. All traffic is 1) routed through the tunnel. This mean it can’t be snooped on our monitored in-transit, for security purposes. Additionally, since it “comes out” on the other end of the tunnel at the business firewall, 2) the computer can function as if it were physically plugged into the network at the business. This means that a laptop can connect to local resources at the office, but, when taken home, the VPN can be connected so the laptop can STILL connect to “local” (at the office) resources WITHOUT sacrificing security or having to allow those resources to have an open, inbound connection.

Summary

A common “connection” flow might be something like this:

INTERNET -> ISP Equipment -> Firewall/Router -> Switch(es) — many connections to different devices and access points. Additionally, a VPN (in our setting) logs into the Firewall and would be branches off of that.

That concludes a brief survey of networking equipment and applications. Next week, we’ll look at various Ports & Protocols that network traffic uses, and how that can be used on a firewall for increased security.

What I Learned Today

WordPress tells me this is the 17th post I’ve written. That’s not true at all. I know it’s not true. This is the 31st post I’ve written. But the missing 14 or are gone forever. Why? Because in my own hubris and impatience, I deleted them forever, accidentally, at 2am this morning.

Lesson 1: NEVER AUTOREMOVE/UNINSTALL/PURGE A PROGRAM WITHOUT UNDERSTANDING WHAT IT WILL TAKE WITH IT

Using Amazon Linux, I installed the (then) current versions of apache, mysql, php, etc. That’s fine. They’ve worked great. But a program I wanted to play with required PHP 5.4+, while I was stuck on 5.3. So I uninstalled PHP, but then needed to update apache, mysql, etc. – so I just uninstalled them all, purged everything, and installed newer versions.

I purged everything.

I purged everything.

I purged everything.

I purged the mysql database.

All of my posts are WERE stored in that database. All of the data from my project management software were stored in that database. All of the user login data from my site were stored in that database.

Lesson 2: NEVER DO SOMETHING REALLY LATE AT NIGHT

When I told my wife I’d done this, the first thing out of her mouth: “Did you do this really late last night?” Yes. Yes I did. Just like she’s been reminding me not to do since she was my girlfriend. I know better. It happens A LOT (though never this critically – see lesson 3…). I know by know that when I wake up at 6am with 4 hours sleep, work a full day, grab supper and run out to a function until 10pm, get home at 11 then work for 2 more hours until I’m passing out – that is not the time to do what I did.

Lesson 3: FREQUENT BACKUPS

The only reason this is post 17 and not post 1 is I do have a backup from the end of February.

This is what I’m kicking myself the most over – because the very last thing I put into the mysql database (I’m not kidding) is a reminder to myself to set up a regular backup system.

The irony of this is agonizing.

What I Lost

2 months of blog posts – my World War I series 100 years later in Real Time (each Saturday, releasing a mock news article about what happened 100 ago to date). 2 months of project management work items/tasks/bug tracking/etc.  Other things I don’t know yet.

APPLICATION

1. Regular backups. Since I write bi-weekly, I’ll just do it after each article.

2. Don’t do anything after 11pm that can’t be CTRL-Z’ed.

3. Understand what the command I’m about to do does.

4. Get away from my computer right now before I break it physically.

I’ve mentioned it before, but I just wanted to reiterate: I’ve been much more productive with the pomodoro technique the last few weeks. I use kanbanflow.com to manage it – the combination Kanban board and pomodoro timer works great for me. In the past, by todo list has been pretty random, ad-hoc, and subject to constant changes.

Saturday, I set up my board – my todo tasks for the following week. This will range from “Exercise like this” to “Read this” to “Update that.” Each morning, I make sure my hard-copy planner matches up with what’s on the board, and also do a review of the previous day to see how I did. I DO NOT add anything to the new day’s list that morning – any additions were done on previous days. This means that my list is feature-locked each morning. I feel like this is a little bit of Scrum – Sunday I review my previous week, check to see what I need to do this week, have daily standups to see how I’m going, and check my progress at the same time.

The pomodoro advantage increases productivity first by keeping me focused (“I can focus on this huge task for just 25 minutes”), removing guilt over relaxing (“I’ll check that email in 7 more minutes” [yes, I feel guilty for taking breaks]), and also letting me keep track of my time (“Ugh, I spent 45 minutes reading email? That’s awful!”). I’m still crunching numbers on my productivity last year and so far this year, but when I get to a good point (perhaps end of this quarter) I’ll take a close look at how it’s been.

I had originally intended to spend this post discussing Ceedling, and Unity testing, but now I won’t. Why? Over the weekend, I was reading the API guide for Arduino libraries, and realized they’re heavily focused on object-oriented programming. Synthduino was written in a functional style (it’s C) – while I’d used a basic struct to hold together a note’s frequency and duration, all the calls where global functions that accepted either a note or one of its members as a parameter. This was contrary to the API.

 

I did research, trying to find a good unit testing suite for C++. Turns out I’d somehow missed what should have been a top result: Google Test (aka gTest). I had gotten distracted by the Wikipedia list of suites, and gone through there. If only…
Anyway, I’ve spent the last 2-3 days rewriting Synthduino in C++, with classes, and rewriting the test suites. Fortunately, the logic and test data is the same, so I’ve got that going for me. Once I’ve spent more time with Google Test, I’ll try to do a better comparison between it and Ceedling/Unity.

Wherein our hero fights the dragons of cross-platform compatibility, libraries not being updated, inadequate documentation, and the fact that Arduino can’t do unit testing natively.

 

Why?

I’m currently working on the new release of my project Synthduino, and I’ve fallen in love with Unit Testing from various Ruby and Ruby on Rails projects I worked on last year. I decided it would be good to bring unit testing to Synthduino, not only to give me a clearer roadmap of development (unit tests help focus effort), but also make sure my work is good quality (as I do want Synthduino to be used).

What?

I briefly considered writing my own framework, but I’m not really comfortable enough in C/C++ to do it, so I looked into frameworks. Based on what I read, I narrowed it down to two options: CppUnit and Ceedling. From what I gathered, CppUnit was the more established of the two, but Ceedling was built on Ruby to use rake. I decided to try them both out.

Where?

My development platform spans 5 computers and 4 operating systems (Ubuntu, Lubuntu, Linux Mint, and Windows 7), with a git server running here. I needed something that would work moderately well on that.

How?

I started out with CppUnit. The biggest issue I ran into was the complete lack of documentation (seriously – is there any? It’s advertised as a “C++ port of JUnit” – am I supposed to use the JUnit documentation?). I looked around online and found a lot of tutorials that all used completely different ways of doing the same things. On top of that, none of them actually worked on any of my machines – every attempt to do anything, no matter how minor, was a long string of compiler errors or stack overflows.

I looked to Ceedling. Off that bat, I did like it more – it came with example projects, and included documentation (though it was hard to find). I liked the ability to use rake, which I’m familiar with, including the ability to set up stubs for everything with an easy rake command. My biggest complaint would still be that the documentation is a little sparse (and online it’s nonexistent). BUT it’s certainly sufficient, so I can’t complain too much. I’m able to get things done, make my tests pass, and so on.

The only bug I ran into was in functions that used printf – I spend about 4 hours tracing stack calls, overflows, missing symbols, and so on until I tracked it down – an error that had been fixed in Unity in August but not found its way into Ceedling until December (after I had downloaded it). Otherwise it’s been great.

 

Next time I’ll actually look at some of the testing.

Now that I’m starting the New Year, I’ve settled into an organization system that works pretty well for me. I thought I’d at least record it here if anyone’s interested, including my future self who may look back on this system as an unmitigated disaster and wonder what I was thinking.

WEEKLY PLANNER

The first part is a weekly planner I carry around – yes, a hard-copy. It’s a little booklet folded down to 3.5 x 6, which I’ve found is a good size to fit in my pockets. It has 2 pages for notes, then a list of long-term goals I have (with weekly milestones), and upcoming events. The main point is a daily planner section in the middle (I make a new one each week). On the left page is all of my daily tasks, and the right side is a daily schedule. I update it diligently, and record my hourly usage (if i have time, I’ll upload a sample page).

The last page is a review section, where I total up how many hours I spent each day on tasks, and then write a review of the week, noting room for improvement, and so on. It also faces my 6 month goals, “this month” goals, and weekly goals (which also appear at the top of each daily task list, so I make sure my daily tasks align).

KANBANFLOW

I use the Pomodoro technique to stay productive. Last year, I was only using my planner, but was not NEARLY as productive as I would have liked. The pomodoro technique keeps me accountable, and assuages my guilt over doing things for fun (I’m a little obsessive about productivity). I work for 25 minutes, then take a 5 minute break. Every fourth break is 15 minutes.
I also use the kanban system, with each column being a day of the week (though the first is “today”, followed by “done”, and the last 2 columns are “next week” and “later”). I sort the cards by the order I need to do them and get started. The cards match tasks on the daily agenda in my weekly planner.
Kanban flow combines a pomodoro timer with a Kanban board, so it’s great. I’m still working on totaling numbers, but my average productivity has probably increased 8-10x so far this year!

OpenProject

Finally, to track work for software projects, I use OpenProject. It’s open source,  enjoy it, have contributed to it (okay, I fixed a grammar mistake…), and it’s been very useful. I put a lot of detail in the user stories and tasks, and then reference the work package # in my planner and Kanban board.

That’s my org technique. Time will tell (or has already told, future self) how it works. I imagine I’ll continue refining it, though – every week so far since mid-May 2014 I’ve made some minor tweak or another.

I didn’t want this to sound like an ad for AWS, but I’ve been very happy with it and do want to share my experiences.

EC2

EC2 – Elastic Compute Cloud – is the main “server” part of Amazon Web Services. This is the module where you spin up servers, select the hardward you want it run on, the operating system (or variants), and assign virtual harddrives and other storage. It’s a lot of fun to work with. The documentation is fantastic, and includes several walkthroughs – “How to set up a linux server”, “How to set up a LAMP server”, “How to install WordPress”, etc. In fact, you’re reading this on the realworld application of those walkthroughs.

These servers don’t automatically have persistent data, so when they’re shutdown, it’s gone. See below…

My only complain has to do with regions. AWS servers are located in regions, based on their datacenters, and essentially you can only have one server running in the free tier (yes, technically it’s by usage hours and storage etc., but it’s calculated based on one server month). In the online management portal, you can only see one region at a time. SO, when I spun up a server in one region, then shifted to another a few weeks later, I forgot I already had one going. I couldn’t see it anywhere – there’s no true MASTER view, only a master view PER REGION. This means that when I surpassed my free tier usage, I couldn’t figure out how to stop accumulating charges hourly. Finally I figured it out, but it would be SO helpful if they had a master view. For what it’s worth, they comped me a month’s worth of usage.

S3

S3 is the storage you get. The free tiers gives you 30gb – not bad at all. That’s persistent storage, so just in case my server goes out, I store important stuf here. I also symlink stuff that needs to stay in a certain place on the server, so I can spin up & down without a problem. I just load the persistent storage virtual HDD, and symlink back over.

Elastic IP’s

Elastic IPs are GREAT, and the free tier lets you have one. Basically, the real IP address (and also the URL) of a server is created when the EC2 instance if created. SO if you terminate one, and start another, the IP address changes. This is not good for keeping the DNS update. With elastic IPs, you have one that’s permanent and assigned to you, and you point it at the server you want. SO the DNS has your permanent elastic IP, and you control what server that elastic IP points to.

Email

Haven’t had any luck getting a SMTP server set up. I’m not sure if it has to do with Amazon’s anti-spam measures (a free server could get bad), but when I have time I’m going to spin up a new instance and see what happens. I applied to Amazon for them to relax restrictions re: mail, but I’m not sure if that applies to this server, or future ones, or even if that’s EC2 related at all (they do offer mass emailing services for money)

All-in-all, I’ve been very happy with Amazon Web Services. My only real complaint is the lack of a global overview in EC2.