How to make use of the IP command in Ubuntu

2

IP (Internet Protocol) acts as a singular identifier deal with over the community. This distinctive identifier is helping to ship knowledge amongst other units at the community. Internet products and services additionally paintings in response to IP and differentiate between a number of units similar to routers, computer systems, and many others. IP addresses consist of 4 separated integer strings, the variability of every string might range from 0 to 255 (0.0.0.0 to 255.255.255.255).

IP instructions in Ubuntu can be utilized for a number of functions inside of a community, similar to to assign, delete, arrange an deal with, or configure parameters for community interfaces. One can say that it’s an alternative choice to the ifconfig command of Ubuntu, however it’s moderately helpful and frequently used at the moment since the ifconfig command has now not been maintained for see you later and, subsequently, has been deprecated. This information will likely be interested in using the IP command in Ubuntu:

let’s get started with the syntax of the IP command:

Syntax:

ip [ OPTIONS ] OBJECT lend a hand

Before digging into this instructional; execute the next command for your terminal to get the instructions and arguments associated with IP:

How to test IP addresses of all community interfaces

You can test the IP addresses of the community interfaces with the assistance of the command given beneath. For this, we can use “address” OBJECT of the IP command:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398612 937 How to use the IP command in Ubuntu

You gets the similar output for those who use “addr” as an alternative of “address” within the above command.

It is to note that the IP instructions can be utilized with quite a lot of choices to get the output of the precise command within the required way.

For example, if you wish to get the IP addresses of all community interfaces in a colourful way, it’s important to use the “-c” choice as proven beneath:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398612 974 How to use the IP command in Ubuntu

How to get best IPv4 or IPv6 addresses of community interfaces

You can get best IPv4 or IPv6 addresses via the usage of the command mentioned beneath; you’ll have to use the “-4” choice for IPv4 and the “-6” choice for IPv6.

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398613 78 How to use the IP command in Ubuntu

Or:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398613 565 How to use the IP command in Ubuntu

How to get the hyperlink layer knowledge of community interfaces

The information hyperlink layer acts on the lowest place within the TCP/IP, and it defines the strategies within a neighborhood community hyperlink on which hosts be in contact. IP command can be utilized to fetch the hyperlink layer knowledge of all community interfaces or one as according to your requirement. You have to make use of the “link” key phrase as proven beneath:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398613 141 How to use the IP command in Ubuntu

The above command has displayed the information hyperlink layer knowledge of all community interfaces; additionally, if you wish to get for a particular interface, it’s important to specify the title of that interface as proven beneath:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398613 923 How to use the IP command in Ubuntu

Furthermore, you’ll be able to get the statistics of the hyperlink layer via the usage of the “-s” choice of the IP command as proven beneath:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398614 493 How to use the IP command in Ubuntu

How to assign an IP deal with to an interface the usage of the IP command

You can use the IP command to assign a particular ip deal with to the community interface; the command given beneath will assign IP deal with (192.168.10.1/10) to interface “lo” (“lo” refers back to the deal with that the pc makes use of to be in contact with itself ): it’s spotted that the next command received’t execute till sudo permissions aren’t granted:

$ sudo ip deal with upload 192.168.10.1/10 dev lo

To understand the adjustments, you will have to run the command:

Or:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398614 975 How to use the IP command in Ubuntu

How to take away an IP deal with of a community interface the usage of the IP command

The IP command can be used to take away the IP deal with of a community interface. Let’s say we need to take away IP deal with “192.168.10.1/10” of interface “lo”, it’s important to use the “del” key phrase with IP command as proven beneath:

$ sudo ip addr del 192.168.10.1/10 dev lo

You will have to get the IP addresses after the above command to test that IP deal with has been got rid of or now not:

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398614 200 How to use the IP command in Ubuntu

How to permit or disable community interface the usage of IP command

With the assistance of the IP command, one can permit or disable any of the community interfaces to be had:

For example, to disable “enp0s3”, use the next command:

$ sudo ip hyperlink set enp0s3 down

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398614 29 How to use the IP command in Ubuntu

Or to permit the “enp0s3” community interface, execute the command mentioned beneath, and you’ll understand that the state of “enp0s3” has been revived once more:

$ sudo ip hyperlink set enp0s3 up

Text Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398614 483 How to use the IP command in Ubuntu

How to watch Network Interfaces the usage of IP command

One of the most important advantages of the IP command is to watch the state, routes, and addresses of the units. Execute the next command to watch your community; it’ll stay on tracking till you destroy the consultation via getting out of the command (Ctrl+c):

A picture containing text, screenshot Description automatically generated How to make use of the IP command in Ubuntu How to make use of the IP command in Ubuntu 1631398614 274 How to use the IP command in Ubuntu

The “STALE” and “REACHABLE” constitute the supply of Network Interfaces; each are legitimate, however the “STALE” state is unreachable. However, “PROBE” lies in between reachable and unreachable states; the “PROBE” signifies that the interface would quickly be reachable.

Conclusion

The IP command in Ubuntu is a well known command for community dealing with. Starting from the advent of IP to the detailed use of this command in Ubuntu, it may be used to accomplish a number of network-related duties similar to tracking the community units, including/taking out the IP deal with of interfaces. Earlier, the ifconfig command was once getting used, however because of loss of repairs, it’s been deprecated, and subsequently it’s changed via an IP command. I’m hoping this text could be really useful for you, and if you need a extra detailed information about instructions associated with networking, you will have to discuss with linuxhint.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More