Skip to content

Instantly share code, notes, and snippets.

@jadams
Last active January 21, 2017 22:49
Show Gist options
  • Save jadams/7844cc692b14ae0b95e10abf2fc63acd to your computer and use it in GitHub Desktop.
Save jadams/7844cc692b14ae0b95e10abf2fc63acd to your computer and use it in GitHub Desktop.
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
if !(/bin/ping -c 1 192.168.1.2 &>/dev/null)
then
if [ ! -f /config/fw.down ]
then
touch /config/fw.down
configure
delete interfaces ethernet eth1 address
set interfaces ethernet eth1 disable
delete interfaces ethernet eth2 disable
set interfaces ethernet eth2 address 192.168.1.1/24
commit
fi
else
if [ -f /config/fw.down ]
then
rm -f /config/fw.down
configure
delete interfaces ethernet eth2 address
set interfaces ethernet eth2 disable
delete interfaces ethernet eth1 disable
set interfaces ethernet eth1 address 192.168.1.1/24
commit
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment