How to listen for a specific ping packet and take an action when it is received
Hi all,
Here is what I am trying to accomplish. I have two servers, the first one (server A) is always up and the other (server B) only when needed. The goal is to trigger an action on server A after receiving a specific echo packet from server B: 1) server B comes online 2_a) server B sends a specific ping packet (with a modified size and/or content) to server A 2_b) server A is listening for a specific ping packet (this is the step I am asking your help for) 3) trigger an action on server A when it gets the specific ping packet. I would like to do it in bash but any other language (perl, python, C, etc.) is OK. Thanks for your input, paicito |
Some thoughts on this.
use a raw icmp socket server programm. Checkout http://beej.us/guide/bgnet/ use iptables with -m string and -j NFLOG and an nflog programm that runs your programm. use iptables and -m recent and parse the recent files in /proc and run command. Could also -j SET and search those files. use ssh and key login from server b to just run a command on server A. Or write a costum server/client application. |
Wonder if a different type of packet would be better??? Ping is a poor choice since it can be blocked by too many things.
|
Thanks for your input guys, I finally wrote a simple server-client communication, using a UDP port.
Thanks again! |
Quote:
http://www.portknocking.org/ There are MANY already-existing scripts (perl and bash), that do this, and the knockd daemon is avaiable to you. |
All times are GMT -5. The time now is 12:03 AM. |