| purpose | net-tools | new iproute2 replacement |
|---|---|---|
| Address and link configuration | ifconfig | ip addr ip link |
| Routing tables | route | ip route |
| Neighbors | arp | ip neigh |
| Tunnels | iptunnel | ip tunnel |
| Multicast | ipmaddr | ip maddr |
| Statistics | netstat | ss |
| function | iproute2 command |
|---|---|
| show ip addresses |
ip a ip address show ip addr show dev eth0 ip a sh eth0 |
| add/delete ip addresses |
ip address add 192.0.2.1/24 dev eth0 ip addr del 192.0.2.2/24 dev eth0 for ip in {2..254}; do ip a a 10.1.100.$ip dev eth0; done
|
| show interface statistics |
ip -s link ls eth0 |
| show links/devices |
ip link show ip link sh eth0 |
| set link/device state |
ip link set eth0 up ip link s gre01 down |
| show routing table |
ip route ip ro show dev gre01 |
| add new route |
ip route add 10.2.2.128/27 dev gre01 |
| add default route |
ip route add default via 192.168.1.1 |
| change existing default route |
ip route chg default via 192.168.1.2 |
| delete default route |
ip route del default |
| add/delete a new tunnels | GRE Tunnel:
ip tunnel add gre01 mode gre local 10.1.1.1 remote 20.2.2.1 ttl 255 IPIP Tunnel: ip tunl a ipip01 mode ipip local 10.1.1.1 remote 20.2.2.1 ttl 255 ip tunnel del gre01 |
| show tunnels |
ip tunnel show |
| show tunnel statistics |
ip -s tunl ls gre01 |
| view arp cache table |
ip neigh show |
| add/delete arp entries |
ip neighbor add 10.2.2.2 dev eth0 ip neigh del 10.2.2.1 dev eth0 |
| listening sockets |
ss -l |
| listening processes |
ss -p |