Ping stops when there is big packet loss
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
add a comment |
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
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 '18 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 '18 at 22:33
add a comment |
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
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
edited Dec 5 '18 at 16:04
asked Dec 4 '18 at 21:53
Mr.Alvaro
64
64
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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 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 '18 at 22:33
add a comment |
1 Answer
1
active
oldest
votes
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 |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 |
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 |
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 '18 at 0:17
mpontillo
7461518
7461518
add a comment |
add a comment |
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 '18 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 '18 at 22:33