Difference between revisions of "How to use two HDAs on the same network"

From Amahi Wiki
Jump to: navigation, search
Line 21: Line 21:
  
 
<u><b>Prerequisites</b></u><br/>
 
<u><b>Prerequisites</b></u><br/>
A router that can hand out DNS.  (DD-WRT .v24 with DNSMasq can handle that nicely.)<br/>
+
*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<br/>
This assumes that Fedora 14 & Amahi are installed on both HDAs.<br/>
+
*This document assumes that Fedora 14 & Amahi are installed on both HDAs.<br/>
BE SURE that each  HDA has a unique hostname (domain name) & IP address that is within your network.<br/>
+
*BE SURE that each  HDA has a unique hostname (domain name) & IP address that is within your network.<br/>
  
 
<u><b>Accessing HDAs Locally</b></u><br/>
 
<u><b>Accessing HDAs Locally</b></u><br/>
Line 30: Line 30:
 
I personally deleted all of the Amahi links on each HDA's Fedora desktop and created a launcher that opens the Amahi dashboard by IP address.<br/>
 
I personally deleted all of the Amahi links on each HDA's Fedora desktop and created a launcher that opens the Amahi dashboard by IP address.<br/>
 
To create the launcher
 
To create the launcher
*Right-click on the Fedora Desktop and choose "Create Launcher"
+
*Right-click on an empty space of the Fedora Desktop and choose "Create Launcher"
 
*Change "Type" to "Location."
 
*Change "Type" to "Location."
 
*Give it a name (i. e. <i>Amahi HDA Dashboard</i>)
 
*Give it a name (i. e. <i>Amahi HDA Dashboard</i>)
*Under "Command" http:// and the IP of the HDA
+
*Under "Command" enter http:// and the IP of the HDA
  
 
<u><b>Change External DNS on HDA2</b></u><br/>
 
<u><b>Change External DNS on HDA2</b></u><br/>
Line 46: Line 46:
 
<u><b>Apps You Need</b></u><br/>
 
<u><b>Apps You Need</b></u><br/>
 
