blog.stj.io

About

Basic Networking With iproute2

Introduction

iproute2 is a Linux package.

iproute2 is a collection of userspace utilities for controlling and monitoring various aspects of networking in the Linux kernel, including routing, network interfaces, tunnels, traffic control, and network-related device drivers.

source iproute2 Wikipedia

It has rendered many net-tools utilities obsolite.

Legacy utility Obsoleted by Note
ifconfig ip addr, ip link, ip -s Address and link configuration
route ip route Routing tables
arp ip neigh Neighbors
iptunnel ip tunnel Tunnels
nameif ifrename, ip link set name Rename network interfaces
ipmaddr ip maddr Multicast
netstat ip -s, ss, ip route Show various networking statistics

source: iproute2 Wikipedia

Troubleshooting Common Issues

Listening services

$ sudo netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3150/nginx: master
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      695/sshd
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      3150/nginx: master
tcp6       0      0 :::22                   :::*                    LISTEN      695/sshd
tcp6       0      0 :::9090                 :::*                    LISTEN      8359/docker-proxy
$ sudo ss -tlpn
State      Recv-Q Send-Q   Local Address:Port   Peer Address:Port
LISTEN     0      128                  *:80                *:*        users:(("nginx",pid=3151,fd=8),("nginx",pid=3150,fd=8))
LISTEN     0      128                  *:22                *:*        users:(("sshd",pid=695,fd=3))
LISTEN     0      128                  *:443               *:*        users:(("nginx",pid=3151,fd=9),("nginx",pid=3150,fd=9))
LISTEN     0      128                 :::22               :::*        users:(("sshd",pid=695,fd=4))
LISTEN     0      128                 :::9090             :::*        users:(("docker-proxy",pid=8359,fd=4))

  • Tags:
  • linux
  • networking