How do I assign an arbitrary name to a network interface based on hardware location? (CentOS 7)
up vote
0
down vote
favorite
I have multiple identical appliances runing CentOS 7 with four on-board NICs. To maintain a similar feel to an older version of the appliance running RHEL6 (i.e., ethX
), I want to use the network naming scheme used by RHEL6. I also want to minimize the number of changes required after creating a generic system disk for use on each appliance.
If I understand the naming scheme in CentOS 7, the naming scheme is consistent based on hardware location so if the hardware is identical, I'll have the same network interface names for each instance of the appliance.
Due to customer demands, I need to make the appliance's network interfaces have the same name on the CentOS 7 and RHEL6 versions.
One approach is to extend the kernel command line with net.ifnames=0
as described here and then create my own ifcfg-ethX
files. However, as near as I can tell, doing so requires manual modification of the configuration file. This is further complicated by the legacy ordering being fixed but arbitrary so I would have to modify these files for each system. :-/
One thought I had was to use the CentOS 7 naming scheme but then add an alias to each so that the arbitrary naming scheme could by applied based on hardware location. Is it possible to do this?
Any other ideas on how I can get two names to the same device and IP address?
NOTE: I am not asking how to add multiple IP addresses to the same device which is fairly straightforward.
EDIT:
I really need to rename it but would like to do so programatically.
linux networking centos
add a comment |
up vote
0
down vote
favorite
I have multiple identical appliances runing CentOS 7 with four on-board NICs. To maintain a similar feel to an older version of the appliance running RHEL6 (i.e., ethX
), I want to use the network naming scheme used by RHEL6. I also want to minimize the number of changes required after creating a generic system disk for use on each appliance.
If I understand the naming scheme in CentOS 7, the naming scheme is consistent based on hardware location so if the hardware is identical, I'll have the same network interface names for each instance of the appliance.
Due to customer demands, I need to make the appliance's network interfaces have the same name on the CentOS 7 and RHEL6 versions.
One approach is to extend the kernel command line with net.ifnames=0
as described here and then create my own ifcfg-ethX
files. However, as near as I can tell, doing so requires manual modification of the configuration file. This is further complicated by the legacy ordering being fixed but arbitrary so I would have to modify these files for each system. :-/
One thought I had was to use the CentOS 7 naming scheme but then add an alias to each so that the arbitrary naming scheme could by applied based on hardware location. Is it possible to do this?
Any other ideas on how I can get two names to the same device and IP address?
NOTE: I am not asking how to add multiple IP addresses to the same device which is fairly straightforward.
EDIT:
I really need to rename it but would like to do so programatically.
linux networking centos
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have multiple identical appliances runing CentOS 7 with four on-board NICs. To maintain a similar feel to an older version of the appliance running RHEL6 (i.e., ethX
), I want to use the network naming scheme used by RHEL6. I also want to minimize the number of changes required after creating a generic system disk for use on each appliance.
If I understand the naming scheme in CentOS 7, the naming scheme is consistent based on hardware location so if the hardware is identical, I'll have the same network interface names for each instance of the appliance.
Due to customer demands, I need to make the appliance's network interfaces have the same name on the CentOS 7 and RHEL6 versions.
One approach is to extend the kernel command line with net.ifnames=0
as described here and then create my own ifcfg-ethX
files. However, as near as I can tell, doing so requires manual modification of the configuration file. This is further complicated by the legacy ordering being fixed but arbitrary so I would have to modify these files for each system. :-/
One thought I had was to use the CentOS 7 naming scheme but then add an alias to each so that the arbitrary naming scheme could by applied based on hardware location. Is it possible to do this?
Any other ideas on how I can get two names to the same device and IP address?
NOTE: I am not asking how to add multiple IP addresses to the same device which is fairly straightforward.
EDIT:
I really need to rename it but would like to do so programatically.
linux networking centos
I have multiple identical appliances runing CentOS 7 with four on-board NICs. To maintain a similar feel to an older version of the appliance running RHEL6 (i.e., ethX
), I want to use the network naming scheme used by RHEL6. I also want to minimize the number of changes required after creating a generic system disk for use on each appliance.
If I understand the naming scheme in CentOS 7, the naming scheme is consistent based on hardware location so if the hardware is identical, I'll have the same network interface names for each instance of the appliance.
Due to customer demands, I need to make the appliance's network interfaces have the same name on the CentOS 7 and RHEL6 versions.
One approach is to extend the kernel command line with net.ifnames=0
as described here and then create my own ifcfg-ethX
files. However, as near as I can tell, doing so requires manual modification of the configuration file. This is further complicated by the legacy ordering being fixed but arbitrary so I would have to modify these files for each system. :-/
One thought I had was to use the CentOS 7 naming scheme but then add an alias to each so that the arbitrary naming scheme could by applied based on hardware location. Is it possible to do this?
Any other ideas on how I can get two names to the same device and IP address?
NOTE: I am not asking how to add multiple IP addresses to the same device which is fairly straightforward.
EDIT:
I really need to rename it but would like to do so programatically.
linux networking centos
linux networking centos
edited Nov 30 at 21:06
asked Nov 30 at 20:00
MrMas
1136
1136
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
Can a name be both "arbitrary" and "based on hardware location" at the same time? These words contradict each other.
The
eth#
names are assigned by the kernel itself based on detection order on each boot – in other words, they're "first come, first serve", and have nothing to do with hardware location.
Older udev versions used to automatically generate a file in
/etc/udev/rules.d
to bind these assignments to the cards' MAC addresses. You can probably copy that file to the new systems.
You can also write custom udev rules to set the
NAME=
parameter based on the address or PCI location. (Note that in the future udev may refuse to rename an interface toeth*
, if it doesn't already. And even if allowed, this renaming is very brittle and can fail if the devices are discovered in a different order.)
Although, as far as I know, RHEL 6 used biosdevname for generating the physical-based interface names (kernel switch
biosdevname=0
). RHEL 7 uses systemd-udevd's built-in net_id for this purpose (kernel switchnet.ifnames=0
).
To get the
p1p2
style names, you canyum install biosdevname
, then enable it through the kernel command line (biosdevname=1 net.ifnames=0
). See the Red Hat documentation.
Network interfaces cannot have aliases.
By arbitrary, I mean "not following a prescribed pattern"
– MrMas
Nov 30 at 21:55
This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created/etc/NetworkManager/dispatcher.d/99-ifup-local.sh
to do this for each of my devices.
– MrMas
Nov 30 at 21:55
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Can a name be both "arbitrary" and "based on hardware location" at the same time? These words contradict each other.
The
eth#
names are assigned by the kernel itself based on detection order on each boot – in other words, they're "first come, first serve", and have nothing to do with hardware location.
Older udev versions used to automatically generate a file in
/etc/udev/rules.d
to bind these assignments to the cards' MAC addresses. You can probably copy that file to the new systems.
You can also write custom udev rules to set the
NAME=
parameter based on the address or PCI location. (Note that in the future udev may refuse to rename an interface toeth*
, if it doesn't already. And even if allowed, this renaming is very brittle and can fail if the devices are discovered in a different order.)
Although, as far as I know, RHEL 6 used biosdevname for generating the physical-based interface names (kernel switch
biosdevname=0
). RHEL 7 uses systemd-udevd's built-in net_id for this purpose (kernel switchnet.ifnames=0
).
To get the
p1p2
style names, you canyum install biosdevname
, then enable it through the kernel command line (biosdevname=1 net.ifnames=0
). See the Red Hat documentation.
Network interfaces cannot have aliases.
By arbitrary, I mean "not following a prescribed pattern"
– MrMas
Nov 30 at 21:55
This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created/etc/NetworkManager/dispatcher.d/99-ifup-local.sh
to do this for each of my devices.
– MrMas
Nov 30 at 21:55
add a comment |
up vote
2
down vote
Can a name be both "arbitrary" and "based on hardware location" at the same time? These words contradict each other.
The
eth#
names are assigned by the kernel itself based on detection order on each boot – in other words, they're "first come, first serve", and have nothing to do with hardware location.
Older udev versions used to automatically generate a file in
/etc/udev/rules.d
to bind these assignments to the cards' MAC addresses. You can probably copy that file to the new systems.
You can also write custom udev rules to set the
NAME=
parameter based on the address or PCI location. (Note that in the future udev may refuse to rename an interface toeth*
, if it doesn't already. And even if allowed, this renaming is very brittle and can fail if the devices are discovered in a different order.)
Although, as far as I know, RHEL 6 used biosdevname for generating the physical-based interface names (kernel switch
biosdevname=0
). RHEL 7 uses systemd-udevd's built-in net_id for this purpose (kernel switchnet.ifnames=0
).
To get the
p1p2
style names, you canyum install biosdevname
, then enable it through the kernel command line (biosdevname=1 net.ifnames=0
). See the Red Hat documentation.
Network interfaces cannot have aliases.
By arbitrary, I mean "not following a prescribed pattern"
– MrMas
Nov 30 at 21:55
This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created/etc/NetworkManager/dispatcher.d/99-ifup-local.sh
to do this for each of my devices.
– MrMas
Nov 30 at 21:55
add a comment |
up vote
2
down vote
up vote
2
down vote
Can a name be both "arbitrary" and "based on hardware location" at the same time? These words contradict each other.
The
eth#
names are assigned by the kernel itself based on detection order on each boot – in other words, they're "first come, first serve", and have nothing to do with hardware location.
Older udev versions used to automatically generate a file in
/etc/udev/rules.d
to bind these assignments to the cards' MAC addresses. You can probably copy that file to the new systems.
You can also write custom udev rules to set the
NAME=
parameter based on the address or PCI location. (Note that in the future udev may refuse to rename an interface toeth*
, if it doesn't already. And even if allowed, this renaming is very brittle and can fail if the devices are discovered in a different order.)
Although, as far as I know, RHEL 6 used biosdevname for generating the physical-based interface names (kernel switch
biosdevname=0
). RHEL 7 uses systemd-udevd's built-in net_id for this purpose (kernel switchnet.ifnames=0
).
To get the
p1p2
style names, you canyum install biosdevname
, then enable it through the kernel command line (biosdevname=1 net.ifnames=0
). See the Red Hat documentation.
Network interfaces cannot have aliases.
Can a name be both "arbitrary" and "based on hardware location" at the same time? These words contradict each other.
The
eth#
names are assigned by the kernel itself based on detection order on each boot – in other words, they're "first come, first serve", and have nothing to do with hardware location.
Older udev versions used to automatically generate a file in
/etc/udev/rules.d
to bind these assignments to the cards' MAC addresses. You can probably copy that file to the new systems.
You can also write custom udev rules to set the
NAME=
parameter based on the address or PCI location. (Note that in the future udev may refuse to rename an interface toeth*
, if it doesn't already. And even if allowed, this renaming is very brittle and can fail if the devices are discovered in a different order.)
Although, as far as I know, RHEL 6 used biosdevname for generating the physical-based interface names (kernel switch
biosdevname=0
). RHEL 7 uses systemd-udevd's built-in net_id for this purpose (kernel switchnet.ifnames=0
).
To get the
p1p2
style names, you canyum install biosdevname
, then enable it through the kernel command line (biosdevname=1 net.ifnames=0
). See the Red Hat documentation.
Network interfaces cannot have aliases.
edited Nov 30 at 21:03
answered Nov 30 at 20:49
grawity
230k35484543
230k35484543
By arbitrary, I mean "not following a prescribed pattern"
– MrMas
Nov 30 at 21:55
This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created/etc/NetworkManager/dispatcher.d/99-ifup-local.sh
to do this for each of my devices.
– MrMas
Nov 30 at 21:55
add a comment |
By arbitrary, I mean "not following a prescribed pattern"
– MrMas
Nov 30 at 21:55
This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created/etc/NetworkManager/dispatcher.d/99-ifup-local.sh
to do this for each of my devices.
– MrMas
Nov 30 at 21:55
By arbitrary, I mean "not following a prescribed pattern"
– MrMas
Nov 30 at 21:55
By arbitrary, I mean "not following a prescribed pattern"
– MrMas
Nov 30 at 21:55
This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created
/etc/NetworkManager/dispatcher.d/99-ifup-local.sh
to do this for each of my devices.– MrMas
Nov 30 at 21:55
This link headed in the right direction: unix.stackexchange.com/a/219277/88800 and, for persitence in a udev-like manner, this link shared important info: cyberciti.biz/faq/… So I created
/etc/NetworkManager/dispatcher.d/99-ifup-local.sh
to do this for each of my devices.– MrMas
Nov 30 at 21:55
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1379821%2fhow-do-i-assign-an-arbitrary-name-to-a-network-interface-based-on-hardware-locat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown