I have a number of systems each with two Ethernet interfaces on machines running Ubuntu 16.04.
One interface will always be setup as static and the other interface will always be setup as DHCP. I have no way of guaranteeing the names of the interfaces will be constant from one deployed system to another.
Is there a command I can issue from the command line to figure out which one is static and which one is dynamic without having to know what the IP address would have to be specifically for one or the other?
I'm trying to automate detection of a dropped static IP connection. I've gotten as far as using the command
ip link show to find names of all the interfaces and once I know the name of the static interface I can use
ethtool interface_name to determine whether or not the connection has link detected. But I just can't figure out a good way to go and figure out which one is the static link
I don't want to have to go look at /etc/network/interfaces btw. Don't want to tie myself to that method as I may not always use that file to set the static IP.
I also can't go issue a command to see which interface has an active dhcp address using a command like
more /var/lib/dhcp/dhclient.leases because I can't guarantee that both interfaces won't be down at the same time.
Thanks for any help you can give me
Did find these after posting, looks like it may not be possible to do what I'm wanting, I may have to resort to parsing /etc/network/interfaces after all or having to use the scripting services of ifup or NetworkManager. . .