Friday, November 28, 2014

centos - How configure networking knowing the MAC but not device name?



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?


Answer



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 -- BCMA bus core number
ccw -- CCW bus group name
o -- on-board device index number
s[f][d] -- hotplug slot index number
x -- MAC address
[P]ps[f][d]
-- PCI geographical location
[P]ps[f][u][..][i]

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


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...