Linux TCP/IP user-land networking tools (net-tools vs iproute2)

iproute2 is intended to replace standard Unix networking tools net-tools that were previously used for the tasks of configuring network interfaces, routing tables, and managing the ARP table.

See iproute2, net-tools and Kernel Networking

purpose net-tools iproute2
Address and link config ifconfig ip addr, ip link
Routing tables route ip route
Neighbors arp ip neigh
VLAN vconfig ip link
Tunnels iptunnel ip tunnel
Multicast ipmaddr ip maddr
Statistics netstat ss
# Show All Connected Network Interfaces
$ ifconfig -a 
$ ip link show

# Activate or Deactivate a Network Interface
$ ifconfig eth1 up|down
$ ip link set up|down eth1

# Assign IPv4 address(es) to a Network Interface
$ ifconfig eth1 10.0.0.1/24
$ ip addr add 10.0.0.1/24 dev eth1

# Multiple IP addresses / Aliases, see http://xmodulo.com/2013/02/how-to-assign-multiple-ip-addresses-to-one-network-interface-on-centos.html and http://www.cyberciti.biz/faq/linux-creating-or-adding-new-network-alias-to-a-network-card-nic/
$ ip addr add 10.0.0.2/24 broadcast 10.0.0.255 dev eth1
$ ifconfig eth0:0 192.168.1.6 up

# Remove an IPv4 address from a Network Interface
$ ifconfig eth1 0
$ ip addr del 10.0.0.1/24 dev eth1

# Show IPv4 Address(es) of a Network Interface
$ ifconfig eth1
$ ip addr show dev eth1

# Change the MAC Address of a Network Interface
$ ifconfig eth1 hw ether 08:00:27:75:2a:66
$ ip link set dev eth1 address 08:00:27:75:2a:67

# View the IP Routing Table
$ route -n ; netstat -rn
$ ip route show

# Add or Modify a Default Route
$ route add|del default gw 192.168.1.2 eth0
$ ip route add|replace default via 192.168.1.2 dev eth0

# Add or Remove a Static Route
$ route add -net 172.16.32.0/24 gw 192.168.1.1 dev eth0 ; route del -net 172.16.32.0/24
$ ip route add 172.16.32.0/24 via 192.168.1.1 dev eth0 ; ip route del 172.16.32.0/24

# View Socket Statistics
$ netstat -l
$ ss -l

# View the ARP Table
$ arp -an
$ ip neigh

# Set promiscuous mode
$ ifconfig eth0 promisc | ifconfig eth0 -promisc
$ ip link set dev eth0 promisc on | ip link set dev eth0 promisc off 

from Linux TCP/IP networking: net-tools vs. iproute2 and iproute2 cheatsheet

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s