Re: nmcli and gateway question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-08-03 03:57, Ed Greshko wrote:
On 2020-08-03 18:21, ToddAndMargo via users wrote:
Hi Ed,

Okay, lets look at this as a network detective.

You start only know that there are two network connections.
One to the to Internet, which I will call the Black connection.
The other one to the internal network, which I will call the
Red connection.  You need to know which is which.

Just a note of caution.  Just because a default route exists it does not necessarily follow that that it will
lead to the Internet.  But, I doubt you're talking about cases where that would be.

I know.  I don't care.  I am looking for the configuration,
not whether it works or not


Currently

    $ 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   0 br0


In the above, I can determine:

      Red network    = 192.168.255.0/24
      Black network  = 192.168.250.0/24
      Black Gateway  = 192.168.250.1

The giveaway is the "G" flag

You can glean the same info from nmcli.


nmcli -f GENERAL.DEVICE,IP4.ADDRESS,IP4.GATEWAY,IP4.ROUTE device show.

For which I get on my system.

GENERAL.DEVICE:                         enp2s0
IP4.ADDRESS[1]:                         192.168.1.18/24
IP4.GATEWAY:                            192.168.1.1
IP4.ROUTE[1]:                           dst = 192.168.1.0/24, nh = 0.0.0.0, mt = 100
IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 192.168.1.1, mt = 100

GENERAL.DEVICE:                         virbr0
IP4.ADDRESS[1]:                         192.168.122.1/24
IP4.GATEWAY:                            --
IP4.ROUTE[1]:                           dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0

GENERAL.DEVICE:                         wlp4s0
IP4.ADDRESS[1]:                         192.168.2.127/24
IP4.GATEWAY:                            192.168.2.5
IP4.ROUTE[1]:                           dst = 0.0.0.0/0, nh = 192.168.2.5, mt = 600
IP4.ROUTE[2]:                           dst = 192.168.2.0/24, nh = 0.0.0.0, mt = 600
IP4.ROUTE[3]:                           dst = 192.168.56.0/24, nh = 192.168.2.116, mt = 600

This would allow me to careen through the list to find
out who has a gateway.  It is a lot easier to extract
the device if the gateway and the device are on the
same line.   A loop withing a loop would be able to
extract that.  It is another way of doing it.  Thank you!

And you now know the device names, IP address of the devices, you know the gateways, and dst=0.0.0.0/0 is equivalent to "G".

From the route man page
   U (route is up)
   G (use gateway)

0.0.0.0 does point to the UG interface, but you have to look to 0.0.0.0 to find if it is "up" (meaning "route is up"). This
does not mean the configuration works, but I don't care.

I see you have two gateways.  Would you mind posting your
`netstat -n`?


So, I do believe you are connect.  "nmcli" can not
tell me who is Red and who is Black.  "route" or
"netstat" are what is initially called for.

I *didn't* say that at all.  In another message I said nmcli can't tell you if the gateway is UP.

not looking for that kind of "up"

And, neither
can netstat or route.  And, that I thought was your goal to verify the gateway being up.

For that, you normally use ping.

Again, I am looking for the configuration, not whether it
works 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



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux