<div dir="auto">Add a bit that has a timer to restore the old config if an outside script doesn't stop it is X minutes. I've done that for firewall configs after I hosed a remote box.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mar 18, 2017 8:33 PM, "Leam Hall" <<a href="mailto:leamhall@gmail.com">leamhall@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Untested, and I tend to do things in multiple steps.<br>
<br>
cp /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0 /tmp<br>
<br>
cat /tmp/ifcfg-eth0 | egrep -iv "ipaddr|broadcast|gateway" > /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
<br>
echo "IPADDR=1.2.3.4" >> /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
echo "BROADCAST=1.2.3.0" >> /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
echo "GATEWAY=1.2.3.1" >> /etc/sysconfig/network-scripts<wbr>/ifcfg-eth0<br>
<br>
service network restart<br>
<br>
Main thing is to not put the backup copy in the network-scripts directory, RHEL will try to bring up an interface like ifcfg-eth0.sav.<br>
<br>
Hope that helps.<br>
<br>
Leam<br>
<br>
<br>
On 03/18/17 20:21, Raj Wurttemberg wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is it possible to edit the ifcfg-eth0 file (RHEL6) from the command<br>
line? On my Windows servers I can use the netsh command to make the<br>
change (I wrote a VMware PowerCLI script to update Windows already). If<br>
I have to use sed or whatever, that’s fine… I was just curious if there<br>
were an easier way.<br>
<br>
<br>
<br>
One of our hosted customers wants us to re-IP all of their servers and I<br>
definitely don’t want to log into each server to make the change. :p<br>
<br>
<br>
<br>
(Side note… I do have Salt running in the environment also.) Ugh… that<br>
reminds me…. Salt doesn’t like it when servers get re-IPd….<br>
<br>
<br>
<br>
Thanks,<br>
<br>
/Raj<br>
<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/li<wbr>stinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/li<wbr>stinfo</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<wbr>_________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/li<wbr>stinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/li<wbr>stinfo</a><br>
</blockquote></div></div>