25 Popular Linux IP Command Examples

IP Command Techhyme

In the realm of Linux networking, the `ip` command has emerged as a versatile and powerful tool, replacing the aging `ifconfig` and `route` commands. Part of the `iproute2` package, the `ip` command offers advanced features and flexibility for managing network-related tasks on Linux systems.

In this article, we will explore 25 popular examples of using the `ip` command to check and manage various aspects of IP addresses and network interfaces.

1. Check Linux IP Command Version

To verify the version of the `ip` command installed on your system, use the following command:

ip -V

This will display information about the version, indicating that the `ip` utility is part of the `iproute2` package.

IP Command Techhyme

2. Check Linux IP Address

To view information about all network interfaces and their IP addresses, use the following command:

ip addr show

This command provides details such as IPV4 and IPV6 addresses, MAC addresses, broadcast addresses, MTU size, and more.

IP Command Techhyme

3. Check IP Rule List

To list all IP rules on your system, use the following command:

ip rule list

This command displays the IP rule list, providing insights into the routing decisions made by the system.

IP Command Techhyme

4. Check IP Link Status

To check the status of connected network interfaces, use the following command:

ip link show

This command provides information about the status of each network interface, including whether it is up or down.

IP Command Techhyme

5. Check Link Stats using Linux ip command

To view packet statistics for all connected network interfaces, use the following command:

ip -s link

This command shows detailed statistics related to packet transmission and reception on each network interface.

IP Command Techhyme

6. Check Routing Table using Linux ip command

To display the current routing table, use the following command:

ip route show

This command reveals the routing table, illustrating how network traffic is directed.

IP Command Techhyme

7. Display State of Devices Continuously using Linux ip command

For continuous monitoring of device states, use the following command:

ip monitor

This command provides real-time updates on the state of network devices, facilitating troubleshooting.

IP Command Techhyme

8. Display MAC Addresses of the Connected System

To view MAC addresses of connected systems, use the following command:

ip neighbor

This command displays the ARP cache, showing MAC addresses associated with IP addresses.

9. Assign an IP Address to a Network Interface

To assign an IP address to a network interface, use the following command:

ip addr add 192.168.0.100 dev enp0s3

This example assigns the IPv4 address 192.168.0.100 to the interface `enp0s3`.

10. Enable Multicast Feature on Network Interface

To enable the multicast feature on a network interface, use the following command:

ip link set enp0s3 multicast on

This example enables multicast on the `enp0s3` network interface.

11. Disable Multicast Feature on Network Interface

To disable the multicast feature on a network interface, use the following command:

ip link set enp0s3 multicast off

This example turns off multicast on the `enp0s3` interface.

12. Change MTU Size using Linux ip command

To change the Maximum Transmission Unit (MTU) size for a network interface, use the following command:

ip link set enp0s3 mtu 1200

This example sets the MTU size for `enp0s3` to 1200.

13. Change Packet Queue Length using Linux ip command

To change the packet queue length for a network interface, use the following command:

ip link set enp0s3 txqueuelen 900

This example sets the packet queue length for `enp0s3` to 900.

14. Enable ARP Feature on the Network Interface using Linux ip command

To enable the ARP feature on a network interface, use the following command:

ip link set enp0s3 arp on

This example enables ARP on the `enp0s3` interface.

15. Disable ARP Feature on the Network Interface

To disable the ARP feature on a network interface, use the following command:

ip link set enp0s3 arp off

This example disables ARP on the `enp0s3` interface.

16. Rename Your Network Interface Using Linux ip command

To rename a network interface, use the following command:

ip link set enp0s3 name eth0

This example renames the network interface `enp0s3` to `eth0`.

17. Check the Rule in Multicast Routing Policy Database

To check the rules in the multicast routing policy database, use the following command:

ip mrule show

This command displays the rules governing multicast routing.

IP Command Techhyme

18. Check the Neighbor Table Parameters and Statistics

To check neighbor table parameters and statistics for a specific network interface, use the following command:

ip ntable show dev enp0s3

This command provides information about the neighbor table associated with `enp0s3`.

19. Change the Number of Packets Queued

To change the number of packets queued for a specific network interface, use the following commands:

ip ntable change name arp_cache queue 35 dev enp0s3
ip ntable show dev enp0s3

This example adjusts the ARP cache queue parameter for `enp0s3`.

20. Create a Tunnel Using Linux ip command

To create a tunnel in Linux, use the following command:

ip tunnel add tunnel0 mode sit remote 192.168.0.110

This example creates a tunnel named `tunnel0` with the specified configuration.

21. Bring Up Tunnel in Linux

To bring up a previously created tunnel, use the following command:

ip link set tunnel0 up

This example brings up the `tunnel0` tunnel.

22. Bring Down Tunnel in Linux

To bring down a tunnel, use the following command:

ip link set tunnel0 down

This example brings down the `tunnel0` tunnel.

23. Check Tunnel Status using Linux ip command

To check the status of a tunnel, use the following command:

ip link show dev tunnel0

This command provides information about the status of the `tunnel0` tunnel.

24. Delete a Tunnel using Linux ip command

To delete a tunnel, use the following command:

ip tunnel del tunnel0

This example deletes the `tunnel0` tunnel.

25. Check Other ip command options

To explore additional options and commands available with the `ip` command, use the following command:

ip --help

This command displays a help message, showcasing various options and usages of the `ip` command.

IP Command Techhyme

In conclusion, the `ip` command is a comprehensive tool for managing network-related tasks on Linux systems. These examples cover a range of functionalities, from basic network interface information to advanced features like tunnel creation and multicast settings. Understanding and mastering the `ip` command can significantly enhance your ability to configure and troubleshoot networking issues on Linux.

You may also like:

Related Posts

Leave a Reply