- FIRE=`nslookup ping.ipfire.org | tail -2 | head -1 | cut -d" " -f2`;
- echo "$FIRE gateway" >> /tmp/hosts
+ #no answer
+ HOST=`host ping.ipfire.org`;
+ FIRE=`echo $HOST | cut -d" " -f4`;
+ CHK=`echo $HOST | cut -d" " -f3`;
+ if [ "$CHK" == "address" ]; then
+ #use ping.ipfire.org
+ echo "$FIRE gateway" >> /tmp/hosts
+ else
+ #DNS lookup failed use direct ip
+ echo "81.3.27.38 gateway" >> /tmp/hosts
+ fi