+ -
当前位置:首页 → 问答吧 → 为什么我总遇上这种奇怪的事情——etc下的设置文件貌似都失灵了?

为什么我总遇上这种奇怪的事情——etc下的设置文件貌似都失灵了?

时间:2007-08-07

来源:互联网

我今天装好了gentoo后,启动系统,成功,然后先后发现了三件事情

首先,我没法上网,虽然我能ping到网关,网关也能ping到我(显然内网没问题),也在/etc/resolv.conf里设置好了dns,但稀奇的是就是ping不通外网,却可以ping网关(没有任何防护墙阻挡,网络是我做的我很清楚),而在安装前用系统自己net-setup设置的dns都能正常上网更新……

然后发现第二件事情,就是用ssh远程登录的时候,当输入了用户名root后,要等半天才出输入密码的框,而以前用cd启动时ssh速度飞快。

然后发现第三件事情,启动时,命令行里有个黄色的*提示

Your TIMEZONE in /etc/conf.d/clock is still set to Factory!
===============
发现问题,上网查找,第一个问题,我在屡次输入域名服务器无效后,想到一个办法,把在光盘启动时能访问网络的/etc/resolv.conf文件给拷贝到我的目录下,结果,仍然不行,现把我的resolv文件的内容贴出,请大家看有没有写错
代码:
 GNU nano 2.0.2 File: /etc/resolv.conf

nameserver 202.103.24.68
nameserver 202.103.44.150
第二个问题,经网络搜索,发现ssh连接会反向要求解析域名,随即想到自己目前无法访问域名服务器,导致连接ssh速度缓慢,解决办法,修改/etc/ssh/sshd_config文件,禁用dns解析,结果无效……/etc/ssh/sshd_config文件内容见下
代码:
GNU nano 2.0.2 File: /etc/ssh/sshd_config

# $OpenBSD: sshd_config,v 1.74 2006/07/19 13:07:10 dtucker Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

#Port 22
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/lib/misc/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server
第三个问题,根据在论坛上找到的答案,要修改/etc/conf.d/clock内的东西,可我修改后启动,仍然没用,仍然提示我clcok是工厂状态……
代码:
 GNU nano 2.0.2 File: /etc/conf.d/clock

# /etc/conf.d/clock

# Set CLOCK to "UTC" if your system clock is set to UTC (also known as
# Greenwich Mean Time). If your clock is set to the local time, then
# set CLOCK to "local". Note that if you dual boot with Windows, then
# you should set it to "local".

CLOCK="local"

# Select the proper timezone. For valid values, peek inside of the
# /usr/share/zoneinfo/ directory. For example, some common values are
# "America/New_York" or "EST5EDT" or "Europe/Berlin".

#TIMEZONE="Asia/Shanghai"

# If you wish to pass any other arguments to hwclock during bootup,
# you may do so here.

CLOCK_OPTS=""

# If you want to set the Hardware Clock to the current System Time
# during shutdown, then say "yes" here.

CLOCK_SYSTOHC="no"


### ALPHA SPECIFIC OPTIONS ###

# If your alpha uses the SRM console, set this to "yes".
SRM="no"

# If your alpha uses the ARC console, set this to "yes".
ARC="no"
以上修改,我都是远程ssh用root用户登录进入,chroot进去后在绝对路径上修改的,我现在怀疑不是我写错了命令,而是某种原因导致etc下的命令设置系统不接受,特此请教高人,这问题我今天足足折腾了一天了,查了很多地方都找不到线索

作者: abcbuzhiming   发布时间: 2007-08-07

第三个问题
#TIMEZONE="Asia/Shanghai"

前面的#号要去掉才能生效。

作者: zxuan   发布时间: 2007-08-07

问题1:
你是怎么获取的ip?dhcp还是指定?如果是指定的,估计是你的网关地址没设对。
/etc/conf.d/net :
config_eth0=( "192.168.0.2/24" ) #这里设ip
routes_eth0=( "default gw 192.168.0.1" ) #这里设网关


问题2:
#ListenAddress 0.0.0.0
去掉注释,改成你电脑的ip(你没有固定ip?如果没有当然要解析了。)
例:
ListenAddress 192.168.2.1

作者: zhou3345   发布时间: 2007-08-07

引用:
作者: zxuan
第三个问题
#TIMEZONE="Asia/Shanghai"

前面的#号要去掉才能生效。
确实如此,请问是不是所有的参数设置都是这么规定的

引用:
作者: zhou3345
问题1:
你是怎么获取的ip?dhcp还是指定?如果是指定的,估计是你的网关地址没设对。
/etc/conf.d/net :
config_eth0=( "192.168.0.2/24" ) #这里设ip
routes_eth0=( "default gw 192.168.0.1" ) #这里设网关


问题2:
#ListenAddress 0.0.0.0
去掉注释,改成你电脑的ip(你没有固定ip?如果没有当然要解析了。)
例:
ListenAddress 192.168.2.1
第一个问题我自行解决了,其实是因为我的机器比较特别的原因,我机器上是为了将来做软路由,有两块网卡,我把两块网卡都设置了IP,由于网上几乎没有文章讲到一台linx机器上有两块网卡时,如果要使用其中一块网卡上网是怎么处理的,我就想当然的把两块网卡都设置了IP并且把其中一块设置了网关(我们这里的网络是通过一个宽带路由器adsl拨号出去的,网关设置的就是路由器的IP),结果我今天下午反复测试发现这样是行不通的,必须关掉一块网卡,另外一块网卡才能联外网,否则的话,两块网卡一起启动的话,会导致以下情况,默认的eth0能连通内网和网关,但上不了外网,另外一块eth1干脆连内网都不通……非要停一块,另外一块就正常了。

我现在唯一不爽的是eth0不知道怎么搞的居然在我机器里是默认启动的,我已经把他从default启动项里删除了,boot项里也没有,他还是能自动启动,我观察了一下eth0是紧跟着lo启动的,而且貌似排在default启动的前面,但是查不到他的启动项在哪里。因为我现在是用eth1连,搞的我每次启动系统后要手动去关eth0

作者: abcbuzhiming   发布时间: 2007-08-07

rc-update del net_eth0 default

设定两块网卡的IP也可以正常工作的,但你即然是ppoe拔号,就不要设定getware,DNS设与不设都无所谓的(pppoe的情况下)。

作者: linuxth   发布时间: 2007-08-07

引用:
作者: linuxth
rc-update del net_eth0 default

设定两块网卡的IP也可以正常工作的,但你即然是ppoe拔号,就不要设定getware,DNS设与不设都无所谓的(pppoe的情况下)。
老兄,要真“rc-update del net_eth0 default”这么简单的话我就不上来说了,你没仔细看我说的,我早就把eth0从default用你这个命令删除了,从/etc/Runlevels/default也看不到net.eth0,但是,邪门的是他就是能自动启动,我也搞不明白怎么回事,而且他貌似根本不是由default启动的,他跟着net.lo启动,它启动完了,启动命令行才滚动出default的,我观察了启动过程好多遍了

不是的,我现在还没pppoe拨号,系统还在更新,我现在是两块网卡,机器是都通过公司的宽带路由器+adsl猫上网,你知道的,这种上网方式都是要设置网关和DNS的。但我就发现这种状况下两块网卡一起启动是没法正常工作的,网上也没有任何帖子讲这种情况下的网卡应该怎么设置,总之我今天下午测试了不下20遍,确认在两块网卡都启动的情况下是没法正常工作的,非要stop一块,另外一块就正常了……

另外请教一下大家有没有好的拨号解决方案,这里的帖子我看过,貌似要实现断线自动拨号都很复杂啊……

作者: abcbuzhiming   发布时间: 2007-08-08

现实PPPOE自动重拔功能
当PPPOE断线后,用以下脚本实现自动重拔。
引用:
#!/sbin/runscript

depend() {
need net
}

start() {
ebegin "Starting ADSL"
/usr/sbin/adsl-start
eend $? "Connection Failed"
}

stop() {
ebegin "Stopping ADSL"
/usr/sbin/adsl-stop
eend $? "Failed to stop ADSL"
}
载入开机自动运行脚本。
引用:
mv adsl /etc/init.d
chmod a+x /etc/init.d/adsl
rc-update add adsl default
注:本代码不是我写的。

作者: linuxth   发布时间: 2007-08-08

引用:
作者: linuxth
现实PPPOE自动重拔功能
当PPPOE断线后,用以下脚本实现自动重拔。


载入开机自动运行脚本。


注:本代码不是我写的。
我就是看不明白这段代码,所以不敢尝试,我不喜欢用自己都不懂的东西,出了问题很难分析,现在就在分析zhllg提供的ppp的方案,听说可以自动判断有无需求而拨号,不知道这种功能具备断线自动重播否。

PS:双网卡在机器在内网模式下上网,经过我反复试验,得出一个结论,第一,第一块被启动的卡(默认是eth0)会有阻断第二块eth1的功能的能力,如果第一块卡启动后没被停止的话你把网线插到第二块卡上,eth1将完全不能工作,但是如果你把eth0给stop,让eth1发挥作用,此时,再次启动eth0,这下就变成eth1阻断eth0的功能了,eth0将瘫痪,可能这是一种网络机制也说不定,另外,我发现,一旦你在/etc/init.d里用ln命令把一块卡和net.lo挂上了,就算你把这卡的启动项从default删除,系统仍然能检测到这块卡,这块卡会随着net.lo启动,除非删除init.d里的这块卡的连接……

作者: abcbuzhiming   发布时间: 2007-08-08

你的这个问题还是因为路由的设置问题,两块网卡也只要一个路由就可以了。例如:
config_eth0=( "192.168.0.2/24" )
routes_eth0=( "default gw 192.168.0.1" )
config_eth1=( "192.168.2.1/24" )
这里eth1不要写网关。因为如果戴两块表就不知道正确时间了。

eth0或eth1的定义是由udev来做的,归 /etc/udev/rules.d/70-persistent-net.rules 文件管。自动识别之后想自己调整,去改这个文件。

作者: zhou3345   发布时间: 2007-08-08

肯定是你路由设的有问题,你把两块网卡都配好,用route命令看看路由表

如果你非想不使用eth0的话,好像可以config_eth0=( "none" ),具体记不清了,例子里有

作者: helium_sun   发布时间: 2007-08-08

引用:
作者: zhou3345
你的这个问题还是因为路由的设置问题,两块网卡也只要一个路由就可以了。例如:
config_eth0=( "192.168.0.2/24" )
routes_eth0=( "default gw 192.168.0.1" )
config_eth1=( "192.168.2.1/24" )
这里eth1不要写网关。因为如果戴两块表就不知道正确时间了。

eth0或eth1的定义是由udev来做的,归 /etc/udev/rules.d/70-persistent-net.rules 文件管。自动识别之后想自己调整,去改这个文件。
有个问题,你的命令行怎么是
default gw 192.168.0.1
我看到的都是
default via 192.168.0.1

是不是有什么区别?

作者: abcbuzhiming   发布时间: 2007-08-08

网卡设置我一直都没更新,在原来的手册里用的是gw,也就是gateway网关。现在的手册可能改成via(通过...)了,这不是关键。

作者: zhou3345   发布时间: 2007-08-08

热门下载

更多