Difference between revisions of "Ping"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 1: Line 1:
Ping allows you to see if a computer is reachable via the network and to measure the network latency.
+
Ping allows you to see if a computer is reachable via the network and to measure the network latency. You stop it with CTRL_C.
  
 
'''Example:'''
 
'''Example:'''

Revision as of 18:53, 17 April 2009

Ping allows you to see if a computer is reachable via the network and to measure the network latency. You stop it with CTRL_C.

Example:

# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.19 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.417 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.382 ms

In this example we have a latency of below 1 milisecond and 192.168.0.1 is up

Broadcast ping

Here is how you do a broadcast ping with SUSE, it should work same or similar with every distribution. Log in as root user to perform the following tasks.

  • Stop the firewall
rcSuSEfirewall2 stop
  • Allow for broadcast pings
echo "0" >/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
  • Verify broadcast pings are allowed
sysctl net.ipv4.icmp_echo_ignore_broadcasts
net.ipv4.icmp_echo_ignore_broadcasts = 0
  • Find out the broadcast address of the network where you want to broadcast
ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:1C:F0:BB:06:C8
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:f0ff:febb:6c8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:315742 errors:0 dropped:0 overruns:0 frame:0
          TX packets:297176 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:195071533 (186.0 Mb)  TX bytes:41401952 (39.4 Mb)
          Interrupt:21 Base address:0x4000
  • ping
# ping -b 192.168.0.255
WARNING: pinging broadcast address
PING 192.168.0.255 (192.168.0.255) 56(84) bytes of data.
64 bytes from 192.168.0.5: icmp_seq=1 ttl=64 time=0.039 ms 

See also