Working with distance sensor – solving overhead water tank problem


This is not a networking post.

Schematic , sensor code and spec  – https://www.linuxnorth.org/raspi-sump

My code – https://github.com/yukthr/auts/blob/master/random_programs/water_sensor.py

1x Breadboard

1x Raspberry pi zero w

1xhcsr04 ultrasonic sensor

2x1kohm resistors


Just as a side note i do not have any intro into resistors nor electronics, but what all i did was to follow some posts written by people who already did it, its not hard believe me, if i could do it any one should easily be able to do it as am very far away from electronics and programming, so let these things not overwhelm you.


Problem – Am not sure in other parts of the world, but place I live has an over head water Tank which stores water. So every day you technically turn on a water motor which sucks water from a reserve under the ground and pumps it to all the the way to a three store high building

So what’s the issue – The issue is that we have no clue what’s the current water level in the tank nor how long would it take to fill the water tank. There are two tribal ways by which we are addressing the problem

1- go to three stores high and sit beside the tank till it gets filled

2- let it overflow and we will know

The post aims to give an idea on a problem am no close to a professional in any of electronics nor coding but I can make it work for my self

Example of a water tank


So, using a raspberry pi zero , a ultrasonic sensor and telegram app did solve the issue, obviously this requires wooden finish and water proofing which is currently taken care by a plastic container.

Raspberry pie zero takes unbelievably low power and even during power outages single power bank could charge it for 40 odd hours


Final output – Sends a message directly to Telegram BOT




Sonoff Flashing and steps towards Smart home

Leave a comment

This post is no way related to Networking ! 😉

It’s always my fascination to implement a specific tech towards home automation so as to have more time in hands. The first step towards this was to use a Tp-link smart switch which came with Alexa, now problem with that is that Tplink app was not properly responding to Alexa and TP-Link smart switch in itself was costly.

I wanted something low-cost, something which I can experiment yet be cost effective, After some re-search I came across Sonoff-Basic model.


I integrated with Amazon echo but again there were app issues (default app is ewelink), though it was working fine something was missing, I couldn’t tinker it to my wish

I found then there is a open-source version of a similar firmware called TASMOTA and we have to flash this sonoff with the new firm-ware of Tasmota, I have to tell you here there is every possibility you would brick your device and make it useless in the process.


Everything is so well documented, there is no need to re-iterate things here, but just to show case another successful implementation.

Need-less to say you are playing with AC/DC electrical power so take all the precautions as necessary and follow the blog articles in official tasmota page, this article does no job in listing out any implementations of flashing the device

Requirements – Though not listed in scree-shots

1- basic solder guns

2-solder pins

3.Raspberry pi (you can also do it with Serial USB but i used Rasepberry pi)



  1. Open the Sonoff basic cover

2. Connect these to sonoff switch and Raspberry pi as instructed in the wiki

This is how connection would look like

Connect to Raspberry pi

Flashing Sonoff , this is the tricky part, if possible get a second pair of hands.

New firmware would take off, Sonoff would boot in an AP mode so the wireless SSID SONOFF_X will be seen in your wireless connections, connect to it and you should be able to configure the device and configure the wireless parameters


You can configure MQTT topic subscription or just ask sonoff to emulate Wemo switch so that it can be used with a Smart home skill like YETI in Amazon echo (alexa)

I have cut a spike cable, connected sonoff. Spike connects to entertainment system which can be programmed to switchoff after a particular time in night or invoke it with voice commands from echo.

This is some start towards affordable home automation, I will post more about PIR sensors which i have been using and other details as time permits. Hass.io is looking promising and should be a good start as well.


Cleared JNCIE-DC


After close to a year of study and after one failed attempt I cleared it in the second attempt. Here is my experience in short and tips to prepare for the exam


Reading Resources 

-> Juniper Dayone – Anything and everything related to DC

-> QFX Series Book



-> Datacenter Network / EVPN – Overview



Lab Resources 

-> If you are into any serious preparation you need to consider the below git resource, its awesome and you can practice pretty much everything even on a laptop and also in your flights/travel.


You need to know a bit of vagrant and need to have VirtualBox and ansible installed, not hard by any means, all it takes is a days dedication to make your laptop ready for these, let me know if you want me to write a blog post for the setup.

-> I had Dell R810 Server, https://r2079.wordpress.com/2018/01/05/my-dc-virtual-lab-setup-insights/ , I did most of my practice on this one.

-> I also had the privilege of using hardware resources and examined the ideal configuration for a production network and learned few things from them.

-> VQFX code is not stable, and you could pretty well go ahead with using VMX code which is highly stable, some variations such as you might end up using bridge-domains vs VLANs and you need to create a VSwitch instance instead of editing under [switch-options] but worth every penny and you will end up avoiding bugs


Learning from my attempts and Tips

-> I was way too confident may be overly confident for the first attempt, that was the very reason for the first failed attempt to be very honest

-> I was lagging in speed and could not cope up with various tasks, the problem was not with the technology, as later in the failed score report the time which I have spent on the sections gave me a near 100% score while for the other sections I failed.

-> Data Center Interconnect killed me, there were many things going in my head by then


Strong points for attempt #2


-> Automation / ZTP and anything related to scripting was easy, I attended JAUT and also took JAUT Exam and I do scripting on a weekly basis so skimming through the code was not tough

