I have a question concerning Ubuntu 12.04 LTS Desktop - notifications (same notification as Rhythmbox application when playing music back and forth), technically if I'm not mistaken it should be called "freedesktop.Notifications.service". I just want to add notifications when one of my devices such as; laptop, phone, tablet connect to my local network. My configuration is as follows:
I have a wireless router. My router is connected directly to my desktop computer with a wire, I'm using LAN, the other devices connect through WI-FI.
By way of example, let's say :
My router's ip address : 192.168.1.1 & MAC address XX:XX:XX:XX:XX:XX
Me - as server - 192.168.1.101 & MAC address YY:YY:YY:YY:YY:YY
Smartphone - 192.168.1.102 & MAC address ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
Laptop - 192.168.1.103 & MAC address KK:KK:KK:KK:KK:KK
- What I want to do is simple; add those IP addresses along with their MAC addresses in the ARP and finally modify the notification file, whenever those devices connect to my local network I get notified. That's it.
P.S : I said "ARP". However, I'm not sure if it is suitable, I'm just supposing it has something to do with ARP config file, and notification file. Any suggestion using terminal or other application will be acceptable.
I will be much appreciated if someone can help me.
You can send notifications by use of
notify-send yourmessage
but what you want to do is a bit strange.Your router is the one handling the connections, a connection to your network will not be logged or noticed by your computer unless the device actually connects / interacts to your computer. Of course you could be making a monitor by regularly scanning the network like:
and then read you data from here (or arp, because now you can find them there). But basically the device for monitoring connections is your router, not your pc.
If your router supports it, you could parse the logging of the router to the syslog of your pc. Now you get an message in the syslog when a connection is made, which you can then send to your desktop environment if you want.
But to answer the question, add a script to your cron which will do a nmap -sn, pipe this to temp file and compare this with the previous situation by use of diff. Diff out means offline, diff in means online.
A rough example (only handles first ip change per run):