Write a network diagnostics bash script that does the following: Finds the IPv4 address of the default gateway on your
This problem has been solved!
Do you need an answer to a question different from the above? Ask your question!
Question:
Write a network diagnostics bash script that does the following:
- Finds the IPv4 address of the default gateway on your machine (one way to get this is the 'default' entry, also shown as 0.0.0.0, in the output of 'ip route') and runs a ping (with a count of 5 pings) to it.
- Runs another count of 5 pings to the site example.com.
- Outputs a 1-line summary of interfaces on your machine, not including the loopback address (lo).
- Outputs a 1-line summary of how many TCP ports are open (in state LISTEN)
The output of your script should look exactly like this (different numbers are OK). For the ping times output, use the 'avg' number from the ping command. This is the average that is calculated for you -- no need to calculate it in your script.
Ping time to default gateway: 0.348 ms Ping time to example.com: 24.807 ms Interface count: 2, and 2/2 are up There are 7 TCP ports in the LISTEN state
Related Book For
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord
View Solution
Create a free account to access the answer
Cannot find your solution?
Post a FREE question now and get an answer within minutes.
* Average response time.
Question Details
Chapter #
2
Section: Discussion Question
Problem: 61
Posted Date: September 15, 2023 05:10:33