On 2020-08-03 00:16, Ed Greshko wrote:
On 2020-08-03 14:22, ToddAndMargo via users wrote:
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
???
You earlier posted...
IP4.ADDRESS[1]: 192.168.250.135/24
IP4.GATEWAY: 192.168.250.1
IP4.ROUTE[1]: dst = 192.168.250.0/24, nh = 0.0.0.0, mt
= 0
IP4.ROUTE[2]: dst = 0.0.0.0/0, nh = 192.168.250.1, mt
= 0
So, you know the gateway is 192.168.250.1 and you know your local IP address is 192.168.250.135.
What am I missing?
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
Which is the same information given by nmcli.
And you're not "connected" to the router. You're just being pointed to an IP address with more routing
information than what your system has. Meaning, this host can only directly communicate with hosts
in the 192.168.250.0/24 and 192.168.122.0/24 subnets. Any traffic not within those subnets must be sent
to 192.168.250.1. And, of course, you'd find that 192.168.250.1 itself would have a default gateway defined.
Assuming that is the LAN segment of your Internet facing router the default route would be that of a device
at your ISP.
I still don't see any mystery or unknown.
I am just looking for alternate way to do things.
And NMCLI did not tell me if the router was up or not.
_______________________________________________
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