您的位置:首页 > 其它

solaris修改主机名和IP地址

2013-10-15 17:03 295 查看

修改IP地址

临时修改IP地址:



ifconfig用来配置网卡的IP地址,改动后即生效,但并不保存,下次启动后失效。

#ifconfig -a--->得出网卡的名字,一般第一块100M网卡名为hme0

#ifconfig hme0 down--->先把网卡hme0的服务暂时停止

#ifconfig hme0192.168.1.100 netmask 255.255.255.0 up --->启动网卡



永久修改IP地址:



修改两个配置文件:

第一修改:/etc/hosts

$ cat /etc/hosts

#

# Internet host table

#

127.0.0.1 localhost

192.168.1.188 dsg loghost



第二修改:/etc/inet/ipnodes

$ cat /etc/inet/ipnodes

#

# Internet host table

#

::1 localhost

127.0.0.1 localhost

192.168.1.188 dsg loghost

第三,修改掩码/etc/netmasks

$ cat /etc/netmasks

#

# The netmasks fileassociates Internet Protocol (IP) address

# masks with IP networknumbers.

#

# network-number netmask

#

# The termnetwork-number refers to a number obtained from the Internet Network

# Information Center.

#

# Both thenetwork-number and the netmasks are specified in

# "decimaldot" notation, e.g:

#

# 128.32.0.0 255.255.255.0

#

192.168.1.0 255.255.255.0


第四:重启系统

reboot

修改主机名

临时修改hostnamehostname



在7、8、9上,

永久
要修改6个文件,重启生效
/etc/hosts
/etc/hostname.hme0
/etc/nodename
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts
/etc/net/tilts/hosts



/etc/nodename -----在此处修改主机名,输入要修改的主机名,重启生效,并且确保

/etc/hosts

/etc/hostname.xxx(xxx代表你的网卡的名称)

/etc/nodename

/etc/net/ticots/hosts

/etc/net/ticotsord/hosts

/etc/net/tilts/hosts

这几个文件中的主机名一致。



在10上,

永久
只需要修改3个文件,重启生效,后三个没有用了。
/etc/hosts
/etc/hostname.hme0
/etc/nodename

使主机名立即生效:hostname 主机名
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: