Skip to content

Latest commit

 

History

History
185 lines (163 loc) · 9.29 KB

cix-iproute2.org

File metadata and controls

185 lines (163 loc) · 9.29 KB

iproute2

|≣|

AuthorAlexey Kuznetsovd
ContributorsNikolay Aleksandrov,
Stephen Hemminger,
Daniel Borkmann,
Roopa Prabhu,
Zhang Sheng (all..)
Released2007
Sourceiproute2.git

The iproute package contains networking utilities (ip and rtmon, for example) which are designed to use the advanced networking capabilities of the Linux 2.4.x and 2.6.x kernel.


Index

ip (8)     - show / manipulate routing, devices, policy routing and tunnels
ss (8)     - another utility to investigate sockets
tc (8)     - show / manipulate traffic control settings
arpd (8)   - userspace arp daemon.
nstat (8)  - network statistics tools.
bridge (8) - show / manipulate bridge addresses and devices
rtacct (8) - network statistics tools.
rtmon (8)  - listens to and monitors RTnetlink
ctstat (8) - unified linux network statistics
lnstat (8) - unified linux network statistics
routef (8) - flush routes
routel (8) - list routes with pretty output format
rtstat (8) - unified linux network statistics

net-tools vs iproute2

Description net-tools iproute2
Bring ${IF} UP/DOWN ifconfig ${IF} up/down ip link set ${IF} up/down
Add ${IP} to ${IF} ifcofnig ${IF} ${IP} netmask ${NM} ip addr add ${IP}/24 dev ${IF}
${IF} - interface
${IP} - IPv4/IPv6 address
${NM} - netmask

Recipients

ip

ip::options

CommandValid abbreviations
addressa ad add addr addres address

ip::examples

ip-161108233852

watch trafic statistics on interface enp2s0:

   ~$ watch ip -s link show enp2s0

ip-190109003612

list status as structured and colored output:

   ~$ ip -c address
   ~$ ip -c link
   ~$ ip -c route

ip::files

ip::see-also

ss

ss [ OPTIONS ] [ STATE-FILTER ] [ ADDRESS-FILTER ]
<Netid> <State> <Recv-Q> <Send-Q> <address> <port>

ss::options

OPTIONSTYPEV++V–DESCRIPTION
-0, --packetdisplay PACKET sockets
-4, --ipv4display only IP version 4 sockets
-6, --ipv6display only IP version 6 sockets
-A, --query=QUERY, --socket=QUERY
-D, --diag=FILEDump raw information about TCP sockets to FILE
-E, --eventscontinually display sockets as they are destroyed
-F, --filter=FILEread filter information from FILE
-H, --no-headerSuppress header line
-K, --killforcibly close sockets, display what was closed
-N, --netswitch to the specified network namespace name
-S, --sctpdisplay only SCTP sockets
-V, --versionoutput version information
-Z, --contextdisplay process SELinux security contexts
-a, --alldisplay all sockets
-b, --bpfshow bpf filter socket information
-d, --dccpdisplay only DCCP sockets
-e, --extendedshow detailed socket information
-f, --family=FAMILYdisplay sockets of type FAMILY
-h, --helpthis message
-i, --infoshow internal TCP information
-l, --listeningdisplay listening sockets
-m, --memoryshow socket memory usage
-n, --numericdon’t resolve service names
-o, --optionsshow timer information
-p, --processesshow process using socket
-r, --resolveresolve host names
-s, --summaryshow socket usage summary
-t, --tcpdisplay only TCP sockets
-u, --udpdisplay only UDP sockets
-w, --rawdisplay only RAW sockets
-x, --unixdisplay only Unix domain sockets
-z, --contextsdisplay process and socket SELinux security contexts
FAMILY
{inet|inet6|link|unix|netlink|help}
QUERY
{all|inet|tcp|udp|raw|unix|unix_dgram|unix_stream|unix_seqpacket|packet|netlink}[,QUERY]

STATE-FILTER

  • {established|syn-sent|syn-recv|fin-wait-1|fin-wait-2|time-wait|closed|close-wait|last-ack|listen|closing}
  • all: for all the states
  • connected: all the states except for listen and closed
  • synchronized: all the connected states except for syn-sent
  • bucket: states, which are maintained as minisockets, i.e. time-wait and syn-recv.
  • big: opposite to bucket

ADDRESS-FILTER

Is boolean expression with operations and, or and not, which can be abbreviated in C style f.e. as &, &&.

Predicates check socket addresses, both local and remote. There are the following kinds of predicates:

  • dst ADDRESS_PATTERN - matches remote address and port
  • src ADDRESS_PATTERN - matches local address and port
  • dport RELOP PORT - compares remote port to a number
  • sport RELOP PORT - compares local port to a number
  • autobound - checks that socket is bound to an ephemeral port

ss::examples

ss-161116231307

programms that request access to Internet

   ~# ss -p | cat
   ~# ss -p | grep STA
   ~# ss -p | cut -f2 -sd\"or # Just process/command name
   ~# ss -p | grep STA | cut -f2 -d\"

cat cut grep

ss-170817234939

list top 10 PIDs wich has most of all connections:

   ~# ss -nap | grep -P "(?<=pid\=)[0-9]+" -o | sort | uniq -c | sort -rn | head

sort uniq head grep

ss-180114231711

dump TCP, UDP, RAW or UNIX sockets:

   ~# ss -t -a
   ~# ss -u -a
   ~# ss -w -a
   ~# ss -x -a

ss-180707091236

realtime TCP network connections:

   ~$ watch ss -sp

ss::files

  • /proc/net/tcp
  • /etc/services
  • /etc/protocols
  • /etc/iproute2/nl_protos

ss::see-also

Referances

Links

RFC

RFC-793
TRANSMISSION CONTROL PROTOCOL https://tools.ietf.org/rfc/rfc793.txt