Will probably want to include "eno" in your grep statement. Not all Etherned devices come up as "ens". Not sure if there are any other varations.
Regards, Christian Caruthers Lenovo xESS IT Consultant Mobile: 757-289-9872 From: Josh Nielsen [mailto:jniel...@hudsonalpha.org] Sent: Wednesday, August 03, 2016 5:01 PM To: xCAT Users Mailing list; Rich Sudlow Subject: Re: [xcat-user] Is there an ifcfg-eth postscript that works on systemd OSes? Thanks! Yes, I knew ifconfig was deprecated, hence why I knew this was a hack and was asking. Is that postscript something you wrote yourself? Thanks, Josh On Wed, Aug 3, 2016 at 3:49 PM, Rich Sudlow <r...@nd.edu<mailto:r...@nd.edu>> wrote: On 08/03/2016 03:54 PM, Josh Nielsen wrote: Hello, I am now testing the deployment of Centos 7 in my environment and I've noticed that the ifcfg-eth postscript is not geared to work with it. For starters Centos 7 doesn't install ifconfig by default, though I've solved that with my kickstart, but more to the point the postscript explicitly looks for "Ethernet" in the ifconfig line to grab the interface name which doesn't work on systemd OSes like Centos 7. And of course there's the change from "eth" interface names to "ens" and a variety of other names. I changed the line that looked like this in the postscript: interfaces=$(ifconfig -a | grep "Ethernet" | awk '{print $1}') To this: interfaces=$(ifconfig -a | egrep "Ethernet|ens" | awk '{print $1}') And while that does parse out the ens interface names now they come with a colon tacked on to the end of them in the ifconfig output like this: ens160: ens192: I can parse that out with a regex substitution to remove the colon, but before I hack the default script up too much has there been an alternative ifcfg-eth postscript released for systems like this? I'm using this script to change the /etc/sysconfig/network-scripts/ifcfg-* files from using DHCP to the static addresses defined through xCAT, which works fine on my Centos 6 OSes. This is my xCAT version: lsxcatd -v Version 2.11 (git commit 9ea36ca6163392bf9ab684830217f017193815be, built Mon Nov 30 05:43:11 EST 2015) Thanks, Josh Nielsen I believe all the latest xcat routines use ip addr .... as you might know the use if ifconfig is deprecated... here's a snippet from a postscript which uses ksh if [[ $OSVER = *rhels7* ]]; then # This just hardcodes the entries which are already set # Change to grep only on "inet " rather than "inet addr" so that rhels7 works - RKS - 8/21/2014 for nic in `ifconfig -a|grep -B1 "inet "|awk '{print $1}'|grep -v inet|grep -v -- --|grep -v lo|sed s/:$//`; do echo "Setting up hardeths on rhels7" >> /root/post.log echo NIC $nic echo NIC $nic >> /root/post.log IPADDR=`ifconfig $nic |grep "inet "|awk '{print $2}' |awk -F: '{print $1}'` echo "IPADDR: $IPADDR" >> /root/post.log NETMASK=`ifconfig $nic |grep "inet "|awk '{print $4}' |awk -F: '{print $1}'` echo "NETMASK: $NETMASK" >> /root/post.log sed -i s/BOOTPROTO=dhcp/BOOTPROTO=none/ /etc/sysconfig/network-scripts/ifcfg-$nic sed -i s/ONBOOT=no/ONBOOT=yes/ /etc/sysconfig/network-scripts/ifcfg-$nic echo IPADDR=$IPADDR >> /etc/sysconfig/network-scripts/ifcfg-$nic echo NETMASK=$NETMASK >> /etc/sysconfig/network-scripts/ifcfg-$nic # Remove firewalld since we're using iptables - RKS 9/30/14 yum remove -y firewalld | logger -t xcat echo "Done with hardeths on rhels7" >> /root/post.log done Hope this help you out. ------------------------------------------------------------------------------ _______________________________________________ xCAT-user mailing list xCAT-user@lists.sourceforge.net<mailto:xCAT-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/xcat-user -- Rich Sudlow University of Notre Dame Center for Research Computing - Union Station 506 W. South St South Bend, In 46601 (574) 631-7258<tel:%28574%29%20631-7258> (office) (574) 807-1046<tel:%28574%29%20807-1046> (cell)
------------------------------------------------------------------------------
_______________________________________________ xCAT-user mailing list xCAT-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xcat-user