Tag Archives: router

Providing Internet Coverage in Distant Fields

field

The AyrMesh network can stretch out a long ways – with the AyrMesh Bridge, Hubs, Cab Hubs, and Receivers, you can extend your network for miles and miles.

But, no matter what, it seems that there is always at least one field your AyrMesh Network won’t reach. I’ll show you what I do to provide WiFi coverage in distant fields.

When I am testing the AyrMesh components, I am usually working remotely. A little while ago I picked up a few things:

  • TP-Link router

    A TP-Link MR-3040 portable router

  • USB cellular adapter

    A USB Cellular adapter (mine is from FreedomPop, because they provide good coverage where I work and are extremely inexpensive, but I also have a Verizon one I use in more remote areas)

  • A 20′ telescoping flagpole – these are available from lots of places; mine is from Harbor Freight Tools because it was inexpensive. There are better-quality poles (and longer ones) available.

The way I set it up is like this:

  • Power extender

    Inside the cab of my truck, I use a 2-way utility plug extender plugged into the “always on” utility plug.

  • Router plugged into USB power, with USB dongle

    I plug a USB charger unit into one of the plugs. The router runs off USB power, so it plugs right into the charger, and the USB cellular “dongle” plugs into the router.

  • Inverter, Hub power supply, and Ethernet cables

    I then plug a small inverter into the other power plug, and plug the Hub’s power supply into the inverter. I run a short Ethernet cable from the “LAN” port on the Hub’s power supply to the Ethernet port on the router, and plug a 30′ Ethernet cable into the “PoE” port of the power supply

  • I then run the long (orange) Ethernet cable out through the side window of my truck so it can be connected to the Hub.

    Ethernet Cable

  • Flagpole stand

    I built a mount for the back of my pickup, using a piece of steel, a length of PVC pipe, and a couple of hose clamps. Some people also use a “drive on” flagpole stand, or a hitch receiver flagpole stand.

  • I mount the Hub on the flagpole with a zip-tie, and connect the long Ethernet cable to the Hub.
  • Hub mounted on pole

    After making sure the Hub is on and connected to the Internet, I push the mast up to maximize the range of the Hub.

Pole extended, ready for use.

I can then set up a Cab Hub in a vehicle and use the Internet while I’m working, up to 2.5 miles from my truck.

This setup is not perfect for use on very windy days, because the flagpoles can move around and reduce the effectiveness of the Hub.

The other caveat is that you’ll want to locate the Hub at a high location so it receives a good cellular signal and maximizes the Hub’s WiFi signal. This only works well if you have a place with good cellular coverage and good “line of sight” to your fields.

Recently I have swapped out the power inverter and power supply for a power plug and a “passive PoE injector,” which actually makes the setup a little simpler. I also have a Verizon USB “dongle” that I sometimes use when I’m testing.

Setup with PoE injector and Verizon dongle

This setup is frequently very handy for me, and it can be very useful for you to use in remote fields. You lose the advantages of being connected to your “home” network (being able to browse files on your local machines or print to networked printers), but you should have good Internet connectivity for collecting data to the “cloud,” browsing the Internet, checking email, etc.

Getting the most out of your router – part 3

Once you have your router set up properly, your devices on-line, and ports forwarded to those devices, there’s one more small problem: being able to reach your devices over the Internet. There are two problems: first, Internet Service Providers (ISPs) usually provide dynamic IP addresses, so your “home address” may change from time to time; second, IP addresses are hard to remember.

The solution is what is called “DDNS” – Dynamic Domain Name Service. Domain Name Service (DNS) is simply the service that translates a domain name (ayrstone.com) into an IP address (162.159.242.105) so you can access it. DDNS is a service that continually and automatically updates the IP address so that you can always reach your home network using a simple, easy-to-remember domain name.

There are two parts to DDNS: first, it involves a service, for which there is usually (but not always) an annual fee, and an “updater” that notifies the service when your IP address changes. Dyndns.com is the leader in this area; they used to offer a single DDNS account for free, but they have since gone to charging $25 a year. For this they offer a very good service with email support if you need it.

Using Dyndns.com is very easy: you typically sign up with a username (e.g. “ayrstone”) and you can select an extension on one of their “house” domains (e.g. ayrstone.dyndns.org – you can actually select up to 30 – or you can use a domain name you actually own). You then need to set up an “updater:”

  1. Many brands of routers have an updater “built in” for dyndns.com, or
  2. You can download a small program from http://dyn.com/support/clients/ that you run on a computer that is ONLY in use on your home network (it won’t help if it updates your domain name to point to Starbucks…) so it can automatically tell when your IP address changes and “tell” dyndns.com.

