|
 |
栏目导栏 |
|
| |
|
|
|
|
 |
资料搜索 |
|
| |
|
|
|
|
 |
热门文章 |
|
| |
|
|
|
|
 |
最新文章 |
|
| |
|
|
|
| |
| |
|
|
|
[ 作者: Linux联盟收集 加入时间:2006-06-25 15:26:07 来自:Linux联盟收集
] | |
|
一、如何创建自己的启动脚本 RhWLinux联盟 RhWLinux联盟 现在创建一个简单的服务器进程启动脚本。假设该进程的可执行文件为/sbin/sample_server,该进程将在运行水平3上启动,运行水平2上关闭。 RhWLinux联盟 1 在/etc/init.d目录下创建一个启动脚本.将该脚本保存为文件/etc/init.d/my_server. RhWLinux联盟 这个脚本如下所示: RhWLinux联盟 RhWLinux联盟 #!/sbin/sh RhWLinux联盟 case "$1" in RhWLinux联盟 'start') RhWLinux联盟 if [ -f /sbin/sample_server ]; then RhWLinux联盟 /sbin/sample_server RhWLinux联盟 fi RhWLinux联盟 ;; RhWLinux联盟 RhWLinux联盟 'stop') RhWLinux联盟 /usr/bin/pkill -x -u 0 sample_server RhWLinux联盟 ;; RhWLinux联盟 RhWLinux联盟 *) RhWLinux联盟 echo "Usage: $0 { start | stop }" RhWLinux联盟 exit 1 RhWLinux联盟 ;; RhWLinux联盟 esac RhWLinux联盟 exit 0 RhWLinux联盟 ~ RhWLinux联盟 ~ RhWLinux联盟 ~ RhWLinux联盟 ~ RhWLinux联盟 ~ RhWLinux联盟 2 使用命令将脚本链接至启动和关闭目录 RhWLinux联盟 RhWLinux联盟 bash-2.03#ln -s /etc/init.d/sample_server /etc/rc3.d/S900my_server RhWLinux联盟 bash-2.03#ln -s /etc/init.d/sample_server /etc/rc2.d/K900my_server RhWLinux联盟 bash-2.03#netstat -a 这个命令会列出当前运行着的所有服务列表.显示的是端口和套接字 的监听状态。 RhWLinux联盟 RhWLinux联盟 二、DHCP 服务 RhWLinux联盟 不知道有没有人在Solaris中使用SUN的DHCP服务器,反正我是没用过,呵呵,自己也只是随便用用 RhWLinux联盟 1 常用的DHCP配置实用程序 RhWLinux联盟 dhtadm DHCP配置表管理程序 RhWLinux联盟 dhcpconfig DHCP服务配置程序 RhWLinux联盟 dhcpmgr(/usr/sadm/admin/bin/dhcpmgr) 图形化的DHCP管理器 RhWLinux联盟 dntadm DHCP网络表管理程序 RhWLinux联盟 2 对于图形化的服务配置方法,只要按提示配置即可,多数情况下是按回车 RhWLinux联盟 RhWLinux联盟 bash-2.03# /usr/sadm/admin/bin/dhcpmgr (配置界面会自动启动) RhWLinux联盟 RhWLinux联盟 3 Solaris中传统的DHCP配置实用程序是dhcpconfig,配置和解除服务都是用它,图形程序在后台也是使用的它。注意,如果对于提问不输入任何的内容,多数将采用默认值,每个问题对应的默认值在方括号中。 RhWLinux联盟 RhWLinux联盟 bash-2.03# dhcpconfig RhWLinux联盟 *** DHCP Configuration *** RhWLinux联盟 RhWLinux联盟 RhWLinux联盟 Would you like to: RhWLinux联盟 RhWLinux联盟 1) Configure DHCP Service RhWLinux联盟 RhWLinux联盟 2) Configure BOOTP Relay Agent RhWLinux联盟 RhWLinux联盟 3) Unconfigure DHCP or Relay Service RhWLinux联盟 RhWLinux联盟 4) Exit RhWLinux联盟 RhWLinux联盟 RhWLinux联盟 RhWLinux联盟 Choice: 1 # 1配置,3是解除 RhWLinux联盟 RhWLinux联盟 ### DHCP Service Configuration ### RhWLinux联盟 ### Configure DHCP data store and location ### RhWLinux联盟 RhWLinux联盟 Enter data store (SUNWbinfiles, SUNWfiles or SUNWnisplus) [SUNWnisplus]: SUNWfiles #选择数据存储,文本 RhWLinux联盟 Enter full path to data location [/var/dhcp]: # 数据存储的路径,可修改 RhWLinux联盟 Enter location for hosts data (none, files, dns, or nisplus) [none]: files # 数据存储模式,如果不使用NIS+,选择文本 RhWLinux联盟 Enter default DHCP lease policy (in days) [3]: # IP更新策略,每一天一更新 RhWLinux联盟 Do you want to allow clients to renegotiate their leases? ([Y]/N):y # 同意客户端更新IP地址 RhWLinux联盟 Created DHCP configuration file. RhWLinux联盟 Created dhcptab. RhWLinux联盟 Added "Locale" macro to dhcptab. RhWLinux联盟 Added server macro to dhcptab - txd01. RhWLinux联盟 DHCP server started. RhWLinux联盟 RhWLinux联盟 ### Common daemon option setup ### RhWLinux联盟 RhWLinux联盟 Would you like to specify nondefault daemon options (Y/[N]):n # DHCP的后台程序指定,比如SYSLOG RhWLinux联盟 RhWLinux联盟 ### DHCP server option setup ### RhWLinux联盟 RhWLinux联盟 Would you like to specify nondefault server options (Y/[N]): n # 设置DHCP的不同选项,为简便,选 N RhWLinux联盟 RhWLinux联盟 ### Select Networks For BOOTP/DHCP Support ### RhWLinux联盟 RhWLinux联盟 Enable DHCP/BOOTP support of networks you select? ([Y]/N):y # 同意启用网络上DHCP支持 RhWLinux联盟 RhWLinux联盟 ### Configure Local Networks ### RhWLinux联盟 RhWLinux联盟 Configure BOOTP/DHCP on local LAN network: 192.168.0.0? ([Y]/N):y # 本地网络 RhWLinux联盟 Do you want hostnames generated and inserted in the SUNWfiles hosts table? (Y/[N]):n RhWLinux联盟 Enter starting IP address [192.168.0.0]: 192.168.0.100 # IP地址池的初始IP RhWLinux联盟 Enter the number of clients you want to add (x < 255): 10 # IP地址池的IP数量 RhWLinux联盟 Disable (ping) verification of 192.168.0.0 address(es)? (Y/[N]):n # 不要关闭ping验证 RhWLinux联盟 90% Complete. RhWLinux联盟 Configured 10 entries for network: 192.168.0.0. RhWLinux联盟 RhWLinux联盟 ### Configure Remote Networks ### RhWLinux联盟 RhWLinux联盟 Would you like to configure BOOTP/DHCP service on remote networks? ([Y]/N): RhWLinux联盟 RhWLinux联盟 三、常见的以太网故障解决方法命令 RhWLinux联盟 1 ifconfig RhWLinux联盟 基本上会用solaris的人,就应该会用这个命令了,它可以列出系统安装的所有的网络接口的详细信息. RhWLinux联盟 RhWLinux联盟 bash-2.03# ifconfig -a RhWLinux联盟 lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4>; mtu 8232 index 1 RhWLinux联盟 inet 127.0.0.1 netmask ff000000 RhWLinux联盟 hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4>; mtu 1500 index 2 RhWLinux联盟 inet 192.168.0.188 netmask ffffff00 broadcast 192.168.0.255 RhWLinux联盟 ether 8:0:20:a7:91:ce RhWLinux联盟 这个命令也可以用来创建和配置系统要安装的网络接口,后面我会有详细的例子. RhWLinux联盟 2 netstat RhWLinux联盟 该命令有多种用途,例如显示路由表、可用的服务端口以及目前建立的连接等。 RhWLinux联盟 RhWLinux联盟 bash-2.03# netstat RhWLinux联盟 RhWLinux联盟 TCP: IPv4 RhWLinux联盟 Local Address Remote Address Swind Send-Q Rwind Recv-Q State RhWLinux联盟 -------------------- -------------------- ----- ------ ----- ------ ------- RhWLinux联盟 u10.32783 192.168.0.118.6000 65219 0 24820 0 ESTABLISHED RhWLinux联盟 u10.32797 192.168.0.118.6000 65391 0 24820 0 ESTABLISHED RhWLinux联盟 u10.32798 192.168.0.118.
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|
|
|
|
|