How to use IP Command for Beginners — LinuxTechLab

Most of the Linux Admins are familiar with the ‘ifconfig’ tool for managing the network connections & interfaces but there are other commands as well that can be used to manage network connections and one of those CLI commands utility is ‘ip command’. IP command is rather a new introduction to Linux but still, it has been around for quite some time. It is one of the most important commands & we as Linux enthusiasts or System Admin should know how to use it.

In this tutorial, we will learn about IP command with the help of some examples. If also wants to know about ‘ifconfig command’, you can also refer to our tutorial here.

Recommended Read: SpeedTest-CLI: Run network speedtest on Linux CLI Also Read: Configure IP address (Networking) in RHEL/CentOS 7

Now let’s start this tutorial,

IP Command examples

1- List all network interfaces & related information

To get the list all network interfaces available on our system & information like IP address, gateway etc for these network interfaces, then the command is,

Alternatively, you can also use,

2- List information for a single interface

To only get information for a single interface, we use the following command,

Where ‘enp0s3’ is the name of the network interface.

3- Bring UP /enable a network interface

To enable a network interface that is currently disabled, execute the following command from the terminal,

4- Bring DOWN /disable a network interface

To disable a currently enabled network interface, we can use the following command,

5- Add a new IP address to an interface

To add a new IP address to a network interface, command to be used would be,

# ip addr address add 10.10.1.10/24 dev enp0s4

or we can also use the following command,

# ip a add 10.10.1.10/24 dev enp0s4

6- Remove an IP address from an interface

Command to remove an IP address from a network interface is similar to mentioned above. The exact command is,

# ip addr address del 10.10.1.10/24 dev enp0s4

Alternatively, you can also use,

# ip a del 10.10.1.10/24 dev enp0s4

7- Add multiple IP addresses to a single interface

Similar to how we added a single IP address to an interface, we can also assign multiple IP addresses to single network interface as well,

# ip a add 10.10.1.10/24 dev enp0s4

# ip a add 10.10.1.11/24 dev enp0s4

# ip a add 10.10.1.12/24 dev enp0s4

8- Updating the routing table of the system

We can also update a static route on our system, or can also change the default gateway of our network interfaces or we can even reject traffic to a network range using the following command,

We have a detailed tutorial for , please read this tutorial for detailed instructions.

9- Monitoring the network interfaces

IP command also provides us with a utility to continuously monitor all the network interfaces, IP address & their routes etc. Command is

10- Getting Help

We have only discussed some of the most used ip command options here & there are plenty of other options as well. & like with any other command, we can get a complete list of options that we can use with the following command,

With this, we end this tutorial on how to use IP commands for beginners. Please do send in any questions or queries using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Linux TechLab is thankful for your continued support.

Originally published at https://linuxtechlab.com on April 16, 2020.

--

--

--

http://linuxtechlab.com is a beginner friendly website where you can learn Linux Tips & tricks,Scripting, also has lots of tutorials aimed at making Linux easy.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What Makes .Net The First Choice For Web and Application Development?

Learn Numpy in 5 Minutes a Day or Less Part One The Basics

[LeetCode]Delete Node in a Linked List

Finding a job after a coding bootcamp — Creating opportunities

Xmodmap:Change KeyBoard (error and auto set up)

Coobjc Open Sourcced: Alibaba’s Open Source Coroutine Framework for iOS Developers

Ruby on Rails — Getting to grips with the basics

16-bit Sprite Animation in CSS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
LinuxTechLab

LinuxTechLab

http://linuxtechlab.com is a beginner friendly website where you can learn Linux Tips & tricks,Scripting, also has lots of tutorials aimed at making Linux easy.

More from Medium

DevOps- Get Started with Shell Scripting

✍LET’S GETTING STARTED WITH LINUX :

Linux Basic Commands: Part 2

Top 5 Linux Distro for Ethical Hacking & Pentesting.

@Linux