内网IP一般为eth1网口,可以使用下面两种方法获取。
方法一
local_ip=`ifconfig eth1|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
方法二
local_ip=`ifconfig | perl -lane 'BEGIN{$is_eth1=0;}if($F[0]=~/^eth1$/){$is_eth1=1};if($_=~/inet addr:([\w\.]*)/ && $is_eth1==1){print $1;$is_eth1=0;}'`