On 2020-08-02 19:03, Ed Greshko wrote:
On 2020-08-03 09:36, ToddAndMargo via users wrote:
On 2020-08-02 18:26, Samuel Sieb wrote:
On 8/2/20 6:22 PM, ToddAndMargo via users wrote:
I am not after what the gateway address is, but rather
1) if gateway is up or not
That can only be determined by pinging it or something past it.
That is one way of doing it, but it gives a lot
more information than I want. It tell me the
Internet is working. I am not testing that.
I only want to know if the device is connected to the
gateway and the gateway is up.
So, ping the gateway?
You are presuming I know anything about several
networks at this point
2) if my device connected to the gateway that is up
Since you should know which interface goes to the gateway, why isn't it enough to check if the interface is connected?
I am setting up my iptables so it is universal. This
is only one of about 15 parameters I read from the
system.
Define "connected to". If by mean "accessible" then a ping or may do. That is assuming the gateway
is configured to respond to pings. "Connected" usually means a connection is established. As in an
ssh session.
Presuming I know which device (eno2 in this instance),
is part of which network (192.168.250.0/24 in this
instance), this will tell me that I am connected to
the router of that network. And what that router is.
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt
Iface
0.0.0.0 192.168.250.1 0.0.0.0 UG 0 0 0
eno2
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0
virbr0
192.168.250.0 0.0.0.0 255.255.255.0 U 0 0 0
eno2
192.168.255.0 0.0.0.0 255.255.255.0 U 0 0
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx