[
249
]
The new naming convention has been put in place in order to make interface naming
more predictable. While you may argue that names such as
eth0
may be easier to
memorize than something like
enp0s3
, the change helps the name stay persistent
between boots. When you add new network interfaces to a Linux system, there's
always the possibility that other interface names may change as well. For example,
if you have an older Linux installation on a server with a single network card (
eth0
)
and you add a second (which is given the name
eth1
), your configuration may
break if the names were to get switched during the next boot. Imagine for a moment
that one interface is connected to the internet and another connected to a switch
(basically, you have an internet gateway). If the interfaces came up in the wrong
order, internet access would be disrupted for your entire office, due to the fact that
the firewall rules you've written are being applied to the wrong interfaces. Definitely
not a pleasant experience!
In the past, previous versions of Ubuntu (as well as Debian, and even CentOS), have
opted to use
udev
to make the names stick in order to work around this issue. This is
no longer necessary nowadays, but I figured I'd mention it here just in case you end
up working on a server with an older installation. These older servers would achieve
stickiness with interface names from configuration stored in the following file:
/etc/udev/rules.d/70-persistent-net-rules
This file existed on older versions of some popular Linux distributions (including
Ubuntu), as a workaround to this problem. This file contains some information that
identifies specific qualities of the network interface, so that with each boot, it will
always come up with the same name. Therefore, the card you recognize as
eth0
will
always be
eth0
. If you have an older version of Ubuntu Server in use, you should be
able to see this file for yourself. Here's some sample output of this file on an older
installation:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
TTR{address}=="01:22:4e:a5:f2:ec", ATTR{dev_id}=="0x0",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
As you can see, it's using the MAC address of the card to identify it with
eth0
. But
this becomes a small problem if I want to take an image of this machine and
re-deploy it onto another server. This is a common practice—we administrators
rarely start over from scratch if we don't have to, and if another server is similar
enough to a new server's desired purpose, cloning it will be an option. However,
when we restore the image onto another server, the
/etc/udev/rules.d/70-
persistent-net-rules
file will come along for the ride. We'll more than likely find
that the new server's first network interface will have a designation of
eth1
, even if
we only have one interface.
Connecting to Networks
Do'stlaringiz bilan baham: |