Sous Linux, en supposant que l'iproute2 est installé, vous pouvez exécuter la commande ss pour extraire les sockets udp comme suit:
ss -u
Ou toutes les sockets udp, avec le processus associé:
[root@kerberos ks]# ss -u -pa
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:kerberos *:* users:(("krb5kdc",1935,7))
UNCONN 0 0 *:mdns *:* users:(("avahi-daemon",1613,13))
UNCONN 0 0 *:rquotad *:* users:(("rpc.rquotad",1872,3))
UNCONN 0 0 *:kerberos-iv *:* users:(("krb5kdc",1935,6))
UNCONN 0 0 *:sunrpc *:* users:(("rpcbind",1569,6))
UNCONN 0 0 *:ipp *:* users:(("cupsd",1687,9))
UNCONN 0 0 192.168.15.100:ntp *:* users:(("ntpd",1976,23))
UNCONN 0 0 172.16.15.1:ntp *:* users:(("ntpd",1976,22))
UNCONN 0 0 127.0.0.1:ntp *:* users:(("ntpd",1976,21))
UNCONN 0 0 *:ntp *:* users:(("ntpd",1976,16))
UNCONN 0 0 *:892 *:* users:(("rpc.mountd",1888,7))
UNCONN 0 0 *:896 *:* users:(("rpcbind",1569,7))
UNCONN 0 0 *:32769 *:*
UNCONN 0 0 *:nfs *:*
UNCONN 0 0 *:syslog *:* users:(("rsyslogd",1506,1))
UNCONN 0 0 *:42375 *:* users:(("avahi-daemon",1613,14))
UNCONN 0 0 *:pftp *:* users:(("rpc.statd",1643,8))
UNCONN 0 0 *:snmp *:* users:(("snmpd",1949,7))
UNCONN 0 0 *:37802 *:* users:(("squid",2124,9))
UNCONN 0 0 *:bootps *:* users:(("dhcpd",1987,7))
UNCONN 0 0 *:tftp *:* users:(("xinetd",1968,6))
UNCONN 0 0 *:971 *:* users:(("rpc.statd",1643,5))
UNCONN 0 0 *:kpasswd *:* users:(("kadmind",1926,6))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:kerberos :::* users:(("krb5kdc",1935,11))
UNCONN 0 0 fe80::226:2dff:fe47:309f:kerberos :::* users:(("krb5kdc",1935,9))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:kerberos-iv :::* users:(("krb5kdc",1935,10))
UNCONN 0 0 fe80::226:2dff:fe47:309f:kerberos-iv :::* users:(("krb5kdc",1935,8))
UNCONN 0 0 :::sunrpc :::* users:(("rpcbind",1569,9))
UNCONN 0 0 fe80::fc54:ff:feda:8094:ntp :::* users:(("ntpd",1976,26))
UNCONN 0 0 fe80::fc54:ff:fe52:8f66:ntp :::* users:(("ntpd",1976,30))
UNCONN 0 0 fe80::fc54:ff:feea:63a8:ntp :::* users:(("ntpd",1976,29))
UNCONN 0 0 fe80::fc54:ff:fe16:15c3:ntp :::* users:(("ntpd",1976,28))
UNCONN 0 0 fe80::fc54:ff:fe75:8012:ntp :::* users:(("ntpd",1976,27))
UNCONN 0 0 fe80::fc54:ff:feb3:4da8:ntp :::* users:(("ntpd",1976,25))
UNCONN 0 0 fe80::226:2dff:fe47:309f:ntp :::* users:(("ntpd",1976,20))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:ntp :::* users:(("ntpd",1976,19))
UNCONN 0 0 ::1:ntp :::* users:(("ntpd",1976,18))
UNCONN 0 0 :::ntp :::* users:(("ntpd",1976,17))
UNCONN 0 0 :::892 :::* users:(("rpc.mountd",1888,9))
UNCONN 0 0 :::896 :::* users:(("rpcbind",1569,10))
UNCONN 0 0 :::32769 :::*
UNCONN 0 0 :::nfs :::*
UNCONN 0 0 :::syslog :::* users:(("rsyslogd",1506,2))
UNCONN 0 0 :::pftp :::* users:(("rpc.statd",1643,10))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:kpasswd :::* users:(("kadmind",1926,8))
UNCONN 0 0 fe80::226:2dff:fe47:309f:kpasswd :::* users:(("kadmind",1926,7))
UNCONN 0 0 :::59603 :::* users:(("squid",2124,8))
[root@kerberos ks]# ss -upa
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:kerberos *:* users:(("krb5kdc",1935,7))
UNCONN 0 0 *:mdns *:* users:(("avahi-daemon",1613,13))
UNCONN 0 0 *:rquotad *:* users:(("rpc.rquotad",1872,3))
UNCONN 0 0 *:kerberos-iv *:* users:(("krb5kdc",1935,6))
UNCONN 0 0 *:sunrpc *:* users:(("rpcbind",1569,6))
UNCONN 0 0 *:ipp *:* users:(("cupsd",1687,9))
UNCONN 0 0 192.168.15.100:ntp *:* users:(("ntpd",1976,23))
UNCONN 0 0 172.16.15.1:ntp *:* users:(("ntpd",1976,22))
UNCONN 0 0 127.0.0.1:ntp *:* users:(("ntpd",1976,21))
UNCONN 0 0 *:ntp *:* users:(("ntpd",1976,16))
UNCONN 0 0 *:892 *:* users:(("rpc.mountd",1888,7))
UNCONN 0 0 *:896 *:* users:(("rpcbind",1569,7))
UNCONN 0 0 *:32769 *:*
UNCONN 0 0 *:nfs *:*
UNCONN 0 0 *:syslog *:* users:(("rsyslogd",1506,1))
UNCONN 0 0 *:42375 *:* users:(("avahi-daemon",1613,14))
UNCONN 0 0 *:pftp *:* users:(("rpc.statd",1643,8))
UNCONN 0 0 *:snmp *:* users:(("snmpd",1949,7))
UNCONN 0 0 *:37802 *:* users:(("squid",2124,9))
UNCONN 0 0 *:bootps *:* users:(("dhcpd",1987,7))
UNCONN 0 0 *:tftp *:* users:(("xinetd",1968,6))
UNCONN 0 0 *:971 *:* users:(("rpc.statd",1643,5))
UNCONN 0 0 *:kpasswd *:* users:(("kadmind",1926,6))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:kerberos :::* users:(("krb5kdc",1935,11))
UNCONN 0 0 fe80::226:2dff:fe47:309f:kerberos :::* users:(("krb5kdc",1935,9))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:kerberos-iv :::* users:(("krb5kdc",1935,10))
UNCONN 0 0 fe80::226:2dff:fe47:309f:kerberos-iv :::* users:(("krb5kdc",1935,8))
UNCONN 0 0 :::sunrpc :::* users:(("rpcbind",1569,9))
UNCONN 0 0 fe80::fc54:ff:feda:8094:ntp :::* users:(("ntpd",1976,26))
UNCONN 0 0 fe80::fc54:ff:fe52:8f66:ntp :::* users:(("ntpd",1976,30))
UNCONN 0 0 fe80::fc54:ff:feea:63a8:ntp :::* users:(("ntpd",1976,29))
UNCONN 0 0 fe80::fc54:ff:fe16:15c3:ntp :::* users:(("ntpd",1976,28))
UNCONN 0 0 fe80::fc54:ff:fe75:8012:ntp :::* users:(("ntpd",1976,27))
UNCONN 0 0 fe80::fc54:ff:feb3:4da8:ntp :::* users:(("ntpd",1976,25))
UNCONN 0 0 fe80::226:2dff:fe47:309f:ntp :::* users:(("ntpd",1976,20))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:ntp :::* users:(("ntpd",1976,19))
UNCONN 0 0 ::1:ntp :::* users:(("ntpd",1976,18))
UNCONN 0 0 :::ntp :::* users:(("ntpd",1976,17))
UNCONN 0 0 :::892 :::* users:(("rpc.mountd",1888,9))
UNCONN 0 0 :::896 :::* users:(("rpcbind",1569,10))
UNCONN 0 0 :::32769 :::*
UNCONN 0 0 :::nfs :::*
UNCONN 0 0 :::syslog :::* users:(("rsyslogd",1506,2))
UNCONN 0 0 :::pftp :::* users:(("rpc.statd",1643,10))
UNCONN 0 0 fe80::2e0:4cff:fe90:40eb:kpasswd :::* users:(("kadmind",1926,8))
UNCONN 0 0 fe80::226:2dff:fe47:309f:kpasswd :::* users:(("kadmind",1926,7))
UNCONN 0 0 :::59603 :::* users:(("squid",2124,8))
Voici des exemples supplémentaires que vous pouvez utiliser avec ss, notamment obtenir des connexions par processus.
http://www.cyberciti.biz/files/ss.html