11.8.10 Use The Linux Ip Command
Understanding and Using the Linux IP Command: A Complete Guide
The Linux ip command is one of the most essential tools for network administrators and Linux users who need to configure, manage, and troubleshoot network interfaces. Whether you're setting up a static IP address like 11.8.10.That said, 50, configuring network routes, or diagnosing connectivity issues, the ip command provides a modern and powerful alternative to the older ifconfig utility. This complete walkthrough will walk you through everything you need to know about using the Linux ip command effectively. Practical, not theoretical.
What is the Linux IP Command?
The ip command is part of the iproute2 package, which has become the standard network configuration tool suite in modern Linux distributions. Day to day, unlike the legacy ifconfig command, the ip command offers more advanced features, better support for IPv6, and a more consistent syntax across different network operations. Most Linux distributions including Ubuntu, Debian, CentOS, RHEL, and Fedora ship with the ip command pre-installed.
The ip command can handle various networking tasks including:
- Viewing and configuring network interfaces
- Assigning IP addresses to interfaces
- Managing routing tables
- Configuring ARP entries
- Setting up VLANs and tunnels
- Managing bridge connections
Basic Syntax and Structure
The general syntax for the ip command follows this pattern:
ip [OPTIONS] OBJECT [COMMAND] [ARGUMENTS]
The main objects you can work with include:
- link - Network devices and interfaces
- addr - IP addresses assigned to interfaces
- route - Routing table entries
- neigh - ARP/neighbor tables
- rule - Routing policy database
- tunnel - IP tunnels
- bridge - Bridge devices
Each object has its own set of commands. Take this: with the addr object, you can use add, del, show, and flush commands.
Common Examples Using the Linux IP Command
Viewing Network Interfaces
To display all network interfaces on your system, use:
ip link show
This command displays information about all network devices including their MAC addresses, MTU, and state (UP or DOWN). You'll see output similar to this:
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT
link/ether 00:0c:29:ab:cd:ef brd ff:ff:ff:ff:ff:ff
Assigning an IP Address to an Interface
One of the most common uses of the ip command is assigning an IP address to a network interface. As an example, to assign the IP address 11.8.10.Still, 50 with a subnet mask of 24 bits (255. 255.255.
ip addr add 11.8.10.50/24 dev eth0
This command adds the IP address 11.Also, 8. Here's the thing — 10. 50 to the eth0 network interface. Also, the /24 notation represents the CIDR prefix length, which corresponds to a subnet mask of 255. 255.255.0. You can also use the traditional dotted decimal notation if preferred.
Viewing IP Addresses
To see all IP addresses assigned to your interfaces, use:
ip addr show
This displays comprehensive information including IPv4 and IPv6 addresses assigned to each interface. The output shows the interface name, state, MAC address, and all assigned IP addresses with their respective scopes.
Removing an IP Address
If you need to remove an IP address from an interface, the syntax is straightforward:
ip addr del 11.8.10.50/24 dev eth0
This removes the specified IP address from the eth0 interface. This is particularly useful when reconfiguring network settings or troubleshooting IP address conflicts.
Bringing Interfaces Up and Down
Managing interface state is another common task:
ip link set eth0 up
ip link set eth0 down
The first command activates the eth0 interface, while the second one deactivates it. When you bring an interface down, all IP addresses assigned to it become unreachable. Bringing it back up restores connectivity for configured addresses.
Managing Routes with the IP Command
The ip command excels at route management, which is crucial for controlling how network traffic flows between different networks.
Viewing the Routing Table
ip route show
This displays the current routing table, showing default gateways, specific network routes, and how packets are forwarded. You'll see entries like:
default via 11.8.10.1 dev eth0
11.8.10.0/24 dev eth0 proto kernel scope link src 11.8.10.50
Adding a Static Route
To add a specific route to the routing table:
For more on this topic, read our article on you hired a contractor to update electrical wiring or check out x 2 1 4 x.
ip route add 192.168.100.0/24 via 11.8.10.1 dev eth0
This command tells the system to route traffic destined for the 192.8.168.10.100.0/24 network through the gateway at 11.1 using the eth0 interface.
Adding a Default Gateway
The default gateway is used when no specific route matches the destination:
ip route add default via 11.8.10.1
This sets 11.8.10.1 as the default gateway, which means all traffic destined for networks not explicitly defined in the routing table will be sent to this gateway.
Working with ARP Tables
The ip command can manage the ARP (Address Resolution Protocol) cache, which maps IP addresses to MAC addresses:
ip neigh show
This displays the current ARP cache. To add a static ARP entry:
ip neigh add 11.8.10.100 lladdr aa:bb:cc:dd:ee:ff dev eth0
This creates a static mapping between IP address 11.8.10.100 and the specified MAC address.
Practical Configuration Example
Let's walk through a complete example of configuring a network interface with the ip command. Suppose you want to configure eth0 with the following settings:
- IP Address: 11.8.10.50
- Subnet Mask: 255.255.255.0 (/24)
- Default Gateway: 11.8.10.1
- DNS Server: 8.8.8.8
Here's how to accomplish this:
# Bring up the interface
ip link set eth0 up
# Assign the IP address
ip addr add 11.8.10.50/24 dev eth0
# Add the default gateway
ip route add default via 11.8.10.1
# Verify the configuration
ip addr show
ip route show
After executing these commands, your system will have the network configuration applied. Note that these settings are temporary and will be lost after a reboot. To make them permanent, you need to configure them in the appropriate network configuration files for your Linux distribution.
Troubleshooting Network Issues
The ip command is invaluable for troubleshooting network problems. Here are some diagnostic approaches:
- Use
ip link showto verify interface status and detect hardware issues - Use
ip addr showto confirm IP address configuration - Use
ip route showto verify routing tables and gateways - Use
ip neigh showto check ARP cache and detect duplicate IP addresses
If you're experiencing connectivity issues with an address like 11.So naturally, 8. Even so, 10. x, these commands help identify whether the problem is at the physical layer, configuration layer, or routing layer.
Frequently Asked Questions
What is the difference between ip addr and ifconfig?
The ip command is the modern replacement for ifconfig. On top of that, while ifconfig works on older systems, the ip command offers more features including better IPv6 support, more detailed output, and active development. Most Linux distributions have deprecated ifconfig in favor of ip.
How do I make ip command changes persistent?
Changes made with the ip command are temporary by default. To make them persistent, you need to edit the network configuration files in your Linux distribution. On RHEL/CentOS, edit /etc/sysconfig/network-scripts/ifcfg-eth0. On Debian/Ubuntu, edit /etc/network/interfaces or use NetworkManager.
Can I use the ip command with IPv6?
Yes, the ip command fully supports IPv6. You can add IPv6 addresses using similar syntax: ip addr add fd00::50/64 dev eth0.
How do I flush all IP addresses from an interface?
Use the following command to remove all IP addresses from an interface:
ip addr flush dev eth0
This removes all IPv4 and IPv6 addresses from the specified interface.
What does the "dev" keyword mean in ip command syntax?
The "dev" keyword specifies the network device (interface) that the command applies to. Here's one way to look at it: ip addr add 11.8.10.50/24 dev eth0 adds the IP address to the eth0 interface.
Conclusion
The Linux ip command is an indispensable tool for anyone working with Linux networking. 50 to an interface, to complex routing configurations, the ip command provides a consistent and powerful interface for network management. So 10. From simple tasks like assigning an IP address like 11.On the flip side, 8. Unlike older tools, it actively supports modern networking features including IPv6, VLANs, and advanced routing policies.
By mastering the ip command, you gain the ability to configure network interfaces, manage routing tables, troubleshoot connectivity issues, and maintain solid network configurations on any Linux system. The commands and examples covered in this guide form the foundation for effective Linux network administration.
Remember that while command-line configurations are immediate and powerful, always document your changes and implement persistent configurations through your system's network management tools for production environments. The ip command gives you granular control over your Linux networking, making it essential knowledge for system administrators and Linux enthusiasts alike.
Latest Posts
Related Posts
You Might Want to Read
-
Which Statement Is Always True
Aug 08, 2026
-
Which Statement Is Always True According To Vsepr Theory
Aug 08, 2026
-
Which Statement Is Always True When Describing Sex Linked Inheritance
Aug 08, 2026
-
Which Statement Is An Accurate Description Of Genes
Aug 08, 2026
-
Which Statement Is An Example Of A Central Idea
Aug 08, 2026