Master Linux ip Command: Essential Network Management Techniques
This guide explains the powerful Linux ip command, covering its basic syntax, how to view and configure network interfaces, manage IP addresses, routes, VLANs, and ARP entries, and provides practical examples for everyday system administration tasks.
Linux ip command common operations
In Linux, the ip command is a powerful tool for managing network interfaces and routing, offering more features and finer control than the older ifconfig command. This article details the most frequently used ip operations to help users efficiently manage and configure networks.
ip command basics
The ip command is part of the iproute2 package and is primarily used to display and manipulate routing tables, network interfaces, and tunnels. Its basic syntax is: ip [OPTIONS] OBJECT COMMAND Where OBJECT can be link, addr, route, etc., and COMMAND specifies the action such as add, del, show, etc.
Viewing network interface information
Show all interfaces: ip link show Show a specific interface (e.g., eth0):
ip link show dev eth0Enabling and disabling interfaces
Enable an interface: ip link set dev eth0 up Disable an interface:
ip link set dev eth0 downConfiguring IP addresses
Add an IP address to an interface: ip addr add 192.168.1.10/24 dev eth0 Delete an IP address: ip addr del 192.168.1.10/24 dev eth0 Show all IP addresses: ip addr show Show IP addresses for a specific interface:
ip addr show dev eth0Managing routes
Display the current routing table: ip route show Add a route to a network: ip route add 192.168.1.0/24 via 192.168.1.1 Delete a specific route: ip route del 192.168.1.0/24 Add a default route:
ip route add default via 192.168.1.1Configuring network aliases
Add an alias IP address to an interface:
ip addr add 192.168.1.20/24 dev eth0 label eth0:1View the alias configuration:
ip addr show dev eth0Managing ARP cache
Show the ARP table: ip neigh show Add a static ARP entry:
ip neigh add 192.168.1.10 lladdr 00:11:22:33:44:55 dev eth0Delete an ARP entry:
ip neigh del 192.168.1.10 dev eth0VLAN configuration
Create a VLAN interface:
ip link add link eth0 name eth0.100 type vlan id 100Delete a VLAN interface:
ip link delete eth0.100Summary
The Linux ip command is a versatile network management tool that can handle everything from basic interface configuration to advanced routing and VLAN management. Mastering these common operations enables users to manage and troubleshoot Linux network environments more efficiently.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
