Skip to content

Instantly share code, notes, and snippets.

@yozachar
Last active November 3, 2022 09:42
Show Gist options
  • Save yozachar/2fcd13e7077a6b2502338d482c222a55 to your computer and use it in GitHub Desktop.
Save yozachar/2fcd13e7077a6b2502338d482c222a55 to your computer and use it in GitHub Desktop.

iproute2

Tool: ip Command aliases: n neighbour, a addr, l link, r route, t tunnel, ma maddr, mr mroute, -s -stats -statistics Subcommand aliases: [n neighbour : s show f flush], [t tunnel : a add chg change, d del, ls show], [r route : h help]

Tool: ss Aliases: -a --all, -f --family=, -e --extend, -l --listening, -n --numeric, -r --resolve, -o --options, -t --tcp, -u --udp, -w --raw

Common Deprecated Linux networking commands and their replacements

Deprecatedd command Replacement command(s)
arp ip n
ifconfig ip a ip l, ip -s
iptunnel ip t
iwconfig iw
nameif ip l, ifrename
netstat ss, ip r (for netstat -r), ip -s l (for netstat -i), ip ma (for netstat -g)
route ip r

iptunnel

Aliases:

Deprecated Replacement
iptunnel [add | change | del | show] ip t [a | chg | d | ls ]
iptunnel add [name] [mode {ipip | gre | sit}] remote [remote_addr] local [local_addr] ip t a [name] [mode {ipip | gre | sit | isatap | ip6in6 | ipip6 | any }] remote [remote_addr] local [local_addr]

nameif

Aliases:

