Solaris 10修改网卡IP地址
修改前IP bash-3.00# 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.1.119 netmask ffffff00 broadcast 192.168.1.255 ether 0:c:29:11:af:6c
1、修改/etc/hosts文件 bash-3.00# vi hosts "hosts" [Read only] 5 lines, 82 characters # # Internet host table # 127.0.0.1 localhost 192.168.1.118 orca loghost
2、修改 /etc/hostname.pcn0 更改网卡的IP地址 例如改为:192.168.180.80
3、修改/etc/inet/ipnodes bash-3.00# pwd /etc/inet bash-3.00# vi ipnodes "ipnodes" [Read only] 6 lines, 91 characters # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.1.118 orca loghost
4、修改/etc/netmasks bash-3.00# pwd /etc bash-3.00# vi netmasks ---由于此次修改的IP和以前是同网段的,所以这里的文件可以不需要修改 "netmasks" [Read only] 15 lines, 382 characters # # 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.1.0 255.255.255.0
5、修改/etc/defaultrouter bash-3.00# pwd /etc bash-3.00# vi defaultrouter ---由于此次修改的IP和以前是同网段的,所以这里的文件可以不需要修改 "defaultrouter" 1 line, 14 characters 192.168.1.254
6、重启init 6
Solaris 10 修改IP地址(网上找的比较靠谱)
2、永久更改IP地址 需要修改以下几个文件 /etc/hosts 加入机器名和ip地址 例如: 192.168.180.80 solaris /etc/(hosts networks netmasks) 改3个文件 三个文件初始是只读文件,所以要增加修改权限
/etc/hostname.pcn0 更改网卡的IP地址 例如改为:192.168.180.80
/etc/defaultrouter 加入网关 例如:192.168.180.1
/etc/resolv.conf 加入DNS服务器 例如: nameserver 202.96.128.68 nameserver 202.106.196.115
修改文件 /etc/nsswitch.conf 找到这一行hosts : files 修改为 hosts: files dns 即域名不能在/etc/hosts里找到的话,就会去DNS解析。
更改完成后重新启动即可.
更改了网卡/增加了网卡,系统不能自动启动该接口服务,这时需要手动创建网口服务: #ifconfig pcn0 plumb 即可以为接口pcn0创建网口服务 相应地,用ifconfig带unplumb参数可以停止服务并关闭网络
******如果只是更主机名,则只需要修改以下几个文件: /etc/hosts /etc/nodename /etc/hostname., 例如:/etc/hostname.igb0
时间: 2024-10-11 09:01:07