One of the advantages of using Dyndns.com is that many brands of router are pre-configured for them; all you have to do is fill in your credentials and go. Dyndns.com also has good, downloadable background programs to run on your home or office computer to update the IP address – this is actually how I use the service. My router doesn’t have a built-in Dyndns.com updater, but my office computer is always on here in the lab, so that’s the easiest way to keep Dyndns.com up-to-date on the lab’s IP address..

There are still a number of organizations that offer free DDNS, and here’s a nice article on Lifehacker that talks about them. The free DDNS services are generally not as convenient: many routers don’t even have a “generic” DDNS setup, but, if yours does, that’s what you’ll use if you want the router to update your IP address. If not, most of them have instructions how to set up a script on your home PC to update the address – entirely doable, but not as easy as just downloading an application. Also, most of the free services don’t have any technical support – they’ll typically have “FAQs” on their site, but you’re on your own. I use one of the free services at home, and it works just as well as Dyndns.com, but it was a bit tricky to set up.

Once you get it set up, accessing your home or office network is simple: just use the domain name you selected. For instance, here in the lab I have my desktop computer accessible via VNC accessible on port 7999, two IP cameras (ports 9005 and 9006), and a weather station on port 8000 (as well as my router on port 80). If the lab’s DDNS domain is ayrstone.dyndns.org (it’s not really, of course… even though everything here has a good password, I’m not inviting people to try to hack them), then I can VNC into my computer at ayrstone.dyndns.org:7999, view my IP cameras at http://ayrstone.dyndns.org:9005 and 9006 (I actually have IP Cam Viewer on my phone set up for those ports already), view my weather station at http://ayrstone.dyndns.org:8000, and re-configure my router at http://ayrstone.dyndns.org (port 80 is the default for http connections).

If your goal is to automate information-gathering and enable remote control for machinery on your farm, you need to have access to your farm’s network from wherever you are. DDNS is a way to make that much easier.

Getting the most out of your router – part 2

The ASUS RT-N66U – a modern, high-end home wireless router

In the last article in this series, I discussed what a home router is and a little bit about how it works, as well as providing guidance on how to set up the DHCP server.

IP addresses on your LAN are assigned one of two ways: either by the router’s DHCP server, which provides them out of the DHCP address pool (which I suggested should be 192.168.1.50 to 192.168.1.254) or by statically assigning them yourself (which I suggested should be out of the remaining 192.168.1.2 to 192.168.1.49 addresses). Assigning static addresses is very seldom necessary on modern routers, however, because most modern routers have a feature called “DHCP Reservations.” This allows you to specify the MAC address of a device and make sure it is assigned the exact same address via DHCP every time it is connected to the router. Using DHCP reservations, you can ensure that your laptop always gets the same IP address without having to configure a static address for it (which is a pain, since you’d have to re-configure it every time you go to the coffee shop).

Using either static addressing or DHCP reservations, you may want to make sure that “infrastructure” on your home network, like file servers, entertainment systems, or security devices always have the same IP address.

Your router’s NAT usually automatically closes off all the ports on your public IP address, making it impossible to access anything on your LAN from the Internet. In most cases, that’s a good thing – you don’t want the Internet able to reach your private network. But, in some cases, you want to make devices on your network available from the Internet (ALWAYS protected with strong passwords, of course!). The classic example is the IP camera set to watch something important on the farm – it could be the front drive, livestock, or your machine shed – you want to be able to access it from wherever you are so you can check up on it. But you might also want to be able to check and operate machinery like your grain dryer, pumps, irrigation systems, HVAC systems, etc. from a distance.

The IP camera has a webserver that uses port 80 (usually) for its interface, so the trick of port forwarding is to open one port on your public IP address and tell your router to “forward” all packets coming to that port automatically to port 80 (or whatever port you configure) on the camera. So you “knock a brick” out of the router’s firewall by specifying one port on the public side (I like to use ports 7001-7099, because very few services use these ports) and forward that public port to a port on your camera.

The way you do this varies from router to router, but the drill usually entails going to the “port forwarding” interface on your router and specifying the incoming or public port (7001), the device that’s receiving the packets (your camera’s IP address – 192.169.1.something), and the port on the device that will receive the packets (port 80). Then, if your public IP address is 101.102.103.104, you can access your camera on the Internet at http://101.102.103.104:7001 (the IP address, a colon, and the port number). Some routers allow you to specify only certain incoming IP addresses that can access the camera, but that’s usually not a good idea because, for instance, if you want to look at the camera from your smartphone, you won’t know the IP address of the smartphone.

NOTE: some routers (stupidly, in my opinion) require that the port numbers on the public side and the private side be the same – they won’t forward port 7001 on the public side to port 80 on your camera. If you have a router like that, you’ll need to reconfigure your camera (or whatever device you have) to the appropriate port (e.g. 7001) port before you can do the port forward. You shouldn’t forward ports under 1024 unless you know exactly what you’re doing, because you might be disabling something your router needs to function properly. Forwarding extremely popular ports like 80, 20, 21, 22, 23, 25, etc. can also attract password crackers and other undesirable elements to your network.

