Claim your Biolink Click Here
2 like 0 dislike
33 views
in Education & Reference by (740 points) | 33 views

1 Answer

0 like 0 dislike

Here are some common use cases for the ip command.

To show the IP addresses assigned to an interface on your server:

[[email protected] ~]# ip address show 

To assign an IP to an interface, for example, enps03:

[[email protected] ~]# ip address add 192.168.1.254/24 dev enps03

To delete an IP on an interface:

[[email protected] ~]# ip address del 192.168.1.254/24 dev enps03

Alter the status of the interface by bringing the interface eth0 online:

[[email protected] ~]# ip link set eth0 up

Alter the status of the interface by bringing the interface eth0 offline:

[[email protected] ~]# ip link set eth0 down

Alter the status of the interface by changing the MTU of eth0:

[[email protected] ~]# ip link set eth0 mtu 9000

Alter the status of the interface by enabling promiscuous mode for eth0:

[[email protected] ~]# ip link set eth0 promisc on

Add a default route (for all addresses) via the local gateway 192.168.1.254 that can be reached on device eth0:

[[email protected] ~]# ip route add default via 192.168.1.254 dev eth0

Add a route to 192.168.1.0/24 via the gateway at 192.168.1.254:

[[email protected] ~]# ip route add 192.168.1.0/24 via 192.168.1.254

Add a route to 192.168.1.0/24 that can be reached on device eth0:

[[email protected] ~]# ip route add 192.168.1.0/24 dev eth0

Delete the route for 192.168.1.0/24 via the gateway at 192.168.1.254:

[[email protected] ~]# ip route delete 192.168.1.0/24 via 192.168.1.254

Display the route taken for IP 10.10.1.4:

[[email protected] ~]# ip route get 10.10.1.4

ifconfig
The ifconfig command was/is a staple in many sysadmin's tool belt for configuring and troubleshooting networks. It has since been replaced by the ip command discussed above. However, if you would like more information on it, check out our previously published article here.

mtr
MTR (Matt's traceroute) is a program with a command-line interface that serves as a network diagnostic and troubleshooting tool. This command combines the functionality of the ping and traceroute commands. Just like a traceroute, the mtr command will show the route from a computer to a specified host. mtr provides a lot of statistics about each hop, such as response time and percentage. With the mtr command, you will get more information about the route and be able to see problematic devices along the way. If you see a sudden increase in response time or packet loss, then obviously, there is a bad link somewhere.

The syntax of the command is as follows:

mtr hostname/IP

Let's look at some common use cases.

The basic mtr command shows you the statistics, including each hop (hostnames) with time and loss%:

[[email protected] ~]# mtr google.com

Show numeric IP addresses (if you use -g, you will get IP addresses (numbers) instead of hostnames):

[[email protected] ~]# mtr -g google.com

Show the numeric IP addresses and hostnames, too:

[[email protected] ~]# mtr -b google.com

Set the number of pings that you want to send:

[[email protected] ~]# mtr -c 10 google.com

Get a report of the mtr command result:

[[email protected] ~]# mtr -r -c 10 google.com > mtr-command-google-output

or:

[[email protected] ~]# mtr -rw -c 10 google.com > mtr-command-google-output

Force the use of the TCP instead of the ICMP:

[[email protected] ~]# mtr –tcp google.com

Force the use of the UDP instead of the ICMP:

[[email protected] ~]# mtr –udp google.com

Set the maximum amount of hops:

[[email protected] ~]# mtr -m 35 216.58.223.78

Define the packet size:

[[email protected] ~]# mtr -r -s 50 google.com

Print to CSV output:

[[email protected] ~]# mtr –csv google.com

Print to XML output:

[[email protected] ~]# mtr –xml google.com
by (840 points)

Related questions

0 like 0 dislike
1 answer
asked Nov 22, 2018 in Education & Reference by Neha (970 points) | 156 views
1 like 0 dislike
1 answer
2 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,260 questions
1,415 answers
567 comments
4,809 users