Difference between revisions of "Working DNS During Downtime"
(Created page with 'Placeholder - tutorial will be here soon') |
|||
Line 1: | Line 1: | ||
− | + | Here's how you can use a regular DNS server other than your HDA, and still access your HDA's dashboard, applications, etc. using their hostnames. | |
+ | |||
+ | ''This would allow you to browse the internet without problems, if your HDA is ever offline.'' | ||
+ | |||
+ | Note that this will only work with '''Linux and Mac OS X''' clients, unless you find a way to re-create the crontab entry into it's Windows equivalent (installing Cygwin would be a good first step). | ||
+ | |||
+ | Once you have this working, you could even re-enable your router DHCP, and if you have static IPs configured on your HDA, make sure to re-create those entries in your router config. | ||
+ | |||
+ | ==On your HDA== | ||
+ | ===Logged in as your regular user=== | ||
+ | Note: Replace '''your_username''' with your Fedora username (for example ''joe''). | ||
+ | |||
+ | <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> | ||
+ | cd /home/'''your_username'''<br/> | ||
+ | mkdir bin<br/> | ||
+ | cd bin<br/> | ||
+ | wget http://wiki.amahi.org/images/3/32/Hda-get-hosts.sh<br/> | ||
+ | mv Hda-get-hosts.sh hda-get-hosts<br/> | ||
+ | chmod +x hda-get-hosts | ||
+ | </div> | ||
+ | |||
+ | ===Logged in as root=== | ||
+ | Notes: | ||
+ | *Use '''su -''' to become root in an already opened terminal window.<br/> | ||
+ | *Replace '''your_username''' with your Fedora username (for example ''joe''). | ||
+ | |||
+ | <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> | ||
+ | echo "'''your_username''' ALL = NOPASSWD: /home/'''your_username'''/bin/hda-get-hosts" >> /etc/sudoers | ||
+ | </div> | ||
+ | |||
+ | ==On your client(s)== | ||
+ | |||
+ | Add the following entry in your crontab ('''crontab -e''' to edit your crontab).<br/> | ||
+ | Note: Replace '''your_username''' with your Fedora username (for example ''joe''). | ||
+ | |||
+ | <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> | ||
+ | <nowiki>* * * * *</nowiki> ssh '''your_username'''@hda "sudo bin/hda-get-hosts" > /tmp/hosts.hda ; grep -v "From HDA$\|Amahi HDA$" /etc/hosts > /tmp/hosts.new ; echo "# The following lines were added from your Amahi HDA" >> /tmp/hosts.new ; cat /tmp/hosts.hda >> /tmp/hosts.new ; sudo cp -f /tmp/hosts.new /etc/hosts | ||
+ | </div> | ||
+ | |||
+ | ==Test== | ||
+ | |||
+ | Both commands should return your HDA internal IP address: | ||
+ | |||
+ | <div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;"> | ||
+ | ping -c 1 hda | grep from<br/> | ||
+ | ping -c 1 hda.home.com | grep from | ||
+ | </div> |
Revision as of 18:07, 18 February 2010
Here's how you can use a regular DNS server other than your HDA, and still access your HDA's dashboard, applications, etc. using their hostnames.
This would allow you to browse the internet without problems, if your HDA is ever offline.
Note that this will only work with Linux and Mac OS X clients, unless you find a way to re-create the crontab entry into it's Windows equivalent (installing Cygwin would be a good first step).
Once you have this working, you could even re-enable your router DHCP, and if you have static IPs configured on your HDA, make sure to re-create those entries in your router config.
Contents
On your HDA
Logged in as your regular user
Note: Replace your_username with your Fedora username (for example joe).
cd /home/your_username
mkdir bin
cd bin
wget http://wiki.amahi.org/images/3/32/Hda-get-hosts.sh
mv Hda-get-hosts.sh hda-get-hosts
chmod +x hda-get-hosts
Logged in as root
Notes:
- Use su - to become root in an already opened terminal window.
- Replace your_username with your Fedora username (for example joe).
echo "your_username ALL = NOPASSWD: /home/your_username/bin/hda-get-hosts" >> /etc/sudoers
On your client(s)
Add the following entry in your crontab (crontab -e to edit your crontab).
Note: Replace your_username with your Fedora username (for example joe).
* * * * * ssh your_username@hda "sudo bin/hda-get-hosts" > /tmp/hosts.hda ; grep -v "From HDA$\|Amahi HDA$" /etc/hosts > /tmp/hosts.new ; echo "# The following lines were added from your Amahi HDA" >> /tmp/hosts.new ; cat /tmp/hosts.hda >> /tmp/hosts.new ; sudo cp -f /tmp/hosts.new /etc/hosts
Test
Both commands should return your HDA internal IP address:
ping -c 1 hda | grep from
ping -c 1 hda.home.com | grep from