Thanks to the articles that MSX passed me yesterday through a comment, I learned a little more about the command IP and the differences it has with ifconfig.
That is why I write this article, first to have a Spanish translation of the Original article in English, and second, to serve as a memo in case I need it.
Due to the width of the article, some values in the table will be "cut", but they are in a single line
Let's see the comparison then:
Action | ifconfig | IP |
---|---|---|
Show network devices and their settings | #ifconfig | $ip addrshow $ip link show |
Activate network interface | # ifconfig eth0 up | # ip link set eth0 up |
Disable network interface | # ifconfig eth0 down | # ip link set eth0 down |
Set IP address | # ifconfig eth0 192.168.1.1 | # ip address add 192.168.1.1 dev eth0 |
Delete IP address | # ip address of the 192.168.1.1 dev eth0 | |
Add virtual "interface" or aliases | # ifconfig eth0: 1 10.0.0.1/8 | # ip addr add 10.0.0.1/8 dev eth0 label eth0: 1 |
Add entry in an ARP table | # arp -i eth0 -s 192.168.0.1 00: 11: 22: 33: 44: 55 | # ip neigh add 192.168.0.1 lladdr 00: 11: 22: 33: 44: 55 nud permanent dev eth0 |
Change an ARP device to off | # ifconfig -arp eth0 | # ip link set dev eth0 arp off |
And this is all, or at least the most important thing for me.
They can tell me what they want, that IP is more powerful and that ifconfig It is obsolete, but you cannot deny that now with IP you have to write many more parameters.
Very handy cheat sheet! Thank you.
I was forgetting, the iproute2 commands almost all have a shortened correlation, for example 'ip addr show' can be summarized with an 'ip a', etc.
It's worth investigating because when you wear them all day the least you want to do is write, write, write, write, write, write, write!
[yaoming] I only need the first 3 commands [/ yaoming]
Jajaja true!!! also the "ip route show" does not show the output with tabs like "route -n" and makes it more difficult to read.
Excellent contribution, other commands for the list
And what advantages does it have over ifconfig? apart from having to write more, of course xD
Good question…. for now exercise memory learning more! 😛
Well, for now if you look at the table I put above, you can see something that has an IP that does not have IFCONFIG. 😉
Thanks for the contribution 🙂 and I ask, why would one want to delete an IP? I say what would be better said in what case
It is simple. Let's say I use one IP in one range and another IP in the other. Now the utility would serve me if I wanted to eliminate one of the IPs, so that the PCs in that range would not see me. But answering your question with another, why not? 😉
And couldn't you remove an IP with ifconfig by taking down the interface and lifting it up again?
For example: we have the IP xxx.xxx.xxx.xxx in the wlan1 interface and we want to remove it.
ifconfig wlan1 down && ifconfig wlan1 up
That's what I thought, you remove the interface and period, there is no IP anymore.
The same is an interface without IP, that a disconnected interface.
Sure, you can also kill a fly with a shotgun.
You never worked with networks and you used a GNU + Linux machine as a router with Quagga right?
There are many scenarios outside your bedroom where it is necessary to continually upload and download IPs without flipping the network interface and leaving other users offline.
Very good that table to keep as a reference.
IP does seem to be more complicated than Ifconfig, but I have a question. What makes IP better than Ifconfig besides being more modern and having a couple more options?
The new functions that iproute2 brings are insignificant (all, not only those shown here), to the point that they could well save the rehash and include them in net-tools by adding a .0001
By the way with "ifconfig eth0 0.0.0.0" the IP address is removed
Thanks for the tip 😉
Introduction
Iproute2 is a collection of utilities for controlling TCP / IP networking and traffic control in Linux. It is currently maintained by Stephen Hemminger. The original author, Alexey Kuznetsov, is well known for the QoS implementation in the Linux kernel.
Most network configuration manuals still refer to ifconfig and route as the primary network configuration tools, but ifconfig is known to behave inadequately in modern network environments. They should be deprecated, but most distros still include them. Most network configuration systems make use of ifconfig and thus provide a limited feature set. The / etc / net project aims to support most modern network technologies, as it doesn't use ifconfig and allows a system administrator to make use of all iproute2 features, including traffic control »
http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
Japa: http://www.jaredlog.com/?p=928
+1 Good data, now it is clear to me.
Good data, although Arch is not used eth0, but values like enp0s3.
Uhhh ???
It is correct, although it can be configured to be eth0 or wlan0. I wonder what the raison d'être is to leave the enp # s # (or wlp # s #) style? Also with your predilection for ip when we are all familiar with ifconfig, why?
In the end you get used to it, in Archlinux as it does not have ifconfig I decided to learn this because at some point many distros will mark it as obsolete. Very good post.
I want to buy Linux for my computer
Saulo, if you want to try Linux you don't need to buy it (although you can). If your patience can't wait to use it, I'll tell you that most versions (distributions) of Linux have a free download link (free), which you can burn to a disk or mount on a USB memory for later installation on your computer. I recommend you to see guides on YouTube or in some blogs about the installation, it is not difficult.
Interesting, ifconfig is still easier to learn.