How to use two HDAs on the same network

From Amahi Wiki
Jump to: navigation, search

This was tested and compiled using Fedora 25 / Amahi 10.

Updated and amended by spaceman 17:33, 27 March 2017 (BST).

Prerequisites

  • A router that can hand out DNS. (DD-WRT .v24-sp2 which comes with DNSMasq can handle that nicely.) Find out more at http://www.dd-wrt.com/site/index
  • This document assumes that Fedora 23 & Amahi are installed (but see Issue each HDA a unique IP address and hostname before deploying your second HDA).

Issue each HDA a unique IP address and hostname

For convenience edit the IP Address when building your second HDA ("HDA").

When stepping through the build process (as circled in red), modify the static IP pre-configured in the Amahi control panel:

Start.jpg

Select Start building a new HDA

The next step sets the IP address of your HDA and router (Network Gateway). If this is the second HDA you are building change the IP address to something distinct from your first, for example 192.168.1.20 (only change the fourth octet of the IP address (as circled in red):

Ip.jpg

Check this has applied:

hostname

The output should simple be your newhostname.

hostnamectl set-hostname --static newhostname

Replace newhostname with a unique name of your choice. Apply this, with different hostnames, on both servers. You can make one hda, for example, the other can be hda2, or something more distinct and/or meaningful.

Accessing HDAs Locally

You have to access BOTH the shares and dashboard of each server by IP address of the HDA.

For example, "\\192.168.1.20" on a Windows client will get you to the shares on the HDA, with that IP address. Also, 192.168.1.20 in a web browser will take you to the dashboard of the HDA: with that IP address.

In order to prevent Domain Name Server conflict, you have to change the external DNS on one of the HDAs. On "HDA2", change the external DNS to point to the IP address of "HDA1":

hda-change-dns ipHDA1 ipHDA1

In our example ipHDA1 is the default 192.168.1.10, if your HDA uses a different address (i.e. one you configured, instead of accepting the defaults) then use this address instead.

Configuring Amahi HDA for SSL (Port 443)

Change HDA2 to listen on port 443

Optional

Apps You Might Need

*Go to the Amahi Dashboard and under "Apps" find and install Amahi Web-Apps Proxy. In order to configure Amahi Web-Apps Proxy, access the Amahi Web-Apps Proxy for each HDA the first time from a computer outside of the Local Area Network. Then change the user name and password to suite your needs.

  • Ajaxplorer installed on HDA1. This met my external file access needs for HDA1.
  • OpenVPN ALS (formerly Adito) on HDA2. This app has a convenience fee to install that it is well worth it. :-)

    Configuring OpenVPN ALS

  • Web Forwards - The Tunneled Web Apps feature of OpenVPN ALS (Adito) allows clients to externally use an application on your HDA as if they are in the Local Area Network.
    • Login as administrator
    • Select Web Forwards (middle of left menu)
    • Select Create Web Forward
    • Select Tunneled Web and select Next
    • Enter Application Name and Description.
    • Check Add to Favorites and select Next
    • Enter http://application for Destination URL. Be sure URLs are entered as local area network addresses, not dynamic DNS addresses (i.e. http://subsonic.yourlocalhostaddress.com not subsonic.username.yourhda.com). Local address are used since the VPN tunnel is creating an environment as if you were in the Local Area Network. For applications that use a port other than 80, you need to specify that as part of the URL, for example http://subsonic.yourlocalhostaddress.com:4040. Select Next.
    • Select Everyone, select Add, and select Next
    • Select Finish and select Exit Wizard
    • Keep in mind not all HDA apps will work outside your network
    • This method makes use of Adito Agent (java web agent)
    • Each time the agent is executed, the SSL tunnel uses a random port (may not work with firewalled client network)
  • Configure Shares. See Map HDA folders (Network Places) for more details.


Router Configuration

This is the configurations under DD-WRT v.24-2

  • Port Forwarding

Forward to IPofHDA1: Port 80 TCP/UDP, Port 1192 UDP, Other Apps possible
Forward to IPofHDA2: Port 443 TCP/UDP, Port 4443 TCP/UDP (for OpenVPN ALS) and other apps possible.

  • Turn off DHCP in both HDAs. Allow DD-WRT to handle DHCP.

First enable Settings | Advanced Settings in your HDA's Dashboard (circled red):

Settings.jpg

In the Network section select Settings and untick the DHCP Server checkbox (circled in red) from both HDAs.

Dhcpserveroff.jpg

Under "Services > DHCP Server" in DD-WRT set "Used Domain" to "LAN & WAN"
Give the router's LAN a name and assign static DHCP leases for each HDA using the real MAC address, hostname and IP of each.

  • DO NOT turn off DNS on either HDA.
  • DD-WRT Dnsmasq config. The DNSMasq feature in DD-WRT allows you to direct DNS requests to the each of the DNS servers of the respective HDAs. This prevents one HDA from taking over DNS and preventing the other from using its DNS driven apps.

Under "DNSMasq" enable "DNSMasq" and "Local DNS".
Under "Additional DNSMasq Options" input something like the following:

server=/hda1username.com/192.168.1.20
ptr-record=20.1.168.192.in-addr.arpa,hda1username.com
server=/hda2username.com/192.168.1.21
ptr-record=21.1.168.192.in-addr.arpa,hda2username.com
expand-hosts

Just change the above to reflect your hostnames and IP addressess. (Note that ptr-record ips are backwards.)

DNS Aliases

To access apps installed on the HDA that is not servicing DNS queries you will need to add DNS aliases to point to the other HDA (in the following example HDA2 is 192.168.0.100):

Note the application on "HDA2" are directed to 192.168.0.100, if you have used the settings listed above your second HDA will have the IP address 192.168.1.20 instead.

Dnsaliases.jpg

This will allow you to access apps, in this example Couchpotato and Mediawiki, by entering in your browser: http://couchpotato and http://mediawiki respectively.

Cutting Down Confusion

If you want to avoid confusion as to which server dashboard you are working on at the moment, you use an different theme on each Dashboard.

Alternatively, you could edit the Dashboard theme. Look in the Theme directory.

/var/hda/platform/html/public/themes/main

Using GIMP2 I added "HDA#1" to the "logo.png" right under the Amahi logo. Then I did the same to HDA#2.