Ping command and It’s uses

The PING command is perhaps the most used network command-line utility. PING is present in all versions of all operating systems with network support and is a simple and convenient means of polling a host by name or IP address.



To exchange service and diagnostic information on the network, a special ICMP (Internet Control Message Protocol) protocol is used. The ping command allows you to send a control message of type Echo Request (type is 8 and is indicated in the header of the ICMP message) to the addressed node and interpret the response received from it in a form convenient for analysis. The data field of the sent icmp packet usually contains the characters of the English alphabet. In response to such a request, the interrogated node must send an icmp packet with the same data that was received and the Echo Reply message type (the type code in the ICMP header is 0). If there is any problem while exchanging icmp messages, the ping utility will display information for its diagnosis.

Command line format:

ping [-t] [-a] [-n number] [-l size] [-f] [-i TTL] [-v TOS] [-r number] [-s number] [[- jNode list] | [-k list of Nodes]] [-w timeout] finalName

Parameters:

-t- Continuous packet sending. To complete and display statistics, use the keyboard shortcuts Ctrl + Break (display statistics and continued), and Ctrl + C (display statistics and completion).
-a - Determine addresses by hostnames.
-n number - The number of echo requests to send.
-l size - The size of the data field in bytes of the sent request.
-f - Set the flag prohibiting packet fragmentation.
-i TTL - Set the lifetime of the package (field "Time To Live").
-v TOS - Set the type of service (field "Type Of Service").
-r number - Record the route for the specified number of hops.
-s number - The time stamp for the specified number of transitions.
-j list of Nodes - Free route selection from the list of nodes.
-k Node list - Hard route selection from the list of nodes.
-w timeout - The maximum timeout for each response in milliseconds.

Examples of use:

ping google.com - an echo request to a node named google.com with default parameters - the number of packets is 4, the length of the data array = 32 bytes.

ping -6 google.com - ping of the google.com node using the Ipv6 protocol

ping -a 192.168.1.50 - ping with the determination of the name of the horse node at its address.

ping -s 192.168.0.1 computer - ping of the computer node from the source 192.168.0.1. Used when there are several network interfaces on the computer.

ping w 5000 google.com - ping with a wait timeout of 5 seconds (default - 4 seconds).

ping -n 5000 -l 1000 google.com - polling of the google.com node 5000 times, in packets with data of 1000 bytes in length. The permissible maximum data length is 65500.

ping -n 1 -l 3000 -f google.com - ping with the prohibition of packet fragmentation.

ping -n 1-r 3 google.com - send 1 echo request to the google.com node with the display of the first 3 transitions along the route.

ping -i 5 google.com - ping indicating the lifetime TTL = 5. If more destinations are required to reach the end node, the router that interrupted the delivery will reply with the message “Exceeded the lifetime (TTL) during packet transmission.”

Using Ping Online

If you are looking an online version of ping command you can visit Ping Test. Pingtets.net allows you to ping any ip or hosting name online and displaysping result in statndard format.

How to enable disable firewall in Ubuntu

Ubuntu comes with a firewall configuration tool called UFW (Uncomplicated firewall). UFW is a convenient interface for managing firewall rules iptables, and its main goal is to simplify the management of firewall rules or, as the name implies, not complicate. It is highly recommended that you leave the firewall turned on. However, in some situations, such as testing, you may need to stop or disable firewall.



In this article, we will show you how to enable/ disable the UFW firewall. Before starting make sure you are logged in as a user with privileges sudo.

Checking the status of the firewall

To view the current status of the UFW firewall, use the ufw status command:
sudo ufw status
UFW firewall is disabled by default. If you have never activated UFW before, the output will show status as Inactive , Otherwise, if the firewall is turned on, you will see Active

Disabling Firewall

If you disable the firewall due to connectivity issues or have problems configuring the firewall, check out our guide on how to configure the firewall with UFW on Ubuntu. To disable the UFW firewall on your system Ubuntu use the ufw disable command:
sudo ufw disable
The output will look like this:
Firewall stopped and disabled on system startup
The above command will stop and disable the firewall, but will not remove the firewall rules. The next time you turn on the firewall, the same rules will be loaded.

Reset Firewall Rules

If you want to disable the firewall and remove all firewall rules, use the ufw reset command:
sudo ufw reset

Enabling the Firewall

Before turning on the firewall, make sure that the SSH port is open for connection.
To enable the firewall, run:
sudo ufw enable
Most UFW commands are intuitive and easy to remember. For example, ufw status shows the status of the firewall, and ufw disable disables the firewall.