Thursday, January 15, 2015

Get pid, user and command for the particular port in illumos


While the Solaris has the updated netstat with -u flag, illumos requires certain improvements in sockinfo, and possibly, rpcbind (tcpConnCreationProcess shows the old PID for rpcbind, until it did not become a demon). With help of pfiles is possible to obtain the desired information about pid for particular port, so I wrote a small pfiles-based utility which allows to determine the PID, user and command for the particular port:

# ./ptcpstat
PROTO           IP               PORT   PID    USER     COMMAND
--------  -------------------    ----- ------ -------- ------------------
AF_INET   127.0.0.1              25    692    root      /usr/lib/smtp/sendmail/sendmail -bl -q15m
AF_INET6  ::1                    25    692    root      /usr/lib/smtp/sendmail/sendmail -bl -q15m
AF_INET   127.0.0.1              587   692    root      /usr/lib/smtp/sendmail/sendmail -bl -q15m
AF_INET6  ::                     22    605    root      /usr/lib/ssh/sshd
AF_INET6  ::                     0     495    root      /usr/lib/inet/in.ndpd
AF_INET   0.0.0.0                520   637    root      /usr/sbin/in.routed
AF_INET   0.0.0.0                0     637    root      /usr/sbin/in.routed
AF_INET   0.0.0.0                10004 685    root      /usr/bin/python2.6 /usr/lib/pkg.depotd --cfg svc:/application/pkg/server:test
AF_INET   0.0.0.0                10000 9354   root      /usr/bin/python2.6 /usr/lib/pkg.depotd --cfg svc:/application/pkg/server:zfs
AF_INET6  ::ffff:198.168.1.1     22    2315   root      /usr/lib/ssh/sshd
AF_INET6  ::ffff:10.8.0.30       56027 2315   root      /usr/lib/ssh/sshd
AF_INET   0.0.0.0                80    1402   root      /usr/bin/python2.6 /usr/lib/pkg.depotd --cfg svc:/application/pkg/server:defaul
AF_INET6  ::ffff:198.168.1.1     22    2314   root      /usr/lib/ssh/sshd
AF_INET6  ::ffff:10.8.0.30       56027 2314   root      /usr/lib/ssh/sshd


How to determine PXE mac address when booting illumos via PXELinux/iPXE

In illumos, if you need to determine the interface which was used for booting via PXE then it's possible to use "boot-mac" pro...