Chinaunix首页 | 论坛 | 博客
  • 博客访问: 278802
  • 博文数量: 121
  • 博客积分: 3050
  • 博客等级: 中校
  • 技术积分: 1262
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-25 12:18
文章分类

全部博文(121)

文章存档

2016年(3)

2011年(17)

2010年(34)

2009年(16)

2008年(40)

2007年(2)

2006年(9)

我的朋友

分类:

2011-03-21 19:26:09

 前天因工作需要,对一台HPUX进行主机名与IP地址修改,结果发现操作起来没想象中那么简单的,首先计划使用SAM进行网络配置,结果IP修改后,发现主机名没变,修改/etc/hosts,然后执行hostname指定名称后,发现使用uname -a 查看时,仍然是老名称,决定找一下啦!

首先,man hostname查看相应的manpage,结果发现有 /sbin/init.d/hostname这么个东西,呵呵,接着看
aaa01:[/etc/rc.config.d]#cat /sbin/init.d/hostname
#!/sbin/sh
#
# @(#)B.11.11_LR
#
# NOTE:    This script is not configurable!  Any changes made to this
#          scipt will be overwritten when you upgrade to the next
#          release of HP-UX.
#
# WARNING: Changing this script in any way may lead to a system that
#          is unbootable.  Do not modify this script.
#

#
# Set hostname
#

PATH=/sbin:/usr/sbin:/usr/bin
export PATH

rval=0
set_return() {
        x=$?
        if [ $x -ne 0 ]; then
                echo "EXIT CODE: $x"
                rval=1
        fi
}

case $1 in
start_msg)
        echo "Setting hostname"
        ;;

start)
        if [ -f /etc/rc.config ] ; then
                . /etc/rc.config
        else
                echo "ERROR: /etc/rc.config defaults file MISSING"
        fi

        hostname $HOSTNAME
        set_return

        if [ -z "$NODENAME" ] ; then
           uname -S ${HOSTNAME%%.*}
        else
           uname -S $NODENAME
        fi
        set_return

        setuname -s $OPERATING_SYSTEM -t
        set_return
        ;;

*)
        echo "usage: $0 {start}"
        ;;
esac

exit $rval
aaa01:[/etc/rc.config.d]#
呵呵,发现,然来,跟网络相关的东西然来在/etc/rc.config中有相关的
aaa01:[/etc/rc.config.d]# cd /etc/rc.config
sh: /etc/rc.config: The specified path name is not a directory.
hbnms01:[/etc/rc.config.d]#cat /etc/rc.config
# This script sources configuration files for various subsystems. Configuration
# variables are in files CFG_FILE in /etc/rc.config.d/*, and /etc/TIMEZONE.
# Simple error checks are done: test file perms and for dumped "core" files.
# Filenames containing [.,~#] are not sourced - they are possible names of
# backup files such as file.bak, file.OLD, ~file, file~, file,v, #file etc.
#
# @(#)B.11.11_LR

for CFG_FILE in /etc/rc.config.d/* /etc/TIMEZONE
do
        fname=${CFG_FILE##*/}           # get file basename
        if [ -f $CFG_FILE -a "$fname" != "core" -a "${fname##*[.,~\#]}" = "$fname" ]
        then . $CFG_FILE                # source a valid config file
        fi
done
aaa01:[/etc/rc.config.d]#

只能再去/etc/rc.config.d/目录下查相应的文件啦,

aaa01:[/etc/rc.config.d]#ls |grep net(一般网络相关的都与net相应啦)
netconf
netdaemons
netdaemons.bak
nettl
aaa01:[/etc/rc.config.d]#
查看最可能的文件netconf,哈哈,一切尽在眼前啦!!!

aaa01:[/etc/rc.config.d]#more netconf
# netconf:  configuration values for core networking subsystems
#
# @(#)B.11.11_LR $Revision: 1.6.119.6 $ $Date: 97/09/10 15:56:01 $
#
# HOSTNAME:           Name of your system for uname -S and hostname
#
# OPERATING_SYSTEM:   Name of operating system returned by uname -s
#                     ---- DO NOT CHANGE THIS VALUE ----
#
# LOOPBACK_ADDRESS:   Loopback address
#                     ---- DO NOT CHANGE THIS VALUE ----
#
# IMPORTANT:  for 9.x-to-10.0 transition, do not put blank lines between
# the next set of statements

HOSTNAME="aaa01"
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1


IP_ADDRESS[1]=10.10.10.1
SUBNET_MASK[1]=255.255.255.0
INTERFACE_NAME[1]=lan1
BROADCAST_ADDRESS[1]=10.10.10.255
INTERFACE_STATE[1]=up
ROUTE_DESTINATION[0]=default
ROUTE_GATEWAY[0]=10.10.10.254
ROUTE_COUNT[0]=1

将需要修改的内容修改后,重启OS测试,一切OK!
阅读(5627) | 评论(0) | 转发(0) |
0

上一篇:惟愿孩儿愚且鲁

下一篇:su - 报错

给主人留下些什么吧!~~