Sun Solaris 修改IP地址或者主机名

来源:互联网 发布:北京王府井mac专柜 编辑:程序博客网 时间:2024/05/14 04:42

设置ip地址、子网掩码、广播
ifconfig pcn0 192.168.16.197 netmask 255.255.255.0 broadcast 192.168.16.255
设置默认网关
route add default 192.168.16.250

 

重启机器:reboot

查看主机信息:uname -a

查看主机名:hostname

 

 

转载自:http://rainbird.blog.51cto.com/211214/64732

 

solaris修改IP地址.刚装完solaris10的时候想到这个问题,还很郁闷不知道从哪开始.netconfig命令没有.看IP地址的配置文件不知道在哪,不像linux,连/etc/sysconfig文件夹都没有.不熟悉归不熟悉,研究过后现在已经可以凭着脑子把手工修改IP地址的过程默写下来了.所以,写原创没有侵权的意思,因为是我自己组织的思路.
         废话少说,来看solairs10的IP地址及主机名的配置文件.共有四个:
         /etc/hostname.pcn0
         /etc/hosts
         /etc/netmasks
         /etc/defaultrouter
        有人说/etc/nodname也要配置,这个不知道了,看实际情况吧,反正我只动上面两个就可以了.换IP段的话,要用到第三个./etc/hostname.pcn0这个里面记录的本机的机器名;/etc/hosts是一个指向/etc/inet/hosts的一个软链接,记录的是IP地址和机器名的对应关系;/etc/netmasks是指向/etc/inet/netmasks的一个软链接,里面记录的是网络地址和子网掩码的对应关系.;/etc/defaultrouter看名字就知道了是默认网关.
         哈哈知道了这个文件的位置和作用,搞定机器名和IP看你死不死.
         现在我的机器名要改成rainbird.我的IP地址要改成192.168.2.5还用C掩码255.255.255.0网关也要改喽.还成192.168.2.254.好了,理清思路开工.vi /etc/hostname.pcn0删除原来的东西,改为rainbird保存退出.vi /etc/hosts 删除除了127.0.0.1那一行以外的其它行(在不用的情况下.)添加一行192.168.2.5 rainbird loghost;为什么要加一个loghost我也不知道,只是知道这样没问题,嘿嘿.题外话了,有知道的兄弟可以指点下;vi /etc/netmasks 删除原来的修改为:192.168.2.5 255.255.255.0;vi /etc/netmasks修改为192.168.2.0 255.255.255.0;vi /etc/defaultrouter改为:192.168.2.254保存退出.OK,验证一下,reboot!
         哈哈,这样混着来不知道,您读着理解起来会不会有问题.理一下思路,
和主机名相关的配置文件:
        /etc/hostname.pcn0
        /etc/hosts
确保这两个文件一一对应的关系没问题的话,修改主机名没问题.
和IP地址相关的配置文件:
        /etc/hosts
        /etc/netmasks
       /etc/defaultrouter
确保了这三个文件里一一对应关系没有问题的话,就正确修改了,IP地址.
       OK,今天就到这里,请关注下期.solaris系统服务管理.
 
 

Sun Solaris 修改IP地址或者主机名
)_od:[,qV01)如何修改IP地址和主机名

IP地址涉及的文件有: 杭州博客网*w Cu+U^J/o^2Yg
/etc/hosts (change the IP address)
ET!s$~o+Y-Qf#`0/etc/netmasks (if subnetting)
9M p'w7Wp0/etc/defaultrouter (to specify the new gateway for this subnet)

改变主机名涉及的文件有: 杭州博客网6wa.Z oV w
/etc/hosts (change to the new hostname)
g$c5C1R {!~,m6[/h%g0/etc/nodename (change to the new hostname)
7_.dy~4| ~ G/t)j0/etc/hostname.<interface> (where <interface> is the name of the primary 杭州博客网/n y1/kP;s
interface for this system, i.e hostname.hme0 or hostname.le0.
JtP.T;Q2FP"}0Change to the new hostname.) 杭州博客网V$tqW9S kK x,C
/etc/net/ticlts/hosts (change both columns to the new hostname)
7|E+Z%?A+[{-}s.O I0/etc/net/ticots/hosts (change both coluums to the new hostname)
5gSL)bA D&Tw0/etc/net/ticotsord/hosts (change both columns to the new hostname)
TH BZ0ymH@}0改完上述文件之后推荐重起一下机器

原创粉丝点击