批量化根据外网IP来更改内网IP

Standard

批量化根据外网IP来更改内网IP
机器比较多的情况下用expect执行会很有效率

外网eth0 68.168.118.?
内网eth1 192.168.1.?

cd /etc/sysconfig/network-scripts/; /bin/cp -f ifcfg-eth0 ifcfg-eth1; sed -i -e 's#DEVICE=eth0#DEVICE=eth1#' -e '/GATEWAY/d' -e 's#68.168.118#192.168.1#' ifcfg-eth1; ifdown eth1 ; ifup eth1

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.