修改Solaris系统的主机名和IP地址

如题,2种方法

一。使用sys-unconfig。
   我想装过Solaris系统的人都应该知道这个命令吧?它可以使系统的一系列设置恢复到出厂状态,然后让你重新设置.很方便,不过比较危险,什么DNS,TIMEZONE等等统统归位!具体使用man查看,我只复制关系此命令修改哪些设置:

sys-unconfig does the following:

       o  Saves  current  /etc/inet/hosts  file  information   in
          /etc/inet/hosts.saved.

       o  If the current  /etc/vfstab  file  contains  NFS  mount
          entries,     saves     the    /etc/vfstab    file    to
          /etc/vfstab.orig.

       o  Restores the default /etc/inet/hosts file.

       o  Removes the default hostname in /etc/hostname.interface
          files  for  all interfaces configured when this command
          is run. To determine which interfaces  are  configured,
          run       the       command      'ifconfig-a'.      The
          /etc/hostname.interface files corresponding to  all  of
          the interfaces listed in the resulting output, with the
          exception of the  loopback  interface  (lo0),  will  be
          removed.

       o  Removes the default domainname in /etc/defaultdomain.

       o  Restores the timezone to PST8PDT in /etc/TIMEZONE.

       o  Disables the Network Information Service (NIS) and Net-
          work  Information  Service Plus (NIS+) if either NIS or
          NIS+ was configured.

       o  Removes the file /etc/inet/netmasks.

       o  Removes the file /etc/defaultrouter.

       o  Removes the password set for root in /etc/shadow.

       o  Removes the file /etc/.rootkey.

--以上就是这个SYS-UNCONFIG做的事情,英文不好的同学要加强点,毕竟你是管理员man文档的基本英文要能应付吧?--

好了,接着讲使用SYS-UNCONFIG,全是英文了哦:

Select the language you want to use: <select your language>

Select a Locale,
Please make a choice (0 - 59), or press h or ? for help:
<select your location>

What type of terminal are you using?
Type the number of your choice and press Return:
<select your terminal type, I use a DEC VT100>

F2 continue, F2 continue

Network Connectivity
       Networked [X] Yes

DHCP
       Use DHCP [X] No

Primary Network Interface
       Primary network interface [X] eri0

Host Name <hostname>

IP Address <ipaddress>

Subnets
       System part of a subnet [X] Yes

Netmask
<netmask>

IPv6
       Enable IPv6 [X] No

Set a default Route
       [X] Specify one
Default Route IP Address
       Router IP Address: <defaultrouter>

Confirm Information
       F2 continue

Configure Security Policy:
       Configure Kerberos Security [X] No

Confirm Information
       F2 continue

Name Service
       Name service [X] DNS

Domain Name
       <dnsdomain>

DNS Server Address
       Servers IP Address: <nameserver1>
       Servers IP Address: <nameserver2>
       Servers IP Address:

DNS Search List
       Search Domain: <dnsdomain>
       Search Domain:
       Search Domain:
       Search Domain:
       Search Domain:

Confirm Information
       F2 continue

Time Zone
       Regions [X] <select your region>

Time Zone
       Time zones [X] <select your time zone>

Date and Time
   > Accept the default date and time or enter new values.

二,使用编辑文件并重启

1.修改主机名

Solaris7, 之前的版本(不包括7):

/etc/inet/hosts
/etc/nodename
/etc/hostname.<interface>

<interface> 是你住网卡设备的名称, 比如:bge0.
Refer:用$grep network /etc/path_into_inst查看有哪些网卡 

/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts

修改好以后重启系统.

 

Solaris7到9:

/etc/inet/hosts
/etc/nodename
/etc/hostname.<interface>

<interface>解释同上

/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts
/etc/inet/ipnodes

重启系统 

 

Solaris10:

/etc/inet/hosts
/etc/nodename
/etc/hostname.<interface>

<interface> 解释同上.

/etc/inet/ipnodes

重启系统.

 

2.修改IP地址

Solaris7之前的版本(不包括7):

/etc/inet/hosts
/etc/hostname.<interfaces>

<interfaces> are the names of the interfaces, e.g. bge0, bge1, eri0.

/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts


如果你需要移动到不同的子网时,你还需要修改:
/etc/inet/netmasks
/etc/defaultrouter
/etc/resolv.conf

修改好以后,重启系统就OK了.

 

Solaris7 to 9:

/etc/inet/hosts
/etc/hostname.<interfaces>

where <interfaces> are the names of the interface, e.g. bge0, bge1, eri0.

/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts
/etc/inet/ipnodes

如果你需要移动到不同的子网时,你还需要修改: 
/etc/inet/netmasks
/etc/defaultrouter
/etc/resolv.conf

修改好以后,重启系统就OK了.

 

Solaris10:

/etc/inet/hosts
/etc/hostname.<interfaces>

where <interfaces> are the names of the interface, e.g. bge0, bge1, eri0.

/etc/inet/ipnodes

如果你需要移动到不同的子网时,你还需要修改: 
/etc/inet/netmasks
/etc/defaultrouter
/etc/resolv.conf

修改好以后,重启系统就OK了.
好了,祝你顺利.
 

################################################
相关资料请查看sun infoDoc 21252: 
"How to Change the hostname and/or IP Address Without Running the sys-unconfig Command". (Editor's note: For more information, please see SunSolve; content is available to registered users with a Sun Service Plan.)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值