1. #! /bin/sh
2.  
3. =$(ip route show) 
4. =$(echo $default_route | sed -e 's/^.*dev \([^ ]*\).*$/\1/' | head -n 1) 
5. =$(ip addr show label $default_interface scope global | awk '$1 == "inet" { print $2,$4}') 
6.    
7.  #ip address 
8. =$(echo $address | awk '{print $1 }') 
9. =${ip%%/*} 
10.    
11.  #broadcast 
12. =$(echo $address | awk '{print $2 }') 
13.    
14.  #mask address 
15. =$(route -n |grep 'U[ \t]' | head -n 1 | awk '{print $3}') 
16.    
17.  #gateway address 
18. =$(route -n | grep 'UG[ \t]' | awk '{print $2}') 
19.    
20.  #dns 
21. =$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}') 
22.    
23. :$ip,mask:$mask,broadcast:$broadcast,gateway:$gateway,dns:$dns