Unix Study--Solaris 10修改主机IP和主机名

简介:

    对于Solaris系统,是通过一系列配置文件(文本)来存储和管理主机ip和主机名信息,通过编辑器修改这些配置文件就可以完成相关的配置。

一、修改主机ip

1、配置hosts文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@solaris186:/]# cat /etc/hosts
# Internet host table
:: 1      localhost       
127.0. 0.1        localhost       
192.168. 8.11     solaris186      loghost
 
[root@solaris186:/]# hostname
solaris186
 
[root@solaris186:/]# vi /etc/hosts
# Internet host table
#
:: 1      localhost
127.0. 0.1        localhost
192.168. 8.11     node1   loghost

2、查看网卡信息

1
2
3
4
5
6
[root@solaris186:/]# ifconfig -a
lo0: flags= 2001000849 <UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu  8232  index  1
         inet  127.0. 0.1  netmask ff000000 
e1000g0: flags= 1000843 <UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu  1500  index  2
         inet  192.168. 8.11  netmask ffffff00 broadcast  192.168. 8.255
         ether  8 : 0 : 27 : 28 :b1:8c

3、修改hostname.e1000g0

1
2
3
4
5
6
7
8
[root@solaris186:/]# cat /etc/hostname.e1000g0 
solaris186
 
[root@solaris186:/]# vi /etc/hostname.e1000g0  
node1
 
[root@solaris186:/]# cat /etc/hostname.e1000g0 
node1

4、修改netmasks(子网掩码)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@solaris186:/]# cat /etc/netmasks
#
# The netmasks file associates Internet Protocol (IP) address
# masks  with  IP network numbers.
#       network-number  netmask
#
# The term network-number refers to a number obtained  from  the Internet Network
# Information Center.
#
# Both the network-number  and  the netmasks are specified  in
"decimal dot"  notation, e.g:
#
#                128.32. 0.0  255.255. 255.0
#
192.168. 8.0      255.255. 255.0

5、修改网关配置

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@solaris186:/]# vi /etc/defaultrouter
192.168. 8.1
 
[root@solaris186:/]# cat /etc/defaultrouter 
192.168. 8.1
 
[root@solaris186:/]# netstat -nr
Routing Table: IPv4
   Destination           Gateway           Flags  Ref     Use     Interface 
-------------------- -------------------- ----- ----- ---------- --------- 
192.168. 8.0           192.168. 8.11          U          1           1  e1000g0   
224.0. 0.0             192.168. 8.11          U          1           0  e1000g0   
127.0. 0.1             127.0. 0.1             UH         1          50  lo0

 总结:

和主机ip有关的配置文件

/etc/hosts

/etc/hostname.xxxx(网卡名)

/etc/netmaks

/etc/defaultrouter

/etc/inet/ipnodes

二、修改主机名

1、配置hosts文件

1
2
3
4
5
[root@solaris186:/]# cat /etc/hosts
# Internet host table
:: 1      localhost       
127.0. 0.1        localhost       
192.168. 8.11     node1      loghost

2、修改hostname.e1000g0

1
2
3
4
5
6
7
8
[root@solaris186:/]# cat /etc/hostname.e1000g0 
solaris186
 
[root@solaris186:/]# vi /etc/hostname.e1000g0  
node1
 
[root@solaris186:/]# cat /etc/hostname.e1000g0 
node1

3、修改nodename

1
2
3
4
5
6
7
8
[root@solaris186:/]# cat /etc/nodename
solaris186
 
[root@solaris186:/]# vi /etc/nodename
node1
 
[root@solaris186:/]# cat /etc/nodename
node1

4、查看ipnodes

1
2
3
4
5
6
7
[root@solaris186:/]# cat /etc/inet/ipnodes 
#
# Internet host table
#
:: 1      localhost       
127.0. 0.1        localhost       
192.168. 8.11     node1   loghost

总结:

和主机名有关的配置文件

/etc/hosts

/etc/hostname.xxxx(网卡名)

/etc/nodename

/etc/inet/ipnodes










本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/1606699,如需转载请自行联系原作者
目录
相关文章
|
5月前
|
网络协议 安全 Unix
深入剖析进程间通信:Unix 套接字、共享内存与IP协议栈的性能比较
深入剖析进程间通信:Unix 套接字、共享内存与IP协议栈的性能比较
171 2
|
机器学习/深度学习 Unix Linux
获得Unix/Linux系统中的IP、MAC地址等信息
获得Unix/Linux系统中的IP、MAC地址等信息 中高级  |  2010-07-13 16:03  |  分类:①C语言、 Unix/Linux、 网络编程 ②手册  |  4,471 次阅读 作者:diaoyf  |  文章来源:http://programmerdigest.cn 实际环境和特殊需求往往会将简单问题复杂化,比如计算机IP地址,对于一个连接中socket,可以直接获得本端和对端的IP、端口信息。
1358 0
|
5月前
|
缓存 网络协议 Unix
Linux(UNIX)五种网络I/O模型与IO多路复用
Linux(UNIX)五种网络I/O模型与IO多路复用
162 0
|
5月前
|
Unix Shell Linux
在Unix/Linux操作系统中,Shell脚本广泛用于自动化任务
在Unix/Linux操作系统中,Shell脚本广泛用于自动化任务
63 2
|
2月前
|
Unix Linux 程序员
Unix:Linux的“逗趣祖师爷”与它的不凡传承
在科技长河中,Unix犹如一颗恒星,既是历史见证者也是未来的启发者。1969年,因程序员肯·汤普森想在他的PDP-7上玩“Space Travel”游戏,意外创造了Unix,以简洁优雅的代码改变了操作系统的世界。进入90年代,林纳斯·托瓦兹受Unix启发,开发了开源免费的Linux,像是Unix调皮的孙子,不仅继承其精髓还增添了开放共享的精神。Unix与Linux之间的传承,就像是智者与追蝶孩童的故事,充满了岁月的智慧与新生的活力,提醒我们科技传奇往往源于不起眼的小事。下次使用Linux时,不妨会心一笑吧!
39 0
|
2月前
|
开发框架 Unix Linux
LangChain 构建问题之在Unix/Linux系统上设置OpenAI API密钥如何解决
LangChain 构建问题之在Unix/Linux系统上设置OpenAI API密钥如何解决
41 0
|
5月前
|
Unix Shell Linux
在Linux和类Unix系统中,Shell提供了多种命令用于用户和权限管理
在Linux和类Unix系统中,Shell提供了多种命令用于用户和权限管理
72 4
|
5月前
|
Oracle Ubuntu Unix
Unix与Linux区别
Unix: Unix是一个操作系统家族的名称,最早由贝尔实验室(Bell Labs)的肖像电机公司(AT&T)开发。最早的Unix版本是在1969年创建的。 Linux: Linux是由芬兰计算机科学家Linus Torvalds在1991年创建的。它是作为一个免费、开放源代码的Unix克隆而开始的。
73 1
|
Unix 大数据 Linux
【Linux is not Unix】Linux前言
【Linux is not Unix】Linux前言