On a dell pc, the only ethernet interface off the motherboard shows up as em1.
On a newer supermicro server, the interface names are enp137s0f0
On some older supermicro servers, they are eth0..eth3
In setting up a firewall (RHEL/Centos 7) I need to create a zone and bind it with the correct interface name: eth0, em1, enp137s0f0.
In writing a script what is the best way on any given hardware, with the OS being RHEL/CentOS 7, to get the active interface name?
Why do they vary? Is there a way to make everything just eth0..eth# ?
I need to do firewall-cmd --permanent --zone=mycustomezone --change-interface=???
ip link
, is there one that you could programmatically choose? Would it be the first one after lo0? Would it be the one shown inip route show default
orip route get 8.8.8.8
? – Mark Plotnick May 21 '19 at 16:50eth0
style of interface names on some systems is to modify the boot loader commands withnet.ifnames=0 biosdevname=0
– Jason K Lai May 21 '19 at 17:17