参考:
solaris 10 dhcp优先静态ip????
请查看/etc/下面是否有/dhcp.netcardname文件 (若你需要配置静态ip,请删除此文件)
例如:
/etc/dhcp.pcn0
我之前一直设置静态ip不成功,还以为虚拟机的问题呢。。solaris不熟悉。。。汗一个~
才发现。。。。
做个记号给需要的兄弟!
配置静态ip
bash-3.00# uname -a SunOS myhostname 5.10 Generic_120012-14 i86pc i386 i86pc bash-3.00# cat /etc/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.1.150 myhostname loghost bash-3.00# cat /etc/nodename myhostname bash-3.00# cat /etc/hostname.pcn0 myhostname bash-3.00# cat /etc/defaultrouter 192.168.1.1 bash-3.00# cat /etc/netmasks # # 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 bash-3.00# cat /etc/networks #ident "@(#)networks 1.4 92/07/14 SMI" /* SVr4.0 1.1 */ # # The networks file associates Internet Protocol (IP) network numbers # with network names. The format of this file is: # # network-name network-number nicnames . . . #
# # The loopback network is used only for intra-machine communication # loopback 127
# # Internet networks # arpanet 10 arpa # Historical 192.168.1.0 255.255.255.0 pcn0 bash-3.00#检查一下,重启系统,输入命令查看ip就得到我配置的静态ip啦。
bash-3.00# ifconfig -a lo0: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 pcn0: flags=1000843 mtu 1500 index 2 inet 192.168.1.150 netmask ffffff00 broadcast 192.168.1.255 ether 0:c:29:69:d5:7b bash-3.00#
|
开启dhcp
touch /dhcp.netcardname即可。(不输入任何东西)
之后重启系统
bash-3.00# cat /etc/dhcp.pcn0 (对,重启后里面还是没任何东西!) 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 pcn0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2 inet 192.168.1.103 netmask ffffff00 broadcast 192.168.1.255 ether 0:c:29:69:d5:7b bash-3.00# 可以看到重启系统之后ip变化了哟,注意看红色一行里面有个DHCP字段哟~
|
阅读(2101) | 评论(0) | 转发(0) |