Amahi as central local DNS for testing, or internal proxy?

dinomic
Posts: 65
Joined: Mon Jan 03, 2011 6:49 am

Amahi as central local DNS for testing, or internal proxy?

Postby dinomic » Fri Nov 09, 2012 6:41 am

Hi all,

I'm basically looking for a way to manage local DNS entries all in one place (ie on the Amahi box!), rather than have to mess about with local "hosts" files on each machine and also having to use tools like Fiddler. Here's the basic issue...

I'm a developer, and I need to have test websites on my local network. So, say I have a test webserver running on my laptop that I want to access from other machines I have to do one of the following:
1) When accessing from another PC or Mac, I put an entry in the client machine's "hosts" file, pointing my test DNS (eg www.mytestsite.com) to the IP address of the hosting laptop
2) When accessing using an iDevice (or an Andriod Device) I need to point the WiFi's Proxy settings to my hosting laptop (using port 8888), and then I need to fire up the "Fiddler" application on my laptop. Fiddler then uses the local "hosts" file on my laptop to work out where to go.

It strikes me that I should be able to use my Amahi box for this, but I've no idea of the best way to do this! I've tried messing about with the "hosts" file on the Amahi box, but this doesn't seem to be picked up by the DNS. I've also tried setting up the domains in DNS using Webmin, but I just seem to get things into a complete mess this way.

I'm REALLY hoping someone can help here...
Norco 4220 Case
Gigabyte GA-G33-DS3R Motherboard w/ 8GB RAM
LSI SAS2116PCIe 6GB/s SAS (replaced 3Ware 9690SA-4I & Chenbro CK1360)
1 x Hitachi 160Gb2.5" System Drive (original 1 x OCZ 60GB Vertex 2 SATAII 2.5" SSD died)
8 x 4TB Hitachi Deskstars
6 x 3TB Hitachi Deskstars
6 x 2TB Hitachi Deskstars (1 dead!)

dinomic
Posts: 65
Joined: Mon Jan 03, 2011 6:49 am

Re: Amahi as central local DNS for testing, or internal prox

Postby dinomic » Thu Nov 15, 2012 6:16 am

49 views and no reply? Obviously, others aren't interested in this feature! Good job I managed to find a way to do this, eh! ;)

The result is that I can now set up internal dns entries for testing, and it'll work for both fixed IP machines and WiFi machines (yes, that means I don't need to go through a proxy for my iDevices or Android thingies!).

Anyway, for those that are interested in what you have to do, it's reasonably simple. Basically, Amahi uses "Bind" for its DNS, and Bind looks to the file /etc/named.conf for DNS-related configurations. You'll see in there some stuff that Amahi is in control of (eg the "zone" used by your network, et "home.com"). At the very bottom, you should see an include to "/etc/named.conf.local". This is where our magic will start. Basically, as su (or sudo) you need to open up this file and place an entry like this:

Code: Select all

zone "test.mydomainname.com" { type master; file "/etc/bind/test.mydomainname.com"; allow-query {any;}; };
What this does is tell Bind that, for the domain "test.mydomainname.com", you want to go to the file "/etc/bind/test.mydomainname.com" to look up the configuration.

NOTE: Notice that I had a "test." prefix on the domain? This is so that my test server can be internal (ie wherever I'm going to point it to in the above-mentioned conf file) without affecting how other subdomains of the same domain (eg "www.mydomainname.com") are not affected.

Right, now create the following folder: "/etc/bind/". In here, you can store all the config files for each "zone" you want to configure. Once you've done that, you can create the config file "/etc/bind/test.mydomainname.com". The contents of this should be like this:

Code: Select all

$TTL 604800 @ IN SOA ns.test.mydomainname.com. test.mydomainname.com. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS test.mydomainname.com. test.mydomainname.com. IN A 192.168.0.40

Here are some things to note about this:
1) This will redirect all calls to "test.mydomainname.com" to the IP address 192.168.0.40
2) For some reason, on the 2nd line, I had to have 2 domains listed there, the 1st one being prefixed by "ns.". I don't quite know why, but Bind didn't like it if I only had the 1 domain there, and hence the above is what I needed for it to work for me.
3) Note also that all domain references have a final "." at the end!! This is important! So, instead of "test.mydomainname.com", it must be "test.mydomainname.com."

Right, once this is done, you'll need to restart your DNS server. I use the following command as a super user:
service named restart

Of course, you can also do this through the HDA control panel (go to HDA Setup, and then "Settings" from the tab bar, and then "Servers" from the sub tab bar. Expand the bit for "DNS Server" and click on "restart".

Have fun! :D
Last edited by dinomic on Thu Nov 15, 2012 6:54 am, edited 1 time in total.
Norco 4220 Case
Gigabyte GA-G33-DS3R Motherboard w/ 8GB RAM
LSI SAS2116PCIe 6GB/s SAS (replaced 3Ware 9690SA-4I & Chenbro CK1360)
1 x Hitachi 160Gb2.5" System Drive (original 1 x OCZ 60GB Vertex 2 SATAII 2.5" SSD died)
8 x 4TB Hitachi Deskstars
6 x 3TB Hitachi Deskstars
6 x 2TB Hitachi Deskstars (1 dead!)

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Amahi as central local DNS for testing, or internal prox

