Changing Interface State Using IP Command

Example 1: Bringing an Interface Up

To bring an interface up (activate it), you can use the `ip link` command with the `set` action. For example:

sudo ip link set eth0 up

This command brings the `eth0` interface up, enabling it to send and receive network traffic.

Example 2: Changing MTU (Maximum Transmission Unit)

To change the MTU (maximum transmission unit) of a network interface, you can use the `ip link` command with the `set` action and the `mtu` parameter. For instance:

sudo ip link set eth0 mtu 1500

This command sets the MTU of the `eth0` interface to `1500` bytes.

ip Command in Linux with Examples

The ip command in Linux is a powerful utility for network configuration and management. It allows users to interact with various networking components such as network interfaces, routing tables, addresses, and more. In this guide, we will delve into the ip command, covering each aspect with examples, code, and detailed explanations.

Similar Reads

Introduction to the IP Command in Linux

The ip command is part of the iproute2 package and serves as a versatile replacement for older networking tools like `ifconfig` and `route`. It provides a unified interface for configuring and managing network settings in modern Linux distributions....

Basic Usage and Syntax of IP Command

The basic syntax of the ip command is as follows:...

Displaying Network Interfaces and IP Addresses Using IP Command

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

Configuring Network Interfaces Using IP Command

To configure a network interface, you can use the `ip link` command followed by the action (e.g., `set`, `add`, `delete`)....

Managing Routing Tables Using IP Command

Example 1: Deleting a Route...

Changing Interface State Using IP Command

Example 1: Bringing an Interface Up...

Displaying Detailed Interface Statistics Using IP Command

Example 1: Monitoring Interface Traffic...

Options available in the IP command in Linux

Options Description Example Usage address Show all IP addresses associated with all network devices. ip address Show information related to a specific interface. ip address show (interface) link Display link layer information, including characteristics of link layer devices currently available. ip link Show statistics of various network interfaces. ip -s link Show statistics of a specific network interface. ip -s link show (interface) route Display routing table, showing the route packets your network will take. ip route add Assign an IP address to an interface. ip a add (ip_address) dev (interface) del Delete an assigned IP address from an interface. ip a del (ip_address) dev (interface) up Enable a network interface. ip link set (interface) up down Disable a network interface. ip link set (interface) down monitor Monitor and display the state of devices, addresses, and routes continuously. ip monitor help Display help information about the `ip` command. ip help neighbour View MAC address of devices connected to the system. ip neighbour Delete an ARP entry. ip neighbour del (ip_address) dev (interface) Add an ARP entry. ip neighbour add (ip_address) dev (interface)...

Conclusion

The `ip` command in Linux is a powerful tool that is used for performing administrative tasks. We can say that this command is the improved version of the deprecated `ifconfig` command. As we discussed, this command can be used to manipulate devices, routing and tunnels. This `ip` command can also monitor the state of devices, routes and addresses. Overall, we can say that this command is a versatile tool that can be helpful network administrators manage their networks more efficiently....