[SOLVED] Mageia 4 enp0sNN network interface names break

[SOLVED] Mageia 4 enp0sNN network interface names break

Postby griffin » Feb 16th, '14, 06:01

Mageia 4 has replaced the network interface names eth0...ethN with enp0sNN names and this breaks firewalls and likely other things. I have two network interfaces, eth0 and eth1 - eth0 is the internet interface and eth1 is an internal interface.

Now under Mageia 4 these interfaces are named enp0s16 and enp0s17, and I regard these as opaque and unnecessarily obfuscated. These crazy network interface names break my script-based firewalls, such that I can't use a clean install of Mageia 4. An upgrade to Mageia 4 doesn't do this.

I would like to do a clean install of Mageia 4 to get rid of various cruft in my desktop system that I use for my professional work, but I probably won't be able to handle that now due to this bafflingly arbitrary and, to my mind, unnecessary change.

The network interface names eth0...ethN are de facto industry standards, so I can't imagine why Mageia thinks it can or should change this. Please go back to using the standard network interface names instead of these weird, crazy names.
Last edited by griffin on Feb 16th, '14, 18:33, edited 1 time in total.
griffin
 
Posts: 100
Joined: Sep 9th, '11, 03:51

Re: Mageia 4 enp0sNN network interface names break things

Postby jkerr82508 » Feb 16th, '14, 08:43

"Predictable Network Interface Names" are standard when systemd is used:

http://www.freedesktop.org/wiki/Softwar ... faceNames/

You can revert to the former method - scroll to the penultimate section of the linked page.

Jim
jkerr82508
 
Posts: 946
Joined: Mar 26th, '11, 01:34
Location: Fife, Scotland

Re: Mageia 4 enp0sNN network interface names break things

Postby griffin » Feb 16th, '14, 17:45

That makes sense, and I stand corrected and better informed. I have changed my desktop firewall script to use the new systemd standard for network interface names. Here are some code fragments for anyone else who maintains their own firewall scripts. It sources a configuration file, but with a bit more work it could use whatever netstat tells it.
Code: Select all
configuration file:
TRUSTED_IFACES="lo"
PUBLIC_IFACES="enp0s16"
INTERNAL_IFACES="enp0s17"

bash script:
# The following makes a list of all current IP addresses
LOCAL_ADDRESSES=`ifconfig | grep "inet addr" | awk '{print $2}' | awk -F: '{print $2"/32"}' | sed s:127\.0\.0\.1/32:127.0.0.1/8: `
#
# Echo our local addresses...
echo -n "Our local-addresses are..."
echo
echo "${LOCAL_ADDRESSES}"
echo
#
# DEFAULT_GW_IFACE
#
# The name of the address that is the default gateway
DEFAULT_GW_IFACE=`netstat -nr | awk '$1 == "0.0.0.0" {print $8}'`
DEFAULT_GW_IP=`netstat -nr | awk '$1 == "0.0.0.0" {print $2}'`
#
# Echo our default gateway interface, if one exists...
if      [ ! -z "${DEFAULT_GW_IFACE}" ]; then
        echo -n "Our default gateway is on interface ${DEFAULT_GW_IFACE}"
        echo
        echo -n "Our default gateway's IP address is ${DEFAULT_GW_IP}"
        echo
fi     
#
# Get our local internet address and broadcast network
LOCAL_INTERNET_ADDRESS=`ifconfig "$DEFAULT_GW_IFACE" | grep "inet addr" | awk '{print $2}' | awk -F: '{print $2"/32"}' `
SNAT_LOCAL_INTERNET_ADDRESS=`ifconfig "$DEFAULT_GW_IFACE" | grep "inet addr" | awk '{print $2}' | awk -F: '{print $2}' `
if      [ ! -z "${LOCAL_INTERNET_ADDRESS}" ]; then
        echo -n "Our local internet address is ${LOCAL_INTERNET_ADDRESS}"
        echo
fi
#
LOCAL_BROADCAST_NETWORK=`ifconfig "$DEFAULT_GW_IFACE" | grep "Bcast" | awk '{print $3":"$4}' | awk -F: '{print $2"/"$4}' `
if      [ ! -z "${LOCAL_BROADCAST_NETWORK}" ]; then
        echo -n "Our local broadcast network is ${LOCAL_BROADCAST_NETWORK}"
        echo
fi
#
# Echo our trusted interface, if any...
if      [ ! -z "${TRUSTED_IFACES}" ]; then
        echo -n "Our trusted interfaces are ${TRUSTED_IFACES}"
        echo
fi
#
# INTERNAL_NETWORKS
#
# INTERNAL_NETWORKS lists the masked networks for the INTERNAL_IFACES
# Echo our internal networks, if any exist...
if      [ ! -z "${INTERNAL_IFACES}" ] ; then
        echo -n "Our internal networks are"
        for i in ${INTERNAL_IFACES} ; do
            INTERNAL_NETWORK="`ifconfig ${i} | grep "inet addr" | awk '{print $2":"$4}' | awk -F: '{print $2"/"$4}'`"
            INTERNAL_NETWORKS="${INTERNAL_NETWORKS} ${INTERNAL_NETWORK}"
            echo " ${i} ${INTERNAL_NETWORK}"
        done ;
        echo
fi

output:
# /sbin/bastille-netfilter status
Our local-addresses are...
192.168.2.2/32
10.0.0.1/32
127.0.0.1/8

Our default gateway is on interface enp0s16
Our default gateway's IP address is 192.168.2.1
Our local internet address is 192.168.2.2/32
Our local broadcast network is 192.168.2.255/255.255.255.0
Our trusted interfaces are lo
Our internal networks are enp0s17 10.0.0.1/255.255.255.0
griffin
 
Posts: 100
Joined: Sep 9th, '11, 03:51

Re: Mageia 4 enp0sNN network interface names break things

Postby doktor5000 » Feb 16th, '14, 18:10

Please mark the thread accordingly by editing the topic of the first post and prefix it by [SOLVED], thanks
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18052
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [SOLVED] Mageia 4 enp0sNN network interface names break

Postby jiml8 » Feb 17th, '14, 07:13

jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09


Return to Networking

Who is online

Users browsing this forum: No registered users and 1 guest