amazon media file explorer download upload index folder image licenses menu widget Play Pause profile-settings more dots-two-horizontal dots-two-vertical more-vertical pending google-plus hangouts facebook instagram whatsapp spotify telegram twitter vine renren rss youtube twitch vimeo flickr dribble behance deviantart 500px steam github soundcloud skype reddit linkedin lastfm delicious stackoverflow pinterest xing flattr foursquare yelp World

Understanding & Managing Network Interfaces In Ubuntu

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 aor ip addr show:

 ip a (show the current IP address

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:

/etc/udev/rules.d/70-persistent-net-rules

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:

2. 70-persistent-net.rules

You can see it is using the MAC address of the card to identify with the network interface cards, an illustration below:

illustration of how the configuration in 70-persistent-net rules made show the info sticks

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

enp0s3
en means Ethernet
p0 means the interface card is placed in the system first bus, p stands for bus and the numbering starts at 0
s3 means 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!

Related Post(s)

  • How To Access Windows 10 Drive/Folder in VirtualBox

    To access Windows drive or folder in your Guest OS, you first of all, install VirtualBox guest utilities: sudo apt-get install virtualbox-guest-utils You then Add a shared folder by going into: Setti

  • Send Mail with Attachment Using Mutt in GNU/Linux

    Mutt is a powerful text-based mail client for Unix/Linux operating systems. It features color support, message threading, MIME support...

  • Using Pageant To Automatically Authenticate SSH key in Putty

    I can't count how many times I have typed my ssh key passphrase whenever my ssh connection times out, it is so annoying and repetitive. Well, thanks to the putty pageant, you can do that seamlessly.

  • Installing WP-CLI In a GNU/Linux Server

    WP-CLI is a command-line interface for WordPress. It can also be used with ClassicPress, as they are no differences in their usage, maybe just minimal if you are updating or downloading new ClassicPr

  • How To Send Mail To Multiple Addresses Using (mailx)

    In this guide, you'll learn a couple of ways you can send mail to multiple addresses using mailx. mailx is a utility program for sending and receiving mail. I assume you already have mailx command, i

  • Mounting and Unmounting Cloud Storage With (Rclone) in GNU/Linux

    Ever wondered if you could mount your preferred cloud storage as a virtual drive on your system? Thanks to Rclone, you can mount and access different kinds of cloud storage from a file manager, I'll