Skip to content

Instantly share code, notes, and snippets.

@Dr4K4n
Created November 22, 2014 20:32
Show Gist options
  • Save Dr4K4n/e9996703bda72ca7e0da to your computer and use it in GitHub Desktop.
Save Dr4K4n/e9996703bda72ca7e0da to your computer and use it in GitHub Desktop.
change cntlm proxy configuration based on current IP with NetworkManager
#!/bin/bash
DEVICE="$1"
ACTION="$2"
if [ "$ACTION" = "up" ]; then
IP=$(ifconfig ${DEVICE} | grep "inet Adresse" | cut -b 24-32)
echo $IP
if [ "$IP" = "10.15.225" ]; then
echo "We're at Bucher, use dat TC-proxy!"
rm /etc/cntlm.conf
ln -sf /etc/cntlmbucher.conf /etc/cntlm.conf
service cntlm restart
else
echo "We're NOT at Bucher, free internet!"
rm /etc/cntlm.conf
ln -sf /etc/cntlmhome.conf /etc/cntlm.conf
service cntlm restart
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment