hping outifa target
Return the address of the outgoing interface to reach target.
Suppose you want to rewrite the ping program in hping, you need to
know what is the interface used to send and receive packets for a given
destination. The outifa subcommand does exactly this: it returns the
IPv4 address of the outgoing interface for the target destination.
Assuming there are no bugs nor very strange configurations, the
address returned will match at least one of the interface addresses
returned with hping iflist. The implementation of this command
may not work in all the cases in this beta version of hping.
Example
hping3.0.0-alpha> hping outifa www.google.com
192.168.1.6
hping3.0.0-alpha> hping iflist
{lo 16436 {127.0.0.1} {LOOPBACK}} {eth0 1500 {192.168.1.6} {}}
As you can see 192.168.1.6 is the eth0 unique address -- note that
the host is configured with a 192.168.1.1 as default gateway.
To write a Tcl procedure that returns the name of the interface
with a given address is trivial, such a command (outifname) is included
in the hping standard library hpingstdlib.htcl.
|