Re: nmcli and gateway question

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

 



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.

>
> 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
>
> and
>
>    $ route -n
>    Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
>    0.0.0.0         192.168.250.1   0.0.0.0         UG    100    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     100    0  0 eno2
>    192.168.255.0   0.0.0.0         255.255.255.0   U     425    0  0 br0

Those are 2 ways to display the same information.  As is "ip route show".

>
>
> both tell me that "eno2" is the Black connection and "br0" is
> the Red connection.  "virbr0" is also Red, but that is
> another story.  And that the ONLY connection that has
> a gateway is "eno2".  (More that one and all hell breaks
> loose.)
>
> 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



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".

>
> 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.  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.



-- 
The key to getting good answers is to ask good questions.
_______________________________________________
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