1.使root用户可以使用telnet功能:修改/etc/default/login文件,请注释掉root行:
1)打开telnet服务:
# svcadm enable telnet
svcadm是Solaris下最新的网络服务管理系统,要了解它和svcs的使用方法,请参见其帮助手册。
2)
开放root登录权限:修改/etc/default/login文件,注释掉其中的:CONSOLE=/dev/console
2.打开ftp功能:
Solaris 9以前 修改 /etc/ftpusers,将root行注释掉
Solaris 9
修改/etc/ftpd/ftpusers,将root行注释掉
3.设置ip地址:
1)ifconfig命令用于配置网卡地址,改动后立即生效,但并不保存配置,下次启动后失效。
查看网卡、ip状态
# ifconfig -a
lo0: flags=849 mtu 8232
inet 127.0.0.1
netmask ff000000
系统会显示网络接口的名称,接口的状态(up or
down),接口的IP地址和掩码等信息
更改网络接口的IP地址:
#ifconfig hme0 down
#ifconfig
hme0 211.101.149.233 netmask 255.255.255.0
up
首先,使用down命令参数把网络接口hme0的服务暂时停止,然后再用ifconfig命令给接口分配新的IP地址和掩码,并启动网络接口服务也可以通过改变文件/etc/hosts中的IP地址的值并重新启动系统来更改机器的IP地址。
2)想要永久更改配置,则要更改配置文件
和网卡基本设置相关的配置文件放在/etc/inet和/etc目录下,包括:
/etc/hosts
-> /etc/inet/hosts (文件中的每一行记录表示hostname和ip地址的对应关系)
/etc/hostname.
(文件内容和文件的扩展名构成hostname和interface设备名的对应关系)
/etc/netmasks
(文件中的每一行记录表示和netmask的对应关系)
/etc/dhcp. (dhcp)
/etc/defaultrouter
/etc/nsswitch.conf
创建和修改配置文件后,需要重启系统才能使设置生效。
/etc/hosts——主机名解析。是一个中介的机制来进行IP地址和易记名称的转换,实现域名的本机解析。DNS和/etc/hosts这两种方法。DNS解析的功能上较为强大,但是因为涉及的内容很广。/etc/hosts解析的功能不如DNS,但是设置内容简单。
/etc/inet/ipnodes文件同时存储IPv4
和IPv6 地址。此外,也可以存储以传统的点分十进制或CIDR 表示法表示的IPv4 地址。此文件作为将主机名与其IPv4 和IPv6
地址进行关联的本地数据库。该文件与/etc/hosts一起存储网络中每台计算机(包括pine本身)的网络地址。/etc/inet/ipnodes文件同时存储IPv4和IPv6地址。/etc/inet/ipnodes文件与/etc/hosts文件使用相同的格式约定。
/etc/hostname.XXX——网络接口名
/etc/netmasks——网络掩码
/etc/nsswitch.conf——configuration
file for the name-service switch。设定解析顺序,比如 files nis dns ...
,如果找不到nsswitch文件,默认解析方式是dns。
/etc/defaultrouter包括主机的路由地址。选用动态路由协议,则可将/etc/defaultrouter文件置为空。若选择静态协议,只需在/etc/defaultrouter文件中填入缺省路由器名,这样当Unix路由器找不到寻径路由时便将IP包发往缺省路由器。
MS:两个文件的优先级是:/etc/inet/ipnodes先,/etc/hosts后。
常见问题:
在/etc/hosts文件中修改了IP地址,重启后,发现机器的IP地址还是原来的,是怎么回事?
问题可能出在/etc/inet/ipnodes文件。该文件的语法跟/etc/hosts相同,但优先级高于/etc/hosts。如果
/etc/inet/ipnodes文件中保留了原来的IP地址,那么/etc/hosts中相同hostname的IP设置将被忽略。将ipnodes
文件中的IP地址一行删掉,或改成新的IP地址,重启后,问题就消失了。
举例l:以网卡hme0为例(网卡名是什么,就是hostname.XXX):
#more /etc/hostname.hme0
hostname
#more /etc/hosts
127.0.0.1 localhost
172.16.255.2
hostname loghost
#vi /etc/hosts
#more /etc/hosts
127.0.0.1 localhost
172.16.3.3 hostname loghost
#more /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.
Currently this number is restricted to being a class
# A, B, or C network
number. In the future we should be able to support
# arbitrary network
numbers per the Classless Internet Domain Routing
# guidelines.
#
#
Both the network-number and the netmasks are specified in
# "decimal dot"
notation, e.g:
#
# 128.32.0.0 255.255.255.0
#vi /etc/netmasks
#more /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. Currently this
number is restricted to being a class
# A, B, or C network number. In the
future we should be able to support
# arbitrary network numbers per the
Classless Internet Domain Routing
# guidelines.
#
# Both the
network-number and the netmasks are specified in
# "decimal dot" notation,
e.g:
#
# 128.32.0.0 255.255.255.0
172.16.3.0 255.255.255.0
#
reboot
总结一下,要修改Solaris的IP地址,主要需要改三个文件,分别是/etc/hosts, /etc/netmasks,
/etc/inet/ipnodes。如果想修改网关的话,还需要改/etc/defaultrouter文件。