如何在Solaris下更改IP地址

来源:互联网 发布:gopro studio windows 编辑:程序博客网 时间:2024/04/30 03:10
如何在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参数可以停止服务并关闭网络
原创粉丝点击