Postby bigfoot65 » Thu Nov 15, 2012 6:26 am

Good news. Would you mind adding this to the wiki? We would greatly appreciate it.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

dinomic
Posts: 65
Joined: Mon Jan 03, 2011 6:49 am

Re: Amahi as central local DNS for testing, or internal prox

Postby dinomic » Thu Nov 15, 2012 6:56 am

Good news. Would you mind adding this to the wiki? We would greatly appreciate it.
bigfoot65, just point me in the right directlon!

If there's enough interes in this feature, and want it to be made a lot simpler, then I may chat to cpg to see if I can help add this to the HDA Setup Control Panel...
Norco 4220 Case
Gigabyte GA-G33-DS3R Motherboard w/ 8GB RAM
LSI SAS2116PCIe 6GB/s SAS (replaced 3Ware 9690SA-4I & Chenbro CK1360)
1 x Hitachi 160Gb2.5" System Drive (original 1 x OCZ 60GB Vertex 2 SATAII 2.5" SSD died)
8 x 4TB Hitachi Deskstars
6 x 3TB Hitachi Deskstars
6 x 2TB Hitachi Deskstars (1 dead!)

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Amahi as central local DNS for testing, or internal prox

Postby bigfoot65 » Thu Nov 15, 2012 7:22 am

Not sure of the interest level, but you could submit it as a feature request in the bug tracker (http://bugs.amahi.org). That will put it on the list for future development.

Go to the wiki page (http://wiki.amahi.org) and request an account if you do not already have one. Once approved, you can create a new page for the guidance. We can link it to the main page once complete.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

dinomic
Posts: 65
Joined: Mon Jan 03, 2011 6:49 am

Re: Amahi as central local DNS for testing, or internal prox

Postby dinomic » Thu Nov 15, 2012 8:55 am

Not sure of the interest level, but you could submit it as a feature request in the bug tracker (http://bugs.amahi.org). That will put it on the list for future development.

Go to the wiki page (http://wiki.amahi.org) and request an account if you do not already have one. Once approved, you can create a new page for the guidance. We can link it to the main page once complete.
I've logged into the Wiki (so seems I've got an active account), but I just don't see an option to create a new page - am I being thick or something (I remember having this issue before, actually, and that's why I have up!)?
Norco 4220 Case
Gigabyte GA-G33-DS3R Motherboard w/ 8GB RAM
LSI SAS2116PCIe 6GB/s SAS (replaced 3Ware 9690SA-4I & Chenbro CK1360)
1 x Hitachi 160Gb2.5" System Drive (original 1 x OCZ 60GB Vertex 2 SATAII 2.5" SSD died)
8 x 4TB Hitachi Deskstars
6 x 3TB Hitachi Deskstars
6 x 2TB Hitachi Deskstars (1 dead!)

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Amahi as central local DNS for testing, or internal prox

Postby bigfoot65 » Thu Nov 15, 2012 10:08 am

Edit the URL in the browser, replacing Main_Page with what you want to call your page. Then it should come up saying not found and give you the option to edit/create it.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

dinomic
Posts: 65
Joined: Mon Jan 03, 2011 6:49 am

Re: Amahi as central local DNS for testing, or internal prox

Postby dinomic » Thu Nov 15, 2012 7:20 pm

Thanks bigfoot65, that's done now. The page can be found here (couldn't think of a better name for it!):

http://wiki.amahi.org/index.php/Centralised_Local_DNS
Norco 4220 Case
Gigabyte GA-G33-DS3R Motherboard w/ 8GB RAM
LSI SAS2116PCIe 6GB/s SAS (replaced 3Ware 9690SA-4I & Chenbro CK1360)
1 x Hitachi 160Gb2.5" System Drive (original 1 x OCZ 60GB Vertex 2 SATAII 2.5" SSD died)
8 x 4TB Hitachi Deskstars
6 x 3TB Hitachi Deskstars
6 x 2TB Hitachi Deskstars (1 dead!)

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Amahi as central local DNS for testing, or internal prox

Postby bigfoot65 » Thu Nov 15, 2012 8:04 pm

Looks good. I will try to find a spot for a link on the main page as well. Centralised is spelled differently in the US. We spell it Centralized :)
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

dinomic
Posts: 65
Joined: Mon Jan 03, 2011 6:49 am

Re: Amahi as central local DNS for testing, or internal prox

Postby dinomic » Thu Nov 15, 2012 8:18 pm

Centralised is spelled differently in the US. We spell it Centralized :)
Yeah, but English is called English because it came from England! ;)
Norco 4220 Case
Gigabyte GA-G33-DS3R Motherboard w/ 8GB RAM
LSI SAS2116PCIe 6GB/s SAS (replaced 3Ware 9690SA-4I & Chenbro CK1360)
1 x Hitachi 160Gb2.5" System Drive (original 1 x OCZ 60GB Vertex 2 SATAII 2.5" SSD died)
8 x 4TB Hitachi Deskstars
6 x 3TB Hitachi Deskstars
6 x 2TB Hitachi Deskstars (1 dead!)

Who is online

Users browsing this forum: No registered users and 50 guests