My GitHub page – https://github.com/yukthr/auts

ZTP Blog link – https://r2079.wordpress.com/2017/09/11/ztp-with-vqfx-1k-proved-to-be-possible/





-> Technology – EVPN / SP, implemented it in Junipers so was fairly confident with IP-CLOS and EVPN signaling

-> Increased speed and since I have given an attempt, I knew where to start, you need not necessarily start at section 1 and go in an orderly fashion, I completed it blockwise rather than section wise and connected all the blocks at the end, this made more sense to me

A note on automation and Security, Juniper does not expect you to be an expert at SRX or Automation, it’s not testing you for JNCIE-SEC or JAUT in the exam for sure but Juniper does expect some basic level understanding of DC Grade Automation and SRX, Dayone books should be more than enough.

Most importantly go out and enjoy the exam, its a well designed and well-articulated exam, it will challenge you at every step and its worth spending every minute inside JNCIE-DC exam center.


Good Luck

PrettyTable – Printing anything in Table

Leave a comment


As the scripting and programming deals in logging into the device and fetching data, there will be a time where presentability of Data matters. PrettyTable is one such package which greatly helps in reading things

A simple example, re-visiting the code to get the list of routes from the Device

PrettyTable will help in tabulating the Data, the installation and usage can be found here

Pip Package  – https://pypi.org/project/PrettyTable/

Usage – http://zetcode.com/python/prettytable/

Once we have the code, let take a look at how the program looks

The Table form looks something like this


Hope this help for anyone who gets started with presentability of Data, honestly, there was one time I got crazy with the print statement just to make the data presentable.




Fetching Pcap Files and running Wireshark – Junos Pyez

Leave a comment

As a part of some content development and revision on MPLS, I was trying to capture some MPLS Pcap Files from the Vmx Router. The problem was that every time I capture a file, I had to first scp or sftp into the device and then after successful import, I had to run Wireshark on it.

The Aim of the post is to fetch the pcap file and run Wireshark on it. Am not a decent programmer by any stretch of the imagination, anyone can see that from my code 😉 but the point that matters is that it works and you should give it a try too.

https://github.com/yukthr/auts/blob/master/junos_pyez/getfile_executewireshark.py– Is the file



When I run this program to fetch a non-existent Pcap file


And when I query for an existent file





Raspberry Pi and AWS IOT – First steps

Leave a comment

Hi All,

I have slightly changed this to networking, but the intention and my current use is to measure the water level of a sump, since that deviates from the network blog writing, i have extended the same to a Router.

Purpose – Have a Router and also a Syslog Server which monitors my internal network (This can easily be extended to a Car / Moisture Sensor or a Temperature/Humidity Sensor), what we want to do is to make sure if any anomaly is seen in Log Messages, it logs to IOT service. We can then take this up as a Part-2 writing to perform a specific action / automated on what action can be taken to mitigate

Discussion about configuring a Linux device is out of scope, so lets think that we all have that setup. What happens next ?

Lets quickly see our python script, which parses for a anomaly, in this lets say when someone runs a ping command, well its not a anomaly but will do for our use-case.



logparse.py is our program, so i have imported it into the readily available sample program provided by AWSIOT Kit, so you dont have to know much of programming to do this, just to incorporate your code into the program.

Now lets start the program


Now, Finally if we observe the IOT Console, we can see the messages, based on this we can then continue the program to design a automatic response, storage and analysis of log messages and so on.


The main aim of the post was to introduce the IOT for someone starting with it. You can do the entire IOT example experience using a free-tier linux instance as well, you dont have to have a Hardware device to actually do a IOT if you really want to test it out.


You may extend it to anything which outputs the value and then can be sent to AWS IOT / S3 for further actions.






Revisiting – Why IGP sync with LDP is required ?

Leave a comment

Hi All,

I was preparing some content on MPLS for a training session  and as a part of it, was going through LDP. The interesting aspect is very obvious

-> LDP is dependent on IGP

-> What ever Draw-backs IGP has will be inherited by LDP

-> LDP has to be enabled on the Interface to exchange Labels, else it wont consider the exit-interface from IGP and hence there will be no LSP’s

So far so good and makes sense as well


I will not be boring with command line outputs in this case

-> I have disabled the interface between R3/R4 so if R3 Has to reach R1, it will use R3-R2-R1 path

All good, Am going to just tweak the metric of the interface on R3 -> R2 before I enable back the R3 – R4

Now let me enabled the interface between R3-R4

-> It has a Better cost

-> It has not been enabled for LDP



If we go back to R3, to examine the result

This is dangerously familiar for me 🙂 , There is a LDP neighbor, but No routes are present in Inet.3 (neither for R1 or R2) as Routes are learned from R4 for its best path but since R4 is not exchanging labels, R3 will not have any Inet.3 LSP’s inspite of having LDP neighbor.

What to do. ?

-> Troubleshoot – Obvious

-> Tie LDP to IGP

-> T-LDP Session

We all know the reason why LDP is no there – I have not explicitly not enabled it

We will explore the second option

What this does – Well, it simply increases the cost of the interface if the LDP adjacency is not seen on the interface while you have IGP on the interface.

R3—-no ldp -Yes IGP —- R4

As we see above, since there was NO LDP on R3—-R4, the metric is increased so that the other available path is choosen by Router which in-turn let LDP choose it


Older Entries