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

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地址或者主机名
1)如何修改IP地址和主机名

IP地址涉及的文件有:
/etc/hosts (change the IP address)
/etc/netmasks (if subnetting)
/etc/defaultrouter (to specify the new gateway for this subnet)

改变主机名涉及的文件有:
/etc/hosts (change to the new hostname)
/etc/nodename (change to the new hostname)
/etc/hostname.<interface> (where <interface> is the name of the primary
interface for this system, i.e hostname.hme0 or hostname.le0.
Change to the new hostname.)
/etc/net/ticlts/hosts (change both columns to the new hostname)
/etc/net/ticots/hosts (change both coluums to the new hostname)
/etc/net/ticotsord/hosts (change both columns to the new hostname)
改完上述文件之后推荐重起一下机器

猜你喜欢

转载自blog.csdn.net/eeeeety6208/article/details/127029807