在Solaris下更改IP地址

The following steps may be used to change the IP address of a Solaris system:

1. Change the host's IP in /etc/hosts for the change to take effect after reboot.

2. Change /etc/defaultrouter with the address of the host's new default gateway, if applicable.

3. If you are using variable length subnet masks (VLSM), add the host's network number and subnet mask to /etc/netmasks.

4. Run ifconfig interface ip_address netmask broadcast_address for the IP address change to take effect immediately. The netmask and broadcast_address should be specified if you are using variable length subnet masks (VLSM), but may be omitted otherwise.

Solaris 10 additional instructions:
5. Change the host's IP in /etc/inet/ipnodes for the change to take effect after reboot.

在Solaris下更改IP地址
1、ifconfig命令暂时修改
ifconfig用来配置网卡的IP地址,改动后即生效, 但并不保存,下次启动后失效。
#ifconfig -a ---&gt得出网卡的名字,一般第一块100M网卡名为hme0
#ifconfig hme0 down ---&gt先把网卡hme0的服务暂时停止
#ifconfig hme0 192.168.1.100 netmask 255.255.255.0 up ---&gt启动网卡

2、永久更改IP地址
需要修改以下几个文件
/etc/hosts 加入机器名和ip地址
例如: 192.168.1.100 sky100 loghost
/etc/inet/hosts networks netmasks 改3个文件
/etc/net/*/hosts *为3个目录,改3个目录下的hosts
/etc/nodename
/etc/netmasks
例如: 192.168.1.0 255.255.255.0
/etc/hostname.hme0 更改网卡的IP地址
例如改为:192.168.1.100
/etc/defaultrouter 加入网关
例如:192.168.1.1
/etc/resolv.conf 加入DNS服务器
例如:
nameserver 202.106.0.20
nameserver 202.106.196.115
修改文件 /etc/nsswitch.conf
找到这一行hosts : files
修改为 hosts: files dns
即域名不能在/etc/hosts里找到的话,就会去DNS解析。
更改完成后重新启动即可.
------------------------------------------------------------------
更改了网卡/增加了网卡,系统不能自动启动该接口服务,这时需要手动创建网口服务:
#ifconfig hme0 plumb
即可以为接口hme0创建网口服务
相应地,用ifconfig带unplumb参数可以停止服务并关闭网络

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7180624/viewspace-927267/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7180624/viewspace-927267/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值