Ping stops when there is big packet loss
up vote
1
down vote
favorite
my first post here.
I made an script that provide reports of my network every 5 minutes. The script is simple and is working fine except when there is issues in my network. The script is running in Ubuntu Server 18.04.
My line for the Ping command is:
ping -w 300 192.168.1.216
The issue consist when I am having packet losses, ping stop immediately an doesn't finish the 300 seconds (5 minutes) run. I checked online and everywhere but I haven't been able to find a solution to make the ping keep running when there are lost packets. This is an example:
ping -w 300 192.168.1.216
PING 192.168.1.216 (192.168.1.216) 56(84) bytes of data.
64 bytes from 192.168.1.216: icmp_seq=1 ttl=128 time=2.29 ms
64 bytes from 192.168.1.216: icmp_seq=2 ttl=128 time=4.14 ms
64 bytes from 192.168.1.216: icmp_seq=3 ttl=128 time=17.9 ms
64 bytes from 192.168.1.216: icmp_seq=4 ttl=128 time=40.6 ms
64 bytes from 192.168.1.216: icmp_seq=5 ttl=128 time=38.6 ms
From 192.168.1.2 icmp_seq=30 Destination Host Unreachable
From 192.168.1.2 icmp_seq=31 Destination Host Unreachable
From 192.168.1.2 icmp_seq=32 Destination Host Unreachable
--- 192.168.1.216 ping statistics ---
33 packets transmitted, 5 received, +3 errors, 84% packet loss, time 32657ms
rtt min/avg/max/mdev = 2.295/20.738/40.659/16.379 ms, pipe 4
Thanks.
EDIT REASON: Add full script code.
Full script code:
Location="XXX"
host="192.168.6.1"
while true
do
result=$(ping -w 300 -q $host)
sendemail
-f "xxxx@gmail.com"
-u "XXX 5 Minutes Network Report"
-t "pingreport@gmail.com"
-s "smtp.gmail.com:587"
-o tls=yes
-xu "xxxx@gmail.com"
-xp "password"
-m "$result"
done
This is to check the status of our VPN. Like I said is a very simple script. I am using the ping -c 1 as suggested for an emergency one that will let us know if there is connectivity issues in the VPN as soon as possible.
networking 18.04
New contributor
add a comment |
up vote
1
down vote
favorite
my first post here.
I made an script that provide reports of my network every 5 minutes. The script is simple and is working fine except when there is issues in my network. The script is running in Ubuntu Server 18.04.
My line for the Ping command is:
ping -w 300 192.168.1.216
The issue consist when I am having packet losses, ping stop immediately an doesn't finish the 300 seconds (5 minutes) run. I checked online and everywhere but I haven't been able to find a solution to make the ping keep running when there are lost packets. This is an example:
ping -w 300 192.168.1.216
PING 192.168.1.216 (192.168.1.216) 56(84) bytes of data.
64 bytes from 192.168.1.216: icmp_seq=1 ttl=128 time=2.29 ms
64 bytes from 192.168.1.216: icmp_seq=2 ttl=128 time=4.14 ms
64 bytes from 192.168.1.216: icmp_seq=3 ttl=128 time=17.9 ms
64 bytes from 192.168.1.216: icmp_seq=4 ttl=128 time=40.6 ms
64 bytes from 192.168.1.216: icmp_seq=5 ttl=128 time=38.6 ms
From 192.168.1.2 icmp_seq=30 Destination Host Unreachable
From 192.168.1.2 icmp_seq=31 Destination Host Unreachable
From 192.168.1.2 icmp_seq=32 Destination Host Unreachable
--- 192.168.1.216 ping statistics ---
33 packets transmitted, 5 received, +3 errors, 84% packet loss, time 32657ms
rtt min/avg/max/mdev = 2.295/20.738/40.659/16.379 ms, pipe 4
Thanks.
EDIT REASON: Add full script code.
Full script code:
Location="XXX"
host="192.168.6.1"
while true
do
result=$(ping -w 300 -q $host)
sendemail
-f "xxxx@gmail.com"
-u "XXX 5 Minutes Network Report"
-t "pingreport@gmail.com"
-s "smtp.gmail.com:587"
-o tls=yes
-xu "xxxx@gmail.com"
-xp "password"
-m "$result"
done
This is to check the status of our VPN. Like I said is a very simple script. I am using the ping -c 1 as suggested for an emergency one that will let us know if there is connectivity issues in the VPN as soon as possible.
networking 18.04
New contributor
1
Welcome to Ask Ubuntu. I don't understand what you're trying to do, but the-w
appears to be doing what it should as theman ping
states "it waits either for deadline expire or until count probes are answered or for some error notification from network." - ie. it's stopping because last condition is reached as I understand your question. When I've had to do similar to you, I sent a singleping -c 1
& then processed according to error.codeerr1721=$?
in subsequent lines.
– guiverc
Dec 4 at 22:24
All that I need is to have a ping running for 300/3600/86400 seconds, that is why I used the -w. What I need is a way that ping doesn't stop when there are network errors when using the -w or another way to make sure it runs for the specific amount of time disregarding network errors, packet lost etc.
– Mr.Alvaro
Dec 4 at 22:33
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
my first post here.
I made an script that provide reports of my network every 5 minutes. The script is simple and is working fine except when there is issues in my network. The script is running in Ubuntu Server 18.04.
My line for the Ping command is:
ping -w 300 192.168.1.216
The issue consist when I am having packet losses, ping stop immediately an doesn't finish the 300 seconds (5 minutes) run. I checked online and everywhere but I haven't been able to find a solution to make the ping keep running when there are lost packets. This is an example:
ping -w 300 192.168.1.216
PING 192.168.1.216 (192.168.1.216) 56(84) bytes of data.
64 bytes from 192.168.1.216: icmp_seq=1 ttl=128 time=2.29 ms
64 bytes from 192.168.1.216: icmp_seq=2 ttl=128 time=4.14 ms
64 bytes from 192.168.1.216: icmp_seq=3 ttl=128 time=17.9 ms
64 bytes from 192.168.1.216: icmp_seq=4 ttl=128 time=40.6 ms
64 bytes from 192.168.1.216: icmp_seq=5 ttl=128 time=38.6 ms
From 192.168.1.2 icmp_seq=30 Destination Host Unreachable
From 192.168.1.2 icmp_seq=31 Destination Host Unreachable
From 192.168.1.2 icmp_seq=32 Destination Host Unreachable
--- 192.168.1.216 ping statistics ---
33 packets transmitted, 5 received, +3 errors, 84% packet loss, time 32657ms
rtt min/avg/max/mdev = 2.295/20.738/40.659/16.379 ms, pipe 4
Thanks.
EDIT REASON: Add full script code.
Full script code:
Location="XXX"
host="192.168.6.1"
while true
do
result=$(ping -w 300 -q $host)
sendemail
-f "xxxx@gmail.com"
-u "XXX 5 Minutes Network Report"
-t "pingreport@gmail.com"
-s "smtp.gmail.com:587"
-o tls=yes
-xu "xxxx@gmail.com"
-xp "password"
-m "$result"
done
This is to check the status of our VPN. Like I said is a very simple script. I am using the ping -c 1 as suggested for an emergency one that will let us know if there is connectivity issues in the VPN as soon as possible.
networking 18.04
New contributor
my first post here.
I made an script that provide reports of my network every 5 minutes. The script is simple and is working fine except when there is issues in my network. The script is running in Ubuntu Server 18.04.
My line for the Ping command is:
ping -w 300 192.168.1.216
The issue consist when I am having packet losses, ping stop immediately an doesn't finish the 300 seconds (5 minutes) run. I checked online and everywhere but I haven't been able to find a solution to make the ping keep running when there are lost packets. This is an example:
ping -w 300 192.168.1.216
PING 192.168.1.216 (192.168.1.216) 56(84) bytes of data.
64 bytes from 192.168.1.216: icmp_seq=1 ttl=128 time=2.29 ms
64 bytes from 192.168.1.216: icmp_seq=2 ttl=128 time=4.14 ms
64 bytes from 192.168.1.216: icmp_seq=3 ttl=128 time=17.9 ms
64 bytes from 192.168.1.216: icmp_seq=4 ttl=128 time=40.6 ms
64 bytes from 192.168.1.216: icmp_seq=5 ttl=128 time=38.6 ms
From 192.168.1.2 icmp_seq=30 Destination Host Unreachable
From 192.168.1.2 icmp_seq=31 Destination Host Unreachable
From 192.168.1.2 icmp_seq=32 Destination Host Unreachable
--- 192.168.1.216 ping statistics ---
33 packets transmitted, 5 received, +3 errors, 84% packet loss, time 32657ms
rtt min/avg/max/mdev = 2.295/20.738/40.659/16.379 ms, pipe 4
Thanks.
EDIT REASON: Add full script code.
Full script code:
Location="XXX"
host="192.168.6.1"
while true
do
result=$(ping -w 300 -q $host)
sendemail
-f "xxxx@gmail.com"
-u "XXX 5 Minutes Network Report"
-t "pingreport@gmail.com"
-s "smtp.gmail.com:587"
-o tls=yes
-xu "xxxx@gmail.com"
-xp "password"
-m "$result"
done
This is to check the status of our VPN. Like I said is a very simple script. I am using the ping -c 1 as suggested for an emergency one that will let us know if there is connectivity issues in the VPN as soon as possible.
networking 18.04
networking 18.04
New contributor
New contributor
edited Dec 5 at 16:04
New contributor
asked Dec 4 at 21:53
Mr.Alvaro
64
64
New contributor
New contributor
1
Welcome to Ask Ubuntu. I don't understand what you're trying to do, but the-w
appears to be doing what it should as theman ping
states "it waits either for deadline expire or until count probes are answered or for some error notification from network." - ie. it's stopping because last condition is reached as I understand your question. When I've had to do similar to you, I sent a singleping -c 1
& then processed according to error.codeerr1721=$?
in subsequent lines.
– guiverc
Dec 4 at 22:24
All that I need is to have a ping running for 300/3600/86400 seconds, that is why I used the -w. What I need is a way that ping doesn't stop when there are network errors when using the -w or another way to make sure it runs for the specific amount of time disregarding network errors, packet lost etc.
– Mr.Alvaro
Dec 4 at 22:33
add a comment |
1
Welcome to Ask Ubuntu. I don't understand what you're trying to do, but the-w
appears to be doing what it should as theman ping
states "it waits either for deadline expire or until count probes are answered or for some error notification from network." - ie. it's stopping because last condition is reached as I understand your question. When I've had to do similar to you, I sent a singleping -c 1
& then processed according to error.codeerr1721=$?
in subsequent lines.
– guiverc
Dec 4 at 22:24
All that I need is to have a ping running for 300/3600/86400 seconds, that is why I used the -w. What I need is a way that ping doesn't stop when there are network errors when using the -w or another way to make sure it runs for the specific amount of time disregarding network errors, packet lost etc.
– Mr.Alvaro
Dec 4 at 22:33
1
1
Welcome to Ask Ubuntu. I don't understand what you're trying to do, but the
-w
appears to be doing what it should as the man ping
states "it waits either for deadline expire or until count probes are answered or for some error notification from network." - ie. it's stopping because last condition is reached as I understand your question. When I've had to do similar to you, I sent a single ping -c 1
& then processed according to error.code err1721=$?
in subsequent lines.– guiverc
Dec 4 at 22:24
Welcome to Ask Ubuntu. I don't understand what you're trying to do, but the
-w
appears to be doing what it should as the man ping
states "it waits either for deadline expire or until count probes are answered or for some error notification from network." - ie. it's stopping because last condition is reached as I understand your question. When I've had to do similar to you, I sent a single ping -c 1
& then processed according to error.code err1721=$?
in subsequent lines.– guiverc
Dec 4 at 22:24
All that I need is to have a ping running for 300/3600/86400 seconds, that is why I used the -w. What I need is a way that ping doesn't stop when there are network errors when using the -w or another way to make sure it runs for the specific amount of time disregarding network errors, packet lost etc.
– Mr.Alvaro
Dec 4 at 22:33
All that I need is to have a ping running for 300/3600/86400 seconds, that is why I used the -w. What I need is a way that ping doesn't stop when there are network errors when using the -w or another way to make sure it runs for the specific amount of time disregarding network errors, packet lost etc.
– Mr.Alvaro
Dec 4 at 22:33
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
I would consider changing your script to run ping -c 1 <ip-address>
every five minutes, instead of relying on the ping
binary to provide that behavior. Then you can also check the return status ($?
) to determine if it succeeded or failed.
It would be helpful if you also post your script, so that the context of your problem can be more easily understood.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I would consider changing your script to run ping -c 1 <ip-address>
every five minutes, instead of relying on the ping
binary to provide that behavior. Then you can also check the return status ($?
) to determine if it succeeded or failed.
It would be helpful if you also post your script, so that the context of your problem can be more easily understood.
add a comment |
up vote
1
down vote
I would consider changing your script to run ping -c 1 <ip-address>
every five minutes, instead of relying on the ping
binary to provide that behavior. Then you can also check the return status ($?
) to determine if it succeeded or failed.
It would be helpful if you also post your script, so that the context of your problem can be more easily understood.
add a comment |
up vote
1
down vote
up vote
1
down vote
I would consider changing your script to run ping -c 1 <ip-address>
every five minutes, instead of relying on the ping
binary to provide that behavior. Then you can also check the return status ($?
) to determine if it succeeded or failed.
It would be helpful if you also post your script, so that the context of your problem can be more easily understood.
I would consider changing your script to run ping -c 1 <ip-address>
every five minutes, instead of relying on the ping
binary to provide that behavior. Then you can also check the return status ($?
) to determine if it succeeded or failed.
It would be helpful if you also post your script, so that the context of your problem can be more easily understood.
answered Dec 5 at 0:17
mpontillo
7461518
7461518
add a comment |
add a comment |
Mr.Alvaro is a new contributor. Be nice, and check out our Code of Conduct.
Mr.Alvaro is a new contributor. Be nice, and check out our Code of Conduct.
Mr.Alvaro is a new contributor. Be nice, and check out our Code of Conduct.
Mr.Alvaro is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1098502%2fping-stops-when-there-is-big-packet-loss%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome to Ask Ubuntu. I don't understand what you're trying to do, but the
-w
appears to be doing what it should as theman ping
states "it waits either for deadline expire or until count probes are answered or for some error notification from network." - ie. it's stopping because last condition is reached as I understand your question. When I've had to do similar to you, I sent a singleping -c 1
& then processed according to error.codeerr1721=$?
in subsequent lines.– guiverc
Dec 4 at 22:24
All that I need is to have a ping running for 300/3600/86400 seconds, that is why I used the -w. What I need is a way that ping doesn't stop when there are network errors when using the -w or another way to make sure it runs for the specific amount of time disregarding network errors, packet lost etc.
– Mr.Alvaro
Dec 4 at 22:33