ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

Home » Linux

Explain ping in Linux - How to ping an IP address in Linux?

Learn: What is ping command in Linux, how it can be used to ping an IP address in Linux Operating System? Options of ping command.

Ping stands for Packet Internet Groper. This is a Linux terminal command, which is used to check network connectivity.

It will work for all networks like: LAN, MAN, WAN etc.

Ping command uses ICMP protocol to check particular node is reachable or not.

Syntax:

$ping  -<options>  <hostname>

Example:

$ping  192.168.10.105
or
$ping  www.google.com

If network is reachable, then output of ping command:

linux~# ping 192.168.10.105 
PING 192.168.10.105 (192.168.10.105 ) 56(84) bytes of data. 
64 bytes from 192.168.10.105 : icmp_req=1 ttl=64 time=0.477 ms 
64 bytes from 192.168.10.105 : icmp_req=2 ttl=64 time=0.157 ms 
64 bytes from 192.168.10.105 : icmp_req=3 ttl=64 time=0.284 ms 
64 bytes from 192.168.10.105 : icmp_req=4 ttl=64 time=0.285 ms 
64 bytes from 192.168.10.105 : icmp_req=5 ttl=64 time=0.288 ms 

If network is not reachable, then output of ping command:

linux~# ping 192.168.10.105 
PING 192.168.10.105 (192.168.10.105) 56(84) bytes of data. 
From 192.168.10.17 icmp_seq=1 Destination Host Unreachable 
From 192.168.10.17 icmp_seq=2 Destination Host Unreachable 
From 192.168.10.17 icmp_seq=3 Destination Host Unreachable

Options of Linux - ping command

These are some of the important options, which is used with ping command:

  1. -d
    This option is used to set socket option SO_DEBUG
  2. -l
    When source route was lost then we use this option in our IP header to send the packet to the given host.
  3. -n
    It shows network addresses as numbers. Normally when we use ping command, it displays addresses as host names.
  4. -I (interval)
    It specifies the interval between two transmissions. By default, it is one second.
ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.