#!/usr/bin/ruby
require 'resolv'
puts "Ener a new IP Address"
ip_change = nil
loop do
ip_change = gets.chomp
case ip_change
when Resolv::IPv4::Regex
break
cmd=`/sbin/ifconfig eth0 #{ip_change}`
puts "OK. The new IP address for eth0 is #{ip_change}\n"
end
end