Use winsock
require "win32ole" ws = WIN32OLE.new "MSWinsock.Winsock" # Retrieve LocalIP property ipAddress = ws.localIP puts "The local IP is : #{ipAddress}"