If no name and MAC address are provided, it attempts to read addresses from /etc/mactab. Each line of mactab should contain an interface name and MAC address (or comments starting with #).

Deprecated Replacement
nameif [name] [mac_address] ip link set dev [interface] name [name] or ifrename -i [interface] -n [newname]

Reads from [config_file] instead of /etc/mactab

Deprecated Replacement
nameif -c [config_file] ifrename -c [config_file]

Error messages are sent to the syslog.

Deprecated Replacement
nameif -s Not apparent

arp

Aliases: -a --all, -d --delete, -D --use-device, -f --file, -H --hw-type, -n --numeric, -s --set, -i --device

Shows the entries of the specified host name or IP address. If the [host] parameter is not used, all entries will be displayed.

Deprecated Replacement
arp -a [host] ip n, ip n s

Removes the ARP cache entry for the specified host.

Deprecated Replacement
arp -d [ip_addr] ip n del [ip_addr] (this "invalidates" neighbor entries) or ip n f [ip_addr]

Uses the hardware address associated with the specified interface.

Deprecated Replacement
arp -D Not apparent

Shows the entries in default (Linux) style.

Deprecated Replacement
arp -e Not apparent

Similar to the -s option, only this time the address info is taken from the file that [filename] set up. If no [filename] is specified, /etc/ethers is used as default.

Deprecated Replacement
arp -f [filename] Not apparent

When setting or reading the ARP cache, this optional parameter tells arp which class of entries it should check for. The default value of this parameter is ether (i.e. hardware code 0x01 for IEEE 802.3 10Mbps Ethernet).

Deprecated Replacement
arp -H [type] or -t [type] Not apparent

Selects an interface. When dumping the ARP cache only entries matching the specified interface will be printed. For example, arp -i eth0 -s 10.21.31.41 A321.ABCF.321A creates a static ARP entry associating IP address 10.21.31.41 with MAC address A321.ABCF.321A on eth0.

Deprecated Replacement
arp -i [int] ip n [add | chg | del | repl] dev [name]

Shows IP addresses instead of trying to determine domain names.

Deprecated Replacement
arp -n Not apparent

Manually creates a static ARP address mapping entry for host [ip_addr] with the hardware address set to [hw_addr].

Deprecated Replacement
arp -s [ip_addr] [hw_addr] ip n add [ip_addr] lladdr [mac_address] dev [device] nud [nud_state]

Uses verbose mode to provide more details.

Deprecated Replacement
arp -v ip -s n

ifconfig

Aliases:

Displays details on all network interfaces

Deprecated Replacement
ifconfig ip a

The name of the interface. This is usually a driver name followed by a unit number; for example, eth0 for the first Ethernet interface. Eth0 will usually be a PC’s primary network interface card (NIC)

Deprecated Replacement
ifconfig [interface] ip a s dev [interface]

To enable the interpretation of differing naming schemes used by various protocols, [address_family] is used for decoding and displaying all protocol addresses. Currently supported address families include inet (TCP/IP, default), inet6 (IPv6), ax25 (AMPR Packet Radio), ddp (Appletalk Phase 2), ipx (Novell IPX) and netrom (AMPR Packet radio). [family] can be inet (IPv4), inet6 (IPv6), or link, -4 = -f inet and -6 = -f inet6.

Deprecated Replacement
ifconfig [address_family] ip -f [family] a

Adds an IPv6 address to the [interface]

Deprecated Replacement
ifconfig [interface] add [address/prefixlength] ip a add [ip_addr/mask] dev [interface]

Assigns the specified IP [address] to the specified [interface]

Deprecated Replacement
ifconfig [interface] address [address] ip a add [ip_addr/mask] dev [interface]

Enables or disables all-multicast mode. If selected, all multicast packets on the network will be received by the [interface] specified. This enables or disables the sending of incoming frames to the kernel’s network layer. Where [name] is the interface on which multicast packets are received.

Deprecated Replacement
ifconfig [interface] [-allmulti/-allmulti] ip mr iif [name]

Enables or disables the use of the ARP protocol on this [interface]

Deprecated Replacement
ifconfig [interface] [arp/-arp] ip l set arp [on/off]

Specifies the address to use to use for broadcast transmissions. By default, the broadcast address for a subnet is the IP address with all ones in the host portion of the subnet address (i.e., a.b.c.255 for a /24 subnet). ip l set ... Sets the link layer broadcast address

Deprecated Replacement
ifconfig [interface] broadcast [address] ip a add broadcast [ip_address] or ip l set dev [interface] broadcast [mac_address]

Removes an IPv6 address from the [interface], such as eth0

Deprecated Replacement
ifconfig [interface] del [address/prefixlength] ip a del [ipv6_addr or ipv4_addr] dev [interface]

Disables the [interface], such as eth0

Deprecated Replacement
ifconfig [interface] down ip l set dev [interface] down

Sets the hardware (MAC) address of this [interface], if the device driver supports this operation. The keyword must be followed by the name of the hardware [class] and the printable ASCII equivalent of the hardware address. Hardware classes currently supported include ether (Ethernet), ax25 (AMPR AX.25), ARCnet and netrom (AMPR NET/ROM).

Deprecated Replacement
ifconfig [interface] hw [class] [address] ip l set dev [interface] address [mac_addr]

Sets the start [address] in I/O space for this device

Deprecated Replacement
ifconfig [interface] io_addr [address] Not apparent; possibly ethtool.

Sets the interrupt line used by the network interface

Deprecated Replacement
ifconfig [interface] irq [address] Not apparent; possibly ethtool

Sets the start address for shared memory of the interface

Deprecated Replacement
ifconfig [interface] mem_start [address] Not apparent; possibly ethtool

Sets physical port or medium type. Examples of [type] are 10baseT, 10base2, and AUI. A [type] value of auto will tell the interface driver to automatically determine the media type (driver support for this command varies)

Deprecated Replacement
ifconfig [interface] media [type] Not apparent; possibly ethtool

Sets the Maximum Transfer Unit (MTU) of an interface to [n]

Deprecated Replacement
ifconfig [interface] mtu [n] ip l set dev [interface] mtu [n]

Sets the multicast flag on the interface (should not normally be needed as the drivers set the flag correctly themselves)

Deprecated Replacement
ifconfig [interface] multicast ip l set dev [interface]

Sets the subnet mask (not the IP address) for this [interface]. This value defaults to the standard Class A, B, or C subnet masks (based on the interface IP address) but can be changed with this command.

Deprecated Replacement
ifconfig [interface] netmask [mask_address] Not apparent

Enables or disables point-to-point mode on this [interface] address of the remote endpoint for point-to-point interfaces. The command ip a add peer [address] specifies the address of the remote endpoint for point-to-point interfaces.

Deprecated Replacement
ifconfig [interface] [pointopoint/-pointopoint] Not apparent; possibly ipppd [device]

Enables or disables promiscuous mode on the [interface].

Deprecated Replacement
ifconfig [interface] [promisc/-promisc] ip l set dev [interface] promisc [on/off]

Sets the transmit queue length on the [interface]. Smaller values are recommended for connections with high latency (i.e., dial-up modems, ISDN, etc)

Deprecated Replacement
ifconfig [interface] txquelen [n] ip l set dev [interface] txqueuelen [n] or txqlen [n]

Creates a Simple Internet Transition (IPv6-in-IPv4) device which tunnels to the IPv4 [address] provided.

Deprecated Replacement
ifconfig [interface] tunnel [address] ip t mode sit (other possible modes are ipip and gre)

Activates (enables) the [interface] specified

Deprecated Replacement
ifconfig [interface] up ip l set [interface] up

netstat

Aliases: -a --all, -A --protocol= -c --continious, -e --extend, -g --groups, -i --interface=, -l --listening, -M --masquerade, -n --numeric, -N --symbolic, -o --timers, -p --program, -r --route, -s --statistics, -t --tcp, -T --notrim, -u --udb, -v --verbose, -w --raw, -Z context

Shows both listening and non-listening sockets

Deprecated Replacement
netstat -a ss -a

Specifies the address families for which connections are to be shown. [family] is a comma separated list of address family keywords like inet, unix, ipx, ax25, netrom, and ddp. This has the same effect as using the --inet, --unix (-x), --ipx, --ax25, --netrom, and --ddp options. ss families: unix, inet, inet6, link, netlink

Deprecated Replacement
netstat -A [family] ss -f [family]

Configures netstat to refresh the displayed information every second until stopped.

Deprecated Replacement
netstat -c Not apparent

Prints routing information from the route cache.

Deprecated Replacement
netstat -C ip r list cache

Displays an increased level of detail.

Deprecated Replacement
netstat -e ss -e

Prints routing information from the forward information database (FIB).

Deprecated Replacement
netstat -F Not apparent

Displays multicast group membership information for IPv4 and IPv6.

Deprecated Replacement
netstat -g ip ma, ip ma show [interface]

Displays a table of all network interfaces, or the specified [name].

Deprecated Replacement
netstat -i ip -s link

Shows only listening sockets (which are omitted by netstat be default).

Deprecated Replacement
netstat -l ss -l

Displays a list of masqueraded connections (connections being altered by Network Address Translation).

Deprecated Replacement
netstat -M Not apparent

Show numerical addresses instead of trying to determine symbolic host, port or user names (skips DNS translation).

Deprecated Replacement
netstat -n ss -n

Shows numerical host addresses but does not affect the resolution of port or user names.

Deprecated Replacement
netstat --numeric-hosts Not apparent

Shows numerical port numbers but does not affect the resolution of host or user names.

Deprecated Replacement
netstat --numeric ports Not apparent`

Shows numerical user IDs but does not affect the resolution of host or port names.

Deprecated Replacement
netstat --numeric-users Not apparent

Displays the symbolic host, port, or user names instead of numerical representations. Netstat does this by default.

Deprecated Replacement
netstat -N ss -r

Includes information related to networking timers.

Deprecated Replacement
netstat -o ss -o

Shows the process ID (PID) and name of the program to which each socket belongs.

Deprecated Replacement
netstat -p ss -p

Shows the kernel routing tables.

Deprecated Replacement
netstat -r ip r, ip r show all

Displays summary statistics for each protocol.

Deprecated Replacement
netstat -s ss -s

Filters results to display TCP only.

Deprecated Replacement
netstat -t ss -t

Stops trimming long addresses.

Deprecated Replacement
netstat -T Not apparent

Filters results to display UDP only.

Deprecated Replacement
netstat -u ss -u

Produces verbose output.

Deprecated Replacement
netstat -v Not apparent

Filter results to display raw sockets only.

Deprecated Replacement
netstat -w ss -w

Prints the SELinux context if SELinux is enabled. On hosts running SELinux, all processes and files are labeled in a way that represents security-relevant information. This information is called the SELinux context.

Deprecated Replacement
netstat -Z Not apparent

route

Aliases: -C --cache, -h --help, -v --verbose, -V --Version

Displays the host’s routing tables.

Deprecated Replacement
route ip r

Uses the specified address family with add or del. Valid families are inet (DARPA Internet), inet6 (IPv6), ax25 (AMPR AX.25), netrom (AMPR NET/ROM), ipx (Novell IPX), ddp (Appletalk DDP), and x25 (CCITT X.25).

Deprecated Replacement
route -A [family] [add] ip -f [family] route

Operates on the kernel’s routing cache instead of the forwarding information base (FIB) routing table.

Deprecated Replacement
route -C Not apparent; ip r show cache

Uses the netstat -r format to display the routing table.

Deprecated Replacement
route -e ip r show

Operates on the kernel’s Forwarding Information Base (FIB) routing table (default behavior).

Deprecated Replacement
route -F or --fib Not apparent

Prints the help message.

Deprecated Replacement
route -h ip r h

Shows numerical IP addresses and bypass host name resolution.

Deprecated Replacement
route -n Not apparent

Enables verbose command output.

Deprecated Replacement
route -v ip -s r

Dispays the version of net-tools and the route command.

Deprecated Replacement
route -V ip -V

Adds or delete a route in the routing table.

Deprecated Replacement
route [add/del] ip r [add | chg | repl | del] [ip_addrA] via [ip_addrB]

Associates a route with a specific device. If dev [interface] is the last option on the command line, the word dev may be omitted.

Deprecated Replacement
route [add/del] dev [interface] ip r [add | chg | repl | del] dev [interface]

Routes packets through the specified gateway IP address.

Deprecated Replacement
route [add/del] [default] gw [gw] ip r add default via [gw]

Specifies that the target is a host (not a network).

Deprecated Replacement
route [add/del] -host Not apparent

Sets the initial round trip time (IRTT) for TCP connections over this route to [n] milliseconds (1-12000). This is typically only used on AX.25 networks. If omitted the RFC 1122 default of 300ms is used. Sets the RTT estimate; rttvar [number] sets the initial RTT variance estimate.

Deprecated Replacement
route [add/del] -irtt [n] Not apparent; ip r [add | chg | repl | del] rtt [number]

Specifies that the target is a network (not a host).

Deprecated Replacement
route [add/del] -net Not apparent

Sets the subnet [mask].

Deprecated Replacement
route [add/del] [-host/-net] netmask [mask] Not apparent

Sets the metric field in the routing table (used by routing daemons) to the value of [n].

Deprecated Replacement
route [add/del] metric [n] ip r [add | chg | repl | del] [metric/preference] [number]

Install a dynamic or modified route. These flags are for diagnostic purposes, and are generally only set by routing daemons.

Deprecated Replacement
route [add/del] [mod/dyn/reinstate] Not apparent

Sets the TCP Maximum Segment Size (MSS) for connections over this route to the number of [bytes] specified. The MSS to advertise to these destinations when establishing TCP connections

Deprecated Replacement
route [add/del] mss [bytes] ip r [add | chg | repl | del] advmss [number]

Installs a blocking route, which will force a route lookup to fail. This is used to mask out networks before using the default route. This is not intended to provide firewall functionality.

Deprecated Replacement
route [add/del] reject ip r add prohibit [network_addr]

Set the TCP window size for connections over this route to the value of [n] bytes. This is typically only used on AX.25 networks and with drivers unable to handle back-to-back frames.

Deprecated Replacement
route [add or del] window [n] ip r [add | chg | repl | del] window [W]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment