In last blog, i had shown how we can assign a domain name for our webServer.
In this blog, we will deal with a problem where for some reason BBB’s network ip is not stable.
In my case, possible reason for approaching such solution is:-
(if you want, you can skip this)
1. I usually use BBB from many places. Despite of using BBB from home, i also use it from CEDT, MIT FAB lab or CEPD. Obviously, i have to setup DMZ settings in router (to same ip 192.168.1.20 if you want) over there. Then everytime, i visit lab. Setting up webserver is just plug and play job.
2. At home, i have MTNL as ISP and connection, i was using for years, is not a static ip one. MTNL provides me a Point-to-Point Protocol over Ethernet (PPPoE) under ADSL service. ADSL stands for Asymmetric Digital Subscriber Line. This is one of two type of DSL line, another is HDSL (High-Rate Digital Subscriber Line). DSL is an Internet access method that uses a standard phone line to provide high-speed Internet access. DSL is most commonly associated with high- speed Internet access, because it is a relatively inexpensive Internet access, it is often found in homes and small businesses. With DSL, a different frequency can be used for digital and analog signals, which means that you can talk on the phone while you upload data.
In short, everytime time i start my modem with router, I get a different external IP address and obviously that is not suited for my domain name.
Solution :- The solution which i have used here is Dynamic DNS service.
There is a wide range of websites which provide these services. You can use this link to check the list of websites.
Here i am using https://freedns.afraid.org/ as an example but there is no restriction in using other websites. Just you have to search for protocol, they use for updating the ip along with their respective server name. Sign up over there and Dynamic DNS is in left side bar and click on add button to add new url, as shown in picture.
Enter the site detail which you want, and also the list they have along available with them. If you have a static ip from ISP then you can specify your external ip here in “Destination”. You can find your IP easily as shown.
For continuously updating DNS server with respect to our changing IP, we need a utility on Beaglebone Black(client side). You can use ddclient, inadyn etc. . We are using here ddclient here.
Configuration of ddclient
sudo apt-get install ddclient ###if above 3.7 version give you problem then you can ##manually install 3.8 from following steps### git clone https://github.com/wimpunk/ddclient.git cd ddclient sudo cp ddclient /usr/sbin/ sudo mkdir /etc/ddclient sudo mkdir /var/cache/ddclient sudo cp sample-etc_ddclient.conf /etc/ddclient.conf sudo cp sample-etc_rc.d_init.d_ddclient.ubuntu /etc/init.d/ddclient sudo cp sample-etc_rc.d_init.d_ddclient /etc/init.d/ddclient sudo chmod +x /usr/sbin/ddclient #To configure login,hostname and other setting use following command sudo nano /etc/ddclient.conf #####ddclient.conf parameters########### ###in 3.8.2 add these line at line 31### use=web, web=ip1.dynupdate.no-ip.com/ server=freedns.afraid.org protocol=freedns login=your_login_name #(without ' ') password=your_password #(without ' ') mrityunjai.arm.ee #your site ##To start service use##### sudo /etc/init.d/ddclient start ##To detect current IP use#### sudo ddclient -query ##To ensure working,you can use these commands #### sudo ddclient -daemon=0 -debug -verbose -noquiet sudo /etc/init.d/ddclient status ###To restart##### sudo /etc/init.d/ddclient restart ####If u get JSON error in above steps then only go for following steps ### sudo apt-get install build-essential sudo cpanm --sudo Digest::SHA1 sudo cpanm JSON
Daemon stands for Disk And Execution Monitor. A daemon is a long-running background process that answers requests for services.
we can use this for continuously updating our ip address.
######edit ddclient file in /etc/default ####### sudo nano /etc/default/ddclient ##edit to these configuration### run_ipup="false" run_daemon="true" daemon_interval="300"
Cron is the automatic task scheduler for Linux systems. Although ddclient runs as a daemon, for various reasons I have found it necessary to force an update at least once a day, and it will be nice if it will at every reboot and one additional time .
export EDITOR=nano && sudo crontab -e ###add these lines in the end#### @reboot /etc/init.d/ddclient --force 45 04 * * * /etc/init.d/ddclient --force
To verify these services you can use following commands
sudo crontab -l ps -A | grep ddclient ###To check details of last process status ,use## tail /var/log/syslog
Done!
Other resources
https://help.ubuntu.com/community/DynamicDNS