In the last part of our Building a Docker Media Server guide, we walked through some (very) basic network configuration steps, namely setting up file sharing on the local network and renaming Windows, MacOS, Linux and NAS devices. In this section, we’ll continue with our network configuration, but we’ll step up a level (slightly) by discussing IP addressing and remote access.
IP (Internet Protocol) addresses are used across the Internet to identify network devices, including desktop PCs, servers, smartphones and more. You’ll know them when you see them – an IP address is a twelve-digit series of numbers (four groups of three) separated by dots. For example, my router’s IP address is 192.168.86.1. Every device on your home network has an IP address, usually controlled by your router using a technology called Dynamic Host Configuration Protocol (DHCP). This means your router dynamically determines the IP address of each device, which is allocated from a pool of available addresses.
As we’re going to be connecting various services to and from our media server hardware, it’s always useful to know its IP address. In fact, it’s even more helpful if it always keeps the same IP address. That way, if any app or other service wants to know our server’s IP address, we can be confident the server can be reached every time. Otherwise, every time the server’s IP address changes, we’d have to make the same change in every app configuration menu that needs to connect to the computer via its IP address.
I’d always recommend giving your media server PC a static IP address – so, each time it boots, it’ll get the same IP address. It also takes a layer of variation away that helps with troubleshooting, if you encounter any connection problems.
Now, before you seasoned Docker experts chip in here, I know that Docker creates distinct IP addresses for each container that is running. We’ll get into that layer of complexity in due course. However, I’m going to assume at this stage that most users will have both native apps and containers running on the same hardware, so it makes sense to configure IP addressing correctly on the hardware and, when necessary, move on to the container configuration.
If you decide to change the IP address to a static (fixed) IP address like me, you have a couple of options for accomplishing this. The first method is via your router’s management console. Most modern routers support a feature called IP Address Reservation, or DHCP Address Reservation (it’s the same thing) which is what we need. The second method is via the PC itself.
Reserve a Static IP Address via Your Router
The process of reserving a static IP address is broadly similar across router manufacturers, but obviously the management console design varies between devices. Feel free to tweak the following instructions based on your own router’s requirements.
First, you will need to determine the MAC address and IP address of your device. Actually, many routers can reserve an IP address simply by the IP address, but some require both. The MAC address (standing for Machine Access Code – think of this as a unique code used to identify your device’s network adapter) can be found via the shell (a Command Prompt on Windows, Terminal on MacOS/Linux). Put simply, we’ll be saying to our router, “Hey! Here’s the network adapter. Make sure you always give it this IP address when you see it on the network!”
In the Windows 10 Search bar, enter cmd and click the link to open up a Command Prompt. You should also find the Command Prompt available from the Start menu.
Enter the following command:
This command simply asks Windows to tell us all it knows about the network adapters we have connected to our PC. You may wish to expand the Command Prompt window as there’ll be a lot of information shown.
Information for all of your network adapters will be displayed – Ethernet, wireless, Bluetooth and so on. It’s the Ethernet adapter that we’re interested in at this point (assuming your device connected to the router via a wired Ethernet connection, which is recommended). Look for the Physical Address entry. That’s another name for the MAC address we need. It’s a twelve character alphanumeric string with hyphens (-) separating every two characters.
For example: 00-00-00-a1-2b-cd
Your PC’s current IP address is also listed. Look for the IPv4 Address entry and you’ll see a long string of numbers.
For example: 192.168.1.122
For your Static IP address, you can change the final three digits of the IP address to any number you wish to between 2 and 254 (on most standard router configurations – if you’ve altered the router’s address range manually, this may be different). However, if you wish to make the existing IP address static, just make a note of it now.
OK, now you have your MAC address and IP address to hand, skip forward to the router configuration section. In the meantime, let’s move on to MacOS.
Locating your MAC and IP address in MacOS is pretty easy. Click on your Network icon at the top of the screen (if you’re Ethernet-connected, it’ll look like an empty Wi-Fi icon) and select Open Network Preferences...
Select your network connection in the window that pops up and you’ll be shown the current IP address for your Mac.
OK, but what about the MAC address? Hit the Advanced… button in the panel and, in the window that appears, select the Hardware tab. The MAC address is displayed at the top of the panel.
Linux (Ubuntu Desktop)
The good news is that uncovering your network details on Ubuntu is very easy indeed. Head to the top of the screen, where you’ll see an icon with two opposing vertical arrows. This navigates you to your network settings. Select Connection Information.
Whoop! All of your network details are displayed in the window that pops up.
Grab your Hardware Address and IPv4 address (if required) and we can get the router configured. The eagle eyed among you may have spotted the docker0 tab adjacent. If you’d like, you can sneak a peek at your Docker network configuration here too.
As I mentioned earlier, here’s proof that Docker Engine creates a distinct “bridged” network that’s used for containers with its own address range (172.17.xxx.xxx). We’ll discuss the Docker network in more depth later in the guide.
Finding your QNAP device’s MAC address is simple enough. The easiest method to do so is via QNAP’s Qfinder Pro connector app, which can be downloaded from the manufacturer’s website (Windows, Mac, Linux and Chromebook versions available).
Once installed, run Qfinder Pro and it will hunt down your NAS on the network. Once discovered, you’ll be presented with the device’s IP and MAC addresses.
Locating your IP and MAC address on a Synology NAS is even simpler than a QNAP NAS. There’s no need to download a connector app. Simply visit http://find.synology.com/ in the web browser of a computer connected to the same network and your NAS will be discovered. You’ll see its current IP address and the MAC address listed, courtesy of the Synology Web Assistant.
OK, now we have our MAC address and IP address, we can go ahead and configure our router to reserve a static IP address for the media server. Open up your router’s configuration console in a web browser. Usually, this is accessed via your router’s IP address – enter it in the browser’s address bar. If you don’t know your router’s IP address – check the label on the device itself. The default IP address is usually listed. Otherwise, re-run the IP address search we just conducted and looks for the Default Gateway, Router or Default Route listing. That’ll be your router’s IP address.
Some modern routers are managed exclusively via a mobile app, while others can be configured in the web browser. Obviously, I can’t share the exact steps for every model of router out there, so I’ll be using an ASUS router as an example. Adapt these steps for your own router.
Head to the LAN Management section of your router’s console (every manufacturer calls this something different – LAN, Local Network, Network and so on). I’m using an ASUS RT-87U router here as my example – unless you’re using an ASUS router, your console will look a little different.
We’re interested in the router’s DHCP configuration. You’ll remember that DHCP (Dynamic Host Control Protocol) is the protocol used to assign IP addresses to network devices. My ASUS router includes a tab called DHCP Server – your router’s management console will have something similar – but it may be labeled differently.
At the bottom of the page, there’s an option to Enable Manual Assignment. That sounds like what we’re looking for. So, I’ll click the radio button next to Enable. Underneath, there’s a second option called Manually Assigned IP around the DHCP list (Max Limit: 64). Here there’s a MAC address field with a drop down button and an IP Address field.
Some router consoles will mandate that you type in the MAC address – separating the character codes with a colon (:) rather than the hyphen (-) Windows uses. This ASUS router allows me to click the drop-down button in the MAC address field and select the device or PC by its hostname – much more convenient!
Enter the MAC address (or select the device if you can like me) and in the IP Address field, enter the static IP address you wish your PC to retain. I prefer to make this a round number or something memorable – just remember, those last three digits need to be between 2 and 254.
Save the entry, and you should see it listed in the manually assigned/reserved IP list.
To complete our setup, we need to ensure that the media server knows its new IP address. The quick and easy way to do this is to reboot the PC or NAS. When it restarts, the device will ask your router for its IP address, the router will ask the device for its MAC address and check its list of manually assigned IP addresses. When it sees that your device is listed, it’ll allocate the IP address you requested.
Now, every time your media server restarts, your IP address will not change, adding an extra layer of stability to your network. Hurrah! Most modern routers will allow you to reserve IP addresses for devices in this way – however, if your router does not, you can achieve the same result via the device’s operating system. Let’s take a look.