A "network device" (in the context of a computer) typically refers to a piece of hardware - the network interface card (NIC). Once upon a time, back when dinosaurs roamed the internet and lots of people still used modems, NICs really only came with one interface, but nowadays, NICs with multiple interfaces are common. A NIC can have multiple active IP addresses (as can an interface), and multiple NICs can have the same IP address. There are undoubtedly countless NICs and/or interfaces in the world with the 192.168.1.1 IP address right now.
An interface, in this context, is the hole you plug a network cable into (often referred to as a port, but not to be confused with a [software] port). For many intents and purposes, different network interfaces on the same device/NIC can be treated as different devices - they are often independent, can almost always be configured independently (and differently), and are seen as different devices by your software, even if they come on the same card. For example, the computer I'm typing this up on has a dual-port NIC, one of which was fried by a lightning strike a couple years back. The other interface still works just fine, though. See below image to understand the relationship of device and interface.
![enter image description here](../../images/3839626427.webp)
A network connection... is a much more ambiguous term. In the context of hardware, it would refer to the physical connection between the interface on a computer and the interface on a second network device (switch, router, other computer, etc.), by a network cable of some sort. It's a vague term, though, so it can mean just the cable, just the connection on one end, the connection on both ends, or encompass the whole thing, interface, cable and other interface. It can even extend further than than - as in "check your connection to the internet," which would cover a computer, a router, at least a couple cables, and possibly more.
In terms of software, a "connection" generally means a network session (such as an SSH or FTP sessions between two computers), but is often used to refer to stateless protocols as well, like http. Even though there is no actual session, people will often talk of a "connection" with a website, for example.
However, as far as nmcli
is concerned, a connection is the equivalent of a 'profile' for an interface that bundles all the relevant configuration for that interface. Let's imagine you have to temporarily connect your server to a different network and have only 1 interface. Let's assume this interface is called ens33, and has all its config stored in a connection called primary. Thus have to change certain settings on the interface (perhaps the static IP and gateway for that new network) for the new connection to work at all. You could delete the existing settings, in which case you'll have to write them back again - or just create a new connection for that interface (let's call it testing). Now, you can keep both sets of settings separate and you can change all the settings at once by switching connections with:
# nmcli con down primary; nmcli con up testing
As far as the relationships are concerned, 1 NIC (device) can have multiple interfaces, and each interface can have multiple connections (associated settings stored in a file /etc/sysconfig/network-scripts/ifcfg-<interfaceName>
).