I assume there's a route print command available

No, that information is supplied by netstat:

# 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


In reply to Re^2: routing information on Solaris by grinder
in thread routing information on Solaris by szabgab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.