A network interface card is installed on every computer so that it can connect to a network. Without a network card, you can't use the network.
If your server's hardware has been properly configured, you should have one or more network interfaces available for you to use.
You can view the information regarding the interfaces in your server using the IP command, also, you can manage your interfaces with the IP command.
For example, to show your currently assigned IP address, you can either use
ip addr show:
Both commands would show the above output, so, use the one you prefer.
If you look at the image carefully, you would see that it provides us useful information regarding the network interfaces and the IP address of each device.
The one you should be concern about is the enp0s3, which represents the wired network card (we would come back to the naming convention later), first, let's see how you bring down and bring up an interface.
To bring a device down, you use:
sudo ip link set enp0s3 down
This removes its IP assignment and prevents it from connecting to networks or the internet.
To bring up a device, you use:
sudo ip link set enp0s3 up
This brings up the network and allows connecting back to the internet, this is the same as toggling the state of the interface enp0s3; on & off, you get the idea!
If you are used to Ubuntu 16 and below, you will notice the naming convention is a little bit different, in Ubuntu 16, the network interface names are eth0, wlan0, and the likes.
The issue with that naming convention is that the names aren't predictable and aren't persistent between boots.
For example, if you add a second network card (which then becomes eth1; eth0 are the first network card, so, if you add a second one, it becomes eth1), it is likely your configuration breaks if names were to get switched during the next boot, this happens to me a lot, and it wasn't a nice thing at all.
To solve this issue, you use the udev to make the names stick, this way, the order won't get changed during the next boot. While you don't need this anymore in new the new version of Ubuntu (18.04 and above), it doesn't hurt to know how it works.
To do this, you open up the following configuration file:
This would show the order in which the networks comes up, the card you recognize as eth1 will always be eth1 and the one you recognize as eth0 would always be eth0, An example from my older server:
You can see it is using the MAC address of the card to identify with the network interface cards, an illustration below:
You can see how it is connected, but even if you got this to work, it becomes a problem when you want to redeploy the image of the server onto another server.
When you restore the image onto another server, you will have to make changes to the 70-persistent-net-rules in order to reclaim the network interface cards. You delete the line that contains the card that's not on the system and then changing the device designation on the remaining line back to eth0 and eth1 respectively.
since you have a good understanding of how it works on older versions of Ubuntu, let's get back to the new naming convention.
The new naming convention references the physical location of the network card on your system's bus, meaning it can't change even if you boot a hundred times, it would only change unless you were to actually remove the network card and place it in a different slot on the system's board. if you are using a VPS, you have no problem with this too unless your VPS provider changes the position of the network device in the hypervisor.
This doesn't mean you can't use the old naming convention, you can decide to opt for that if you so wish.
Let's take a quick overview of how the network names break down in newer versions of Ubuntu (18.04 and above).
|the interface card is placed in the system first bus, p stands for bus and the numbering starts at 0
|PCI slot 3
Putting it all together, enp0s3 references a wired network interface cards on the system first bus, place in PCI slot 3.
Bottom line is that the new naming scheme is based on where the card is physically located, so, it can't change unless you aren't physically switching the position of the network cards.
See, you later!