• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

‘ip’ Command cheat sheet (Command Line Reference)

by admin

ip command provided by the iproute package is used to adjust addresses, link state, routing tables, neighbour objects, and manage a system’s network components. The ip command is a powerful tool designed to replace many of the old net-tools commands still in use like ifconfig. Below is a command line reference/cheat sheet of the ‘ip’ command.

IP QUERIES

addr: Display IP Addresses and property information (abbreviation of address)

SUBCOMMAND DESCRIPTIONS AND TASKS
ip addr Show information for all addresses
ip addr show dev em1 Display information only for device em1

link: Manage and display the state of all network interfaces

SUBCOMMAND DESCRIPTIONS AND TASKS
ip link Show information for all interfaces
ip link show dev em1 Display information only for device em1
ip -s link Display interface statistics

route: Display and alter the routing table.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip route List all of the route entries in the kernel

maddr: Manage and display multicast IP addresses.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip maddr Display multicast information for all devices
ip maddr show dev em1 Display multicast information for device em1

neigh: Show neighbour objects; also known as the ARP table for IPv4

SUBCOMMAND DESCRIPTIONS AND TASKS
ip neigh Display neighbour objects
ip neigh show dev em1 Show the ARP cache for device em1

MODIFYING ADDRESS AND LINK PROPERTIES

addr add: Add an address.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip addr add 192.168.1.1/24 dev em1 Add address 192.168.1.1 with netmask 24 to device em1

addr del: Delete an address.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip addr del 192.168.1.1/24 dev em1 Remove address 192.168.1.1/24 from device em1

link set: Alter the status of the interface.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip link set em1 up Bring em1 online
ip link set em1 down Bring em1 offline
ip link set em1 mtu 9000 Set the MTU on em1 to 9000
ip link set em1 promisc on Enable promiscuous mode for em1

ADJUSTING AND VIEWING ROUTES

route add: Add an entry to the routing table.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip route add default via 192.168.1.1 dev em1 Add a default route (for all addresses) via the local gateway 192.168.1.1 that can be reached on device em1
ip route add 192.168.1.0/24 via 192.168.1.1 Add a route to 192.168.1.0/24 via the gateway at 192.168.1.1
ip route add 192.168.1.0/24 dev em1 Add a route to 192.168.1.0/24 that can be reached on device em1

route delete: Delete a routing table entry.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip route delete 192.168.1.0/24 via 192.168.1.1 Delete the route for 192.168.1.0/24 via the gateway at 192.168.1.1

route replace: Replace, or add if not defined, a route.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip route replace 192.168.1.0/24 dev em1 Replace the defined route for 192.168.1.0/24 to use device em1

route get: Display the route an address will take.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip route get 192.168.1.5 Display the route taken for IP 192.168.1.5

MANAGING THE ARP TABLE

neigh add: Add an entry to the ARP Table.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip neigh add 192.168.1.1 lladdr 1:2:3:4:5:6 dev em1 Add address 192.168.1.1 with MAC 1:2:3:4:5:6 to em1

neigh del: Invalidate an entry.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip neigh del 192.168.1.1 dev em1 Invalidate the entry for 192.168.1.1 on em1

neigh replace: Replace, or adds if not defined, an entry to the ARP table.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip neigh replace 192.168.1.1 lladdr 1:2:3:4:5:6 dev em1 Replace the entry for address 192.168.1.1 to use MAC 1:2:3:4:5:6 on em1

MULTICAST ADDRESSING

maddr add: Add a static link-layer multicast address.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip maddr add 33:33:00:00:00:01 dev em1 Add mutlicast address 33:33:00:00:00:01 to em1

maddr del: Delete a multicast address.

SUBCOMMAND DESCRIPTIONS AND TASKS
ip maddr del 33:33:00:00:00:01 dev em1 Delete address 33:33:00:00:00:01 from em1

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. apt-cache: command not found
  2. locale Command Examples in Linux
  3. yum: command not found
  4. cpio command – copies, lists & extracts files to and from archives
  5. CentOS / RHEL : How to find free space in a Volume Group in LVM
  6. dbus-daemon: command not found
  7. How to Rename KVM VM with virsh
  8. How To Configure Timeout On SSH Client Putty
  9. host Command Examples in Linux
  10. lscpu Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright