Bash 66 62 21 bytes##bytes
ping -c1 g.gl echo $? Thanks @Alex L. for the URL shortening tip.
Ungolfed version:
r=$(ping -c1 g.gl) if [ $? -ne 0 ]; then echo "0" else echo "1" fi This is my first answer in Bash , i'm not sure i have shortened the script enough.