If you ever have connectivity problems, you need to be able to analyze network configuration.
And to do so, there is the IP command.
This command can be used to manage all aspects of IP networking.
It works with many commands.
It's like a command shell in which you can use subcommands.
And it's very rich.
And there's a lot of functionality.
We are just going to focus on the basic functionality here.
The IP command replaces the legacy IFConfig tool.
Some people still like to use the IFConfig tool.
Don't use it anymore because you will seriously miss information.
And that is because in 1995, the Linux network stack has been updated.
And since then, IFConfig has become deprecated and later obsolete.
So you shouldn't use it anymore if you want to see what is going on.
The best command to figure out what's going on is IPADDR or just use IPA, which gives
you the same result.
That is how you manage address properties.
Just IPA or IP address show will show you the configuration.
You can also use commands like IPADDR add dev ens 33 and add a second IP address.
The IP link command is what you can use to show link properties.
And IP minus S link is giving a nice overview of current properties.
And then we have IP route for managing the routing table.
IP route show is an important command that shows the current situation.
And if this current situation is off and you want to test in runtime before you make it
persistent, you use IP route add default via whatever.
Now do realize that IP command is good for analyzing.
You can even do some settings.
But anything you do with the IP command is not going to be saved persistently.
In order to save persistently, you need network manager, which is covered in the next video.
But before doing so, I'd like to demonstrate what you can do with the IP command.
So let me start with a brief IPA, which is showing the current configuration.
So how about IPADDR add?
That's what you can use to add an IP address.
I'm using dev for device following the device name, which in my case is ENS160.
And then I'm going to add a secondary IP address.
Sometimes it is required.
And there we go.
This should be doing it.
And IPA is showing, look here, showing the secondary IP address.
Again, this is a runtime only, not persistent.
If I reboot, I will lose the secondary IP address configuration.
You have already seen IP link for generic link properties.
Some people like IP minus S link, which is giving current statistics about link.
Now, this is particularly for people that have worked at IFConfig a lot and who mentioned
that in IFConfig, it's so convenient that you can see the number of bytes that has been
sent and written and the number of errors that is going on.
So RX is for received and TX is for transmitted.
And you can see errors.
And you can see drop.
And if you have many dropped packets, that means that you need to do some troubleshooting
on your network.
The other command that you need to know about is IP route.
IP route, without anything, will show you a routing table.
And here, we can see that the routing table has default route via 192.168.29.2.
Well, that happens to be functional.
But if I would use IP route del for delete default, then IP route doesn't show a default
route anymore.
And then if I would use ping google.com, I'm getting a network is unreachable.
What can we do about it?
Well, a smart answer would be, well, just restart your network interface and DHCP will
grant the information again automatically.
But if you don't have DHCP, you can use IP route at default via.
And then you need to know the IP address of your default route.
And I happen to know that.
And now my default route is back.
And I can ping the internet again.
And that's how you can manage runtime information using the IP command.