Let me emphasize at this point the importance of a strong password on anything that’s exposed to the Internet – if you can access it, so can anyone else, so make sure it’s locked down.

On my own home network, I have several ports forwarded to different IP cameras around my property, as well as ports forwarded to my desktop Windows machine (using VNC so I can access it easily when I’m away) and my Linux development machine (using SSH). I can actually access any of those devices using my smartphone, so I can stay on top of things anywhere I have an Internet connection.

Click here to go to Part 3

Getting the most out of your router – part 1

The venerable Linksys WRT54G – Courtesy of Linksys

The world of networking is complex, including that little bundle of technology sitting on your shelf – your router. It is actually a pretty amazing little device that can probably do more than you realize. In truth, the typical “consumer” router is a combination of three devices:

  1. A router – a router is a device with two or more ports that is used to connect two or more networks together. Typically, the consumer router has a “WAN” port that connects to the “Wide Area Network” of your Internet Service provider and “LAN” ports for your Local Area Network.
  2. An Ethernet switch – you may have noticed that your router doesn’t have two ports; most actually have five: one WAN port and four LAN ports. Inside the box is an Ethernet switch that turns the LAN port of the router into 4 LAN ports to which you can connect wired computers, servers, and even additional Ethernet switches if needed. Actually, it’s 5 LAN ports, because the fifth one is connected to…
  3. A WiFi Access Point – this is simply a wireless radio connected to an internal LAN port that provides a WiFi signal for computers, tablets, smartphones, IP cameras, entertainment systems, and all kinds of other things. This WiFi radio is usually optimized for short-range, indoor use, providing maximum throughput for a short distance.

One of the odd and important facts about a router is that it has two Internet Protocol (IP) addresses: one on the network to which its WAN port is connected (which should be a public IP address, visible from the Internet – e.g. 108.162.198.52, ayrstone.com’s address), and one on the LAN port, the network it creates for you (a private address, not usable from the Internet, e.g. 192.168.1.1). Its job is to take data packets from each network and move them to their destination network. So, if your computer is at 192.168.1.50 on the LAN, and it receives a packet on its WAN port destined for 192.168.1.50, it passes it to the LAN port where it finds its way to your computer. Similarly, if your computer creates a connection to 108.162.198.52, the router receives packets from your computer on its LAN port and routes them to the WAN port. When you print to your networked printer (at, say, 192.168.1.100), it receives packets from your computer and then just turns them around and sends them back down the LAN port, since they are not destined for the Internet.

The ability of the router to accept traffic on a single public IP address and enable several different computers at private IP addresses to have separate “conversations” with the Internet is called “Network Address Translation” or NAT. The way it does this is by using “ports” – simply numbers associated with every IP address.

Each IP address has 65,535 possible ports. Some ports have pre-assigned purposes, some are available for use by applications, and some are ephemeral – here’s a good explanation of which are which. NAT uses those ephemeral ports to keep the conversations between your network and the Internet straight; for instance, your computer’s conversation with this website might be using your public IP address’s port 55135, while another computer on your network might be having a conversation with another website on port 61234. To the two websites, it looks like the traffic is coming from a single computer, specifically your router. Your router then routes the responses from the websites to the correct computer based on the port on which the data comes in.

The private IP addresses on your network are usually assigned by your router using Dynamic Host Configuration Protocol or DHCP. When a computer connects to your network, it will ask the router for an address via DHCP, and the router will provide it one (assuming it has one to provide). The address is referred to as a “lease,” because it will expire at some point after the device leaves the network, so it can be used by another device. However, note that you can simply assign a static IP address to a device in your network, as long as (1) it is an IP address inside your network (usually meaning it has the same three first numbers as everything else on your local network, e.g. 192.168.1.x) and (2) it does not interfere with the DHCP settings on your router (if your DHCP server begins at 192.168.1.50 and your router is at 192.168.1.1, use static addresses between 192.168.1.2 and 192.168.1.49, and KEEP TRACK OF THEM WHEN YOU ASSIGN THEM!!!)

The first tip for getting the most out of your router is this: set up your router’s DHCP server carefully. I suggest setting your router’s IP address as 192.168.1.1 and setting your router’s DHCP range from 192.168.1.50 to 192.168.1.254 (204 addresses). The reason for this particular range is that, first, it allows for a large number of devices to automatically use your router, getting private IP addresses via DHCP (204) but still leaves you 48 addresses you can use for devices you want to statically assign. This gives you the flexibility to maintain, expand, and control your home network.

Alternately, most modern routers support DHCP Reservations, which allow you to ensure that the router ALWAYS provides the same IP address to a device on the network. That way you get the advantage of a static IP address (knowing where a device is at all times) with the advantage of DHCP (ease of configuring devices and the IP addresses being managed by the router).

Click here to go to part 2