*Amahi Web-Apps Proxy (http://www.amahi.org/apps/amahi-web-apps-proxy) on both HDAs.   
 
*Amahi Web-Apps Proxy (http://www.amahi.org/apps/amahi-web-apps-proxy) on both HDAs.   
<blockquote>*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.</blockquote>
+
<blockquote>*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 <u>outside</u> of the Local Area Network.  Then change the user name and password to suite your needs.</blockquote>
 
*Ajaxplorer (http://www.amahi.org/apps/ajaxplorer) installed on HDA1.  This met my external file access needs for HDA1.<br/>
 
*Ajaxplorer (http://www.amahi.org/apps/ajaxplorer) installed on HDA1.  This met my external file access needs for HDA1.<br/>
 
*OpenVPN ALS (formerly Adito)(http://www.amahi.org/apps/openvpn-als) on HDA2.  This app has a convenience fee to install that it is well worth it. :-)<br/>
 
*OpenVPN ALS (formerly Adito)(http://www.amahi.org/apps/openvpn-als) on HDA2.  This app has a convenience fee to install that it is well worth it. :-)<br/>
Line 52: Line 52:
 
<ul>
 
<ul>
 
<u><b>Configuring OpenVPN ALS</b></u><br/>
 
<u><b>Configuring OpenVPN ALS</b></u><br/>
<li>Web Forwards - Tunneled Web Apps
+
<li>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
 
* Login as administrator
* Select Web Forwards (middle left menu)
+
* Select Web Forwards (middle of left menu)
 
* Select Create Web Forward
 
* Select Create Web Forward
 
* Select Tunneled Web and select Next
 
* Select Tunneled Web and select Next
Line 66: Line 66:
 
* Each time the agent is executed, the SSL tunnel uses a random port (may not work  with firewalled client network)  
 
* Each time the agent is executed, the SSL tunnel uses a random port (may not work  with firewalled client network)  
  
<li>Configure Shares.  See http://wiki.amahi.org/index.php/Adito for more details.<br/>
+
<li>Configure Shares.  See "Map HDA folders (Network Places)" on http://wiki.amahi.org/index.php/Adito for more details.<br/>
 
</ul>
 
</ul>
 
<u><b>Router Configuration</b></u><br/>
 
<u><b>Router Configuration</b></u><br/>
 
This is the configurations under DD-WRT v.24-2
 
This is the configurations under DD-WRT v.24-2
 
*Port Forwarding<br/>
 
*Port Forwarding<br/>
Forward to HDA1: Port 80 TCP/UDP, Port 1192 UDP, Other Apps possible<br/>
+
Forward to IPofHDA1: Port 80 TCP/UDP, Port 1192 UDP, Other Apps possible<br/>
Forward to HDA2: Port 443 TCP/UDP, Port 4443 TCP/UDP (for OpenVPN ALS) and 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.<br/>
 
*Turn off DHCP in both HDAs.  Allow DD-WRT to handle DHCP.<br/>
 
Under "Services > DHCP Server" in DD-WRT set "Used Domain" to "LAN & WAN"<br/>
 
Under "Services > DHCP Server" in DD-WRT set "Used Domain" to "LAN & WAN"<br/>
Give the router's LAN a name and assign static DHCP leases for each HDA using the real MAC addresss, hostname and IP of each.<br/>
+
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.<br/>
 
*DO NOT turn off DNS on either HDA.<br/>
 
*DO NOT turn off DNS on either HDA.<br/>
 
*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.<br/>
 
*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.<br/>
  
 
Under "DNSMasq" enable "DNSMasq" and "Local DNS".<br/>
 
Under "DNSMasq" enable "DNSMasq" and "Local DNS".<br/>
Under "Additional DNSMasq Options" input something like the following.
+
Under "Additional DNSMasq Options" input something like the following:<br/>
<blockquote>server=/hda1username.com/192.168.1.20
+
 
ptr-record=20.1.168.192.in-addr.arpa,hda1username.com
+
:server=/hda1username.com/192.168.1.20
server=/hda2username.com/192.168.1.21
+
:ptr-record=20.1.168.192.in-addr.arpa,hda1username.com
ptr-record=12.1.168.192.in-addr.arpa,hda2username.com
+
:server=/hda2username.com/192.168.1.21
expand-hosts</blockquote>
+
:ptr-record=12.1.168.192.in-addr.arpa,hda2username.com
 +
:expand-hosts<br/>
 +
 
 
Just change the above to reflect your hostnames and IP addressess. (Note that ptr-record ips are backwards.)
 
Just change the above to reflect your hostnames and IP addressess. (Note that ptr-record ips are backwards.)
  

Revision as of 20:51, 29 May 2012

Make sure both HDA use different domain names.

You'll need to re-apply this fix on every update of hdactl.

You'll need to run the commands below on both your HDAs.

You'll need to edit named.patch before executing the patch command:
On your main HDA: replace home.com with your second HDA domain name, and 192.168.1.10 with your second HDA real IP address.
On your second HDA: replace home.com with your main HDA domain name, and 192.168.1.10 with you HDA real IP address.

As root user:

bash code
​wget -O named.patch http://wiki.amahi.org/images/c/ca/Named.patch patch -p0 < named.patch service hdactl restart​



The above instructions no longer work on current versions of Amahi

Here are the steps that I followed: (This may be very specific to my setup so take it as it is.)

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 14 & Amahi are installed on both HDAs.
  • BE SURE that each HDA has a unique hostname (domain name) & IP address that is within your network.

Accessing HDAs Locally

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

For example, "\\192.168.1.20" in Window will get you to the shares on the HDA with that IP address, if you have established a user and password for that client. Also, 192.168.1.20 in a web browser will take you to the dashboard of the HDA with that IP address.

I personally deleted all of the Amahi links on each HDA's Fedora desktop and created a launcher that opens the Amahi dashboard by IP address.
To create the launcher

  • Right-click on an empty space of the Fedora Desktop and choose "Create Launcher"
  • Change "Type" to "Location."
  • Give it a name (i. e. Amahi HDA Dashboard)
  • Under "Command" enter http:// and the IP of the HDA

Change External DNS on HDA2
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. In terminal ...

bash code
​hda-change-dns ipHDA1 ipHDA1​


Configuring Amahi HDA on SSL Port 443

Change HDA2 to listen on port 443

Apps You 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.

    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)" on http://wiki.amahi.org/index.php/Adito 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.

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=12.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.)

Cutting Down Confusion
If you want to avoid confusion as to which server dashboard you are working on at the moment, you could edit the Dashboard theme. Look in the Theme directory.

bash code
​/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.