-2

First let's block all incoming / outgoing traffic.

vi /etc/sysconfig/iptables

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A OUTPUT -j DROP
-A INPUT -j DROP
-A FORWARD -j DROP
COMMIT

Next: let's test ping

ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

at that point ping stalls.. perhaps will wait until times out.

Now let's disconnect the network interface and try again:

ping 8.8.8.8
connect: Network is unreachable

beautiful, it stopped instantly. ( no stalling or waiting for time out )

Some recommended using "REJECT" in the iptables-rules
and even play with the -j REJECT --reject-with flags..

I have tried them all.
there is no way to send the same signal the kernel
is sending
to the program when the network interface is disconnected.
( via iptables )

This is what I want to do for now:

figure a way to ensure Kernel tells ping that network is disconnected.
( or run a command in another terminal manually to send such a signal )

this way ping will not stall. it will simply say

connect: Network is unreachable

and stop.

Can it be done & how ?

  • Once you've earned sufficient rep points, you can come and state your case on meta.SF as to why you think this line of questioning is on-topic here. Question comments are not a place to discuss topicality. – EEAA Jan 29 '17 at 18:13
  • The SF community sets its own expectations on question topicality. We are willing to hear your point of view, but at the same time, we expect people to spend some time getting to know how things work here before complaining. Please step back and take a deep breath. None of this is personal. Your question is not bad. It's just off-topic here. You may consider that insulting those which are trying to help you is not a great way to get help. – EEAA Jan 29 '17 at 18:17

0 Answers0