Background:
Anstle provides a local DNS entry (mDNS) for each antlets (antlet10.local through antlet254.local). This is done by using Avahi and Nginx.
During startup, the Antsle will begin broadcasting the antlet addresses via a python script. The Nginx configurations can be found in /etc/nginx/virtualhosts. The antletxx.local config is defined in /etc/nginx/virtualhosts/antletnum.conf
Quickstart:
If you're not as interested in "how" it works, you can do the following:
- ssh into your antsle
- run "wget -O - https://raw.githubusercontent.com/lreading/antsle-scripts/master/custom_local_dns/setup.sh | bash"
- Edit /etc/nginx/virtualhosts/custom.dns.local.template to include the dns name you want and your antlet's IP address, and rename the file to <name>.local.custom.conf
- rc-service antlet_local_dns start && service nginx restart
Setup:
In order to prevent future antsle / antman updates from wiping out our changes, we are going to create our own scripts that will run on startup. These scripts are available on GitHub, along with a setup script that automates this process.
- SSH into your antsle
- Copy antlet_local_dnsd to /usr/local/bin/antlet_local_dnsd and grant execute permissions (chmod +x /usr/local/bin/antlet_local_dnsd.py)
- Copy custom_local_dns.py to /usr/local/bin/custom_local_dns.py and grant execute permissions (chmod +x /usr/local/bin/custom_local_dns.py)
-
Copy antlet_local_dns to /etc/init.d/antlet_local_dns and grant execute permissions (chmod +x /etc/init.d/antlet_local_dns)
-
Run the following to have the service start on boot: `rc-update add /etc/init.d/antlet_local_dns default`
-
Reboot the system OR start the service `rc-service antlet_local_dns start`
-
Make a new Nginx config for your .local domain and put it in `/etc/nginx/virtualhosts`. BE SURE TO UPDATE THE PROPERTIES AND NAME IT WITH THE FOLLOWING CONVENTION: `<name>.local.custom.conf`
-
Restart the antlet_local_dns service and the nginx service: `rc-service antlet_local_dns restart && service nginx restart`
Adding A New DNS Entry
To add a new DNS entry, you will need to create the config, then restart the antlet_local_dns service and the nginx service. For an example nginx config, see the custom.dns.local.template. This is a manual process. If someone knows if there's any hooks into the antlet creation (that will not get blown away by updates) feel free to contribute. :)
- Create a new nginx config for your antlet in /etc/nginx/virtualhosts with the following naming convention: <name>.local.custom.conf
- Restart the antlet_local_dns service and the nginx service: `rc-service antlet_local_dns restart && service nginx restart`