My script does a small httping and returns the duration of the httping.
The thing is that I want to bind it to a specific interface.
I have eth1 with local IP 192.168.1.100 and another PPTP VPN which has
dynamic IP and also the host I am trying to reach.
So I cannot bind all the local machine traffic to the VPN interface but
only specific tests.
The base script which works:
#!/usr/bin/env ruby
encoding = utf-8
require ‘net/ping’
host = ARGV[0]
Net::Ping::HTTP.new(‘http://’ + host) do |http|
http.ping ? puts(“ok! #{http.duration}ms”) : puts(http.exception)
end
#end of script
I am sure it can be done but I don’t have experience with the internals
of “net/ping” class.
Thanks in advance,
Eliezer