# netstat -nr
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
172.17.0.0 172.17.0.101 U 1 562395 hme0
224.0.0.0 172.17.0.101 U 1 0 hme0
default 172.17.0.6 UG 1 113291
127.0.0.1 127.0.0.1 UH 20 13053 lo0
You will want to to see whether the target address is matched by any of the addresses (hosts or networks) in the first column. cpan::Net::CIDR features Net::CIDR::cidrlookup will help in this regard. If none of them match then the default address is used.
Aliases on Solaris cards follow the standard convention. E.g. if the first interface is hme0, the first alias will be named hme0:1 and so forth. You can enumerate the interfaces on the machine by parsing the output of ifconfig -a. AFAIK there are no modules that offer this functionality... Now there's an itch to be scratched...
update: it's been a while... I was a bit wrong with the netstat switches. You need netstat -nrv which looks like:
# netstat -nrv
IRE Table:
Destination Mask Gateway Device Mxfrg
+ Rtt Ref Flg Out In/Fwd
-------------------- --------------- -------------------- ------ -----
+ ----- --- --- ----- ------
10.0.1.0 255.255.255.0 172.17.0.21 1500
+* 0 0 UG 0 0
172.17.0.0 255.255.224.0 172.17.0.1 hme0 1500
+* 0 3 U 201577 0
224.0.0.0 240.0.0.0 172.17.0.1 hme0 1500
+* 0 3 U 0 0
default 0.0.0.0 172.17.0.6 1500
+* 0 0 UG 728283 0
127.0.0.1 255.255.255.255 127.0.0.1 lo0 8232
+* 0 0 UH 221 0
You need to look at the Destination and Mask columns to determine if you are looking at a host or a network
- another intruder with the mooring in the heart of the Perl
|