Advertisement
j_melis

Untitled

Sep 20th, 2011
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. MAC=`ifconfig eth0|grep HWaddr|awk '{print $5}'`
  4.  
  5. for i in `echo $MAC|cut -d: -f3-|tr : ' '`; do
  6.         [ -n "$IP" ] && IP=$IP.
  7.         let c=0x$i
  8.         IP=${IP}$c
  9. done
  10.  
  11. GATEWAY=`echo $IP|cut -d. -f1-3`.1
  12.                                        
  13. ifconfig eth0 $IP netmask 255.255.255.0
  14. route add default gw $GATEWAY
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement