LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 749|回复: 7

求助linux服务器故障,各位高手帮忙

[复制链接]
发表于 2005-12-30 11:46:07 | 显示全部楼层 |阅读模式
公司的服务器操作系统是linux,每次我们上网总会遇到无法浏览网页的问题,然后在服务器上执行
/etc/rc.d/open.sh 和/etc/init.d/sshd restart 这两个命令后网络就恢复正常, 可是过一会又不能浏览了,但是qq在线。
我以前对linux接触很少,才刚刚学。请教各位高手,这是什么原因造成的?我该怎么解决啊?谢谢!在线等待答复!
发表于 2006-1-1 11:11:30 | 显示全部楼层
QQ对网络的反映是有延迟的。

一般QQ在线而不能浏览网页是DNS配置错误,
不能浏览网页时分别在服务器和客户机上执行:
ping xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx 是ip地址
nslookup www.163.com

ping 不通是网络连接断了,nslookup找不到ip是DNS错了。

还可以用
traceroute xxx.xxx.xxx.xxx
来确定是卡在了哪里。

那个/etc/rc.d/open.sh 是什么?
回复 支持 反对

使用道具 举报

发表于 2006-1-1 12:06:51 | 显示全部楼层
dns问题
因为qq不用dns的直接连接ip的
回复 支持 反对

使用道具 举报

发表于 2006-1-2 13:56:55 | 显示全部楼层
把open.sh这个脚本贴出来看看
sshd那个只是启动ssh 服务。。应该和尚不上网无关
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-4 13:27:24 | 显示全部楼层
这个是用vi打开的sshd文件
[root@ProxyServer init.d]# vi sshd
#!/bin/bash
#
# Init file for OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: OpenSSH server daemon
#
# processname: sshd
# config: /etc/ssh/ssh_host_key
# config: /etc/ssh/ssh_host_key.pub
# config: /etc/ssh/ssh_random_seed
# config: /etc/ssh/sshd_config
# pidfile: /var/run/sshd.pid

# source function library
. /etc/rc.d/init.d/functions

# pull in sysconfig settings
[ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd

RETVAL=0
prog="sshd"

"sshd" 154L, 2647C
#!/bin/bash
#
# Init file for OpenSSH server daemon
#
# chkconfig: 2345 55 25
# description: OpenSSH server daemon
#
# processname: sshd
# config: /etc/ssh/ssh_host_key
# config: /etc/ssh/ssh_host_key.pub
# config: /etc/ssh/ssh_random_seed
# config: /etc/ssh/sshd_config
# pidfile: /var/run/sshd.pid

# source function library
. /etc/rc.d/init.d/functions

# pull in sysconfig settings
[ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd

RETVAL=0
prog="sshd"

# Some functions to make the below more readable
KEYGEN=/usr/bin/ssh-keygen
SSHD=/usr/sbin/sshd
RSA1_KEY=/etc/ssh/ssh_host_key
RSA_KEY=/etc/ssh/ssh_host_rsa_key
DSA_KEY=/etc/ssh/ssh_host_dsa_key
PID_FILE=/var/run/sshd.pid

do_rsa1_keygen() {
        if [ ! -s $RSA1_KEY ]; then
                echo -n $"Generating SSH1 RSA host key: "
                if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then
                        chmod 600 $RSA1_KEY
                        chmod 644 $RSA1_KEY.pub
                        success $"RSA1 key generation"
                        echo
                else
                        failure $"RSA1 key generation"
                        echo
                        exit 1
                fi
        fi
}

do_rsa_keygen() {
        if [ ! -s $RSA_KEY ]; then
                echo -n $"Generating SSH2 RSA host key: "
                if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then
                        chmod 600 $RSA_KEY
                        chmod 644 $RSA_KEY.pub
                        success $"RSA key generation"
                        echo
                else
                        failure $"RSA key generation"
                        echo
                        exit 1
                fi
        fi
}

do_dsa_keygen() {
        if [ ! -s $DSA_KEY ]; then
                echo -n $"Generating SSH2 DSA host key: "
                if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then
                        chmod 600 $DSA_KEY
                        chmod 644 $DSA_KEY.pub
                        success $"DSA key generation"
                        echo
                else
                        failure $"DSA key generation"
                        echo
                        exit 1
                fi
        fi
}

do_restart_sanity_check()
{
        $SSHD -t
        RETVAL=$?
        if [ ! "$RETVAL" = 0 ]; then
                failure $"Configuration file or keys are invalid"
                echo
        fi
}

start()
{
        # Create keys if necessary
        do_rsa1_keygen
        do_rsa_keygen
        do_dsa_keygen

        echo -n $"Starting $prog:"
        initlog -c "$SSHD $OPTIONS" && success || failure
        RETVAL=$?
        [ "$RETVAL" = 0 ] && touch /var/lock/subsys/sshd
        echo
}

stop()
{
        echo -n $"Stopping $prog:"
        killproc $SSHD -TERM
        RETVAL=$?
        [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/sshd
        echo
}

reload()
{
        echo -n $"Reloading $prog:"
        killproc $SSHD -HUP
        RETVAL=$?
        echo
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                start
                ;;
        reload)
                reload
                ;;
        condrestart)
                if [ -f /var/lock/subsys/sshd ] ; then
                        do_restart_sanity_check
                        if [ "$RETVAL" = 0 ] ; then
                                stop
                                # avoid race
                                sleep 3
                                start
                        fi
                fi
                ;;
        status)
                status $SSHD
                RETVAL=$?
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
                RETVAL=1
esac
exit $RETVAL
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-4 13:49:40 | 显示全部楼层
cxfcxf 如果按照你说的是不是就和/etc/rc.d/open.sh 有关 ?
guoke  谢谢你 那几个命令我都记下了 一会再不能访问网页就用
回复 支持 反对

使用道具 举报

发表于 2006-1-4 18:09:12 | 显示全部楼层
我就是想知道 你说要运行open.sh才能上 那么这个脚本的作用是什么 如果是无关脚本。。那么可以把问题缩小 要是的确是靠这个脚本的 那么你贴出来看看这个脚本的作用 可以方便大家分析问题
回复 支持 反对

使用道具 举报

发表于 2006-1-11 21:12:46 | 显示全部楼层
那就自己写个shell脚本,让他自动定时自动运行
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表