大网数据广告活动
服务器运维问答

How configure networking knowing the MAC but not device name?

· 52CE 我爱测

Background: I intend to use Kickstart to automate the deployment/configuration of CentOS 7. I am trying to generate an appropriate Kickstart file to pre-configure networking for the operating system, using a basic configuration f…

问题原文

原帖链接 · Christoffer Reijer · CC BY-SA 3.0

Background:

I intend to use Kickstart to automate the deployment/configuration of CentOS 7.

I am trying to generate an appropriate Kickstart file to pre-configure networking for the operating system, using a basic configuration file from a sample install of the operating system as a reference point.

I am not clear about how the network interface names are constructed, which poses a problem; I need to know what the interface name is/will be on deployment, so I can configure the network settings such as IP address/gateway/subnet mask, etc.

I do however have access to the MAC address information for each of the network cards on the hosts which will have the operating system deployed to them.

Question:

Do I have enough information to predict the network interface name and/or is there another approach I should consider?

已采纳解答

原帖链接 · BE77Y · CC BY-SA 3.0

OK, so if I interpreted your question correctly, you have a couple of things here to think about.

Firstly: it seems that you are being confused by the new network interface naming nomenclature introduced in CentOS 7. In theory, this nomenclature is actually more predictable than the previous one (just a bit less intuitive/readable).

The naming works as follows (from the Red Hat documentation):

 Two character prefixes based on the type of interface:
   en -- ethernet
   sl -- serial line IP (slip)
   wl -- wlan
   ww -- wwan

 Type of names:
   b<number>                             -- BCMA bus core number
   ccw<name>                             -- CCW bus group name
   o<index>                              -- on-board device index number
   s<slot>[f<function>][d<dev_port>]     -- hotplug slot index number
   x<MAC>                                -- MAC address
   [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]
                                         -- PCI geographical location
   [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][i<interface>]
                                         -- USB port number chain

So, you should actually be able to predict the interface name based on knowledge of the board (or to be more basic - if you're using the same board every time, you could just deploy once and see what the interface(s) in question are named to, and use that.

Secondly, you can actually disable this new nomenclature if you so choose, which is actually something which has been covered before in this context here on SF:

You may use the bootloader section in the kickstart file to suppress predictable network interface names.

Adding net.ifnames=0 and [if needed] biosdevname=0 to the --append should do what you're asking.

bootloader --location=mbr --append="net.ifnames=0 biosdevname=0"

However, this is of course just a workaround - it might be a good opportunity to take this prompt to just familiarise yourself with the new nomenclature and how it works.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。