Last active
March 16, 2016 13:03
-
-
Save wsvn53/bb2f25dcb0fda8b8d964 to your computer and use it in GitHub Desktop.
Auto enbale/disable ping request of gateway, for router check gateway avaliable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/vpnc/post-connect.d/enable-ping.sh | |
--------------------------------------- | |
#!/bin/bash | |
echo "Connected."; | |
# enable host ping | |
while [ ! -z "$(iptables -L | grep icmp-net-unreachable)" ]; do | |
echo "==> delete icmp-net-unreachable"; | |
iptables -D INPUT -p icmp -m icmp --icmp-type echo-request -j REJECT --reject-with icmp-net-unreachable; | |
done | |
echo "Ping enabled."; | |
/etc/vpnc/disconnect.d/disable-ping.sh | |
-------------------------------------- | |
#!/bin/bash | |
echo "Disconnected."; | |
# disable host ping | |
[ -z "$(iptables -L | grep icmp-net-unreachable)" ] && { | |
iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j REJECT --reject-with icmp-net-unreachable; | |
} | |
echo "Ping disabled."; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment