在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 --->得出网卡的名字,一般第一块100M网卡名为hme0
#ifconfig hme0 down --->先把网卡hme0的服务暂时停止
#ifconfig hme0 192.168.1.100 netmask 255.255.255.0 up --->启动网卡

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/

你可能感兴趣的:(在Solaris下更改IP地址)