Skip to content

Instantly share code, notes, and snippets.

@matthiasg
Created February 7, 2013 07:02
Show Gist options
  • Save matthiasg/4729081 to your computer and use it in GitHub Desktop.
Save matthiasg/4729081 to your computer and use it in GitHub Desktop.
network traffic per zone looked at manually (SmartOS) NOTE: THIS SEEMS TO NOT SHOW VNIC TRAFFIC. ALL VNICS ALWAYS SHOW 0 USE kstat -m link instead

list all interfaces in order with allowed ips (to figure out which interface is which virtual machine)

dladm show-linkprop -p allowed-ips

Example Output:

LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
rge0         allowed-ips     rw   --             --             --
stub0        allowed-ips     rw   --             --             --
stub1        allowed-ips     rw   --             --             --
net0         allowed-ips     rw   192.168.2.131  --             --
net0         allowed-ips     rw   192.168.2.141  --             --
net0         allowed-ips     rw   --             --             --
net0         allowed-ips     rw   192.168.2.142  --             --
net0         allowed-ips     rw   192.168.2.202  --             --
net0         allowed-ips     rw   192.168.2.140  --             --
net0         allowed-ips     rw   10.0.0.160     --             --
net0         allowed-ips     rw   10.0.0.170     --             --
net0         allowed-ips     rw   10.0.0.150     --             --
net0         allowed-ips     rw   --             --             --
net1         allowed-ips     rw   --             --             --
net0         allowed-ips     rw   192.168.2.201  --             --

or use zone field:

dladm show-linkprop -p zone

LINK         PROPERTY        PERM VALUE          DEFAULT        POSSIBLE
rge0         zone            rw   --             --             --
stub0        zone            rw   --             --             --
stub1        zone            rw   --             --             --
net0         zone            rw   ea5af66d-c877-4837-b4fa-43820f398b0f -- --
net0         zone            rw   npmjs          --             --
net0         zone            rw   6a11cabb-08fd-4338-9a67-41e51f397ee2 -- --
net0         zone            rw   irc            --             --
net0         zone            rw   20cdf845-8ac0-45e3-99b0-eebb0212bff5 -- --
net0         zone            rw   a299fa56-3a3c-45ff-8af5-d75d7344e0f4 -- --
net0         zone            rw   6afd51a3-d6e9-4502-9494-8dfaa327cffc -- --
net0         zone            rw   d0733f76-2055-445f-9556-519525d0edd4 -- --
net0         zone            rw   e9703c55-6dc1-4f1e-beec-6ddeb18c26ca -- --
net0         zone            rw   af8512a0-4988-427f-8083-c6e1f4f87c7d -- --
net1         zone            rw   af8512a0-4988-427f-8083-c6e1f4f87c7d -- --
net0         zone            rw   5389d897-d369-42f6-8fa4-4f25bef7a9a3 -- --

now that you know the indices of the interfaces:

kstat -m link

Example Output

module: link                            instance: 0
name:   z8_net1                         class:    net
    brdcstrcv                       128
    brdcstxmt                       25
    collisions                      0
    crtime                          472.739408744
    ierrors                         0
    ifspeed                         0
    ipackets                        2524
    ipackets64                      2524
    link_duplex                     0
    link_state                      1
    multircv                        0
    multixmt                        25
    norcvbuf                        0
    noxmtbuf                        0
    obytes                          1912840
    obytes64                        1912840
    oerrors                         0
    opackets                        18388
    opackets64                      18388
    rbytes                          2204194
    rbytes64                        2204194
    snaptime                        2726.172825333
    unknowns                        0
    zonename                        af8512a0-4988-427f-8083-c6e1f4f87c7d

module: link                            instance: 0
name:   z9_net0                         class:    net
    brdcstrcv                       126
    brdcstxmt                       27
    collisions                      0
    crtime                          470.791401133
    ierrors                         0
    ifspeed                         0
    ipackets                        12750
    ipackets64                      12750
    link_duplex                     0
    link_state                      1
    multircv                        0
    multixmt                        27
    norcvbuf                        0
    noxmtbuf                        0
    obytes                          1806624
    obytes64                        1806624
    oerrors                         0
    opackets                        12357
    opackets64                      12357
    rbytes                          4262717
    rbytes64                        4262717
    snaptime                        2726.17308818
    unknowns                        0
    zonename                        6afd51a3-d6e9-4502-9494-8dfaa327cffc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment