LinuxSir.cn,穿越时空的Linuxsir!

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

求助:设置静态IP后能拨号但是不能上网?

[复制链接]
发表于 2007-1-16 12:59:58 | 显示全部楼层 |阅读模式
困惑很久了,调了好多次没有解决..

先说明一下:
只有一张网卡
我的IP:192.168.3.25
网关:   192.168.3.99
DNS:   202.115.64.33/34
想法:网关的主机开机了我不用拨号就能上网(这个没有问题),
         他不开机我自己拨号上网...


补充点:学校网络类似局域网
            设为同一IP段可以相互访问的,拨号是虚拟拨号(pppoe)

目前问题是网关的主机不开,我能拨号,但是上不去,
netconfig ,设置为 loopback模式
(loopback   Set up a loopback connection (modem or no net))
能拨号而且可以上网。

dns应该没什么问题吧..
[PHP]yu@love:~$ cat /etc/resolv.conf
nameserver 202.115.64.33
nameserver 202.115.64.34
[/PHP]

/etc/rc.d/rc.inet1.conf 的设置
[PHP]root@love:~# cat /etc/rc.d/rc.inet1.conf
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# You can configure network interfaces other than eth0,eth1... by setting
# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
# or empty, it is assumed you're configuring eth<interface>.

# Several other parameters are available, the end of this file contains a
# comprehensive set of examples.

# =============================================================================

# Config information for eth0:
IPADDR[0]="192.168.3.25"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]=""
DHCP_HOSTNAME[0]=""

# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

# Config information for eth2:
IPADDR[2]=""
NETMASK[2]=""
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""

# Config information for eth3:
IPADDR[3]=""
NETMASK[3]=""
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""

# Default gateway IP address:
GATEWAY="192.168.3.99"

# Change this to "yes" for debugging output to stdout.  Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="no"

## Example config information for wlan0.  Uncomment the lines you need and fill
## in your info.  (You may not need all of these for your wireless network)
#IFNAME[4]="wlan0"
#IPADDR[4]=""
#NETMASK[4]=""
#USE_DHCP[4]="yes"
#DHCP_HOSTNAME[4]="icculus-wireless"
#DHCP_KEEPRESOLV[4]="yes"
#DHCP_KEEPNTP[4]="yes"
#DHCP_KEEPGW[4]="yes"
#DHCP_IPADDR[4]=""
#WLAN_ESSID[4]=BARRIER05
#WLAN_MODE[4]=Managed
##WLAN_RATE[4]="54M auto"
##WLAN_CHANNEL[4]="auto"
##WLAN_KEY[4]="D5AD1F04ACF048EC2D0B1C80C7"
##WLAN_IWPRIV[4]="AuthMode=WPAPSK EncrypType=TKIP WPAPSK=7B1ABEEB5D197741923ED26727569C365E31212096A0EAFAD563B268BAD01CAF TxRate=0"
#WLAN_WPA[4]="wpa_supplicant"
#WLAN_WPADRIVER[4]="ndiswrapper"

## Some examples of additional network parameters that you can use.
## Config information for wlan0:
#IFNAME[4]="wlan0"              # Use a different interface name nstead of
                                # the default 'eth4'
#HWADDR[4]="00:01:23:45:67:89"  # Overrule the card's hardware MAC address
#MTU[4]=""                      # The default MTU is 1500, but you might need
                                # 1360 when you use NAT'ed IPSec traffic.
#DHCP_KEEPRESOLV[4]="yes"       # If you dont want /etc/resolv.conf overwritten
#DHCP_KEEPNTP[4]="yes"          # If you don't want ntp.conf overwritten
#DHCP_KEEPGW[4]="yes"           # If you don't want the DHCP server to change
                                # your default gateway
#DHCP_IPADDR[4]=""              # Request a specific IP address from the DHCP
                                # server
#WLAN_ESSID[4]=DARKSTAR         # Here, you can override _any_ parameter
                                # defined in rc.wireless.conf, by prepending
                                # 'WLAN_' to the parameter's name. Useful for
                                # those with multiple wireless interfaces.
#WLAN_IWPRIV[4]="AuthMode=WPAPSK EncrypType=TKIP WPAPSK=thekey TxRate=0"
                                # Some drivers require a private ioctl to be
                                # set through the iwpriv command. If more than
                                # one is required, you can place them in the
                                # IWPRIV parameter (space-separated, see the
                                # example).

[/PHP]

/etc/ppp/pppoe.conf 设置
[PHP]root@love:~# cat /etc/ppp/pppoe.conf
#***********************************************************************
#
# pppoe.conf
#
# Configuration file for rp-pppoe.  Edit as appropriate and install in
# /etc/ppp/pppoe.conf
#
# NOTE: This file is used by the pppoe-start, pppoe-stop, pppoe-connect and
#       pppoe-status shell scripts.  It is *not* used in any way by the
#       "pppoe" executable.
#
# Copyright (C) 2000 Roaring Penguin Software Inc.
#
# This file may be distributed under the terms of the GNU General
# Public License.
#
# LIC: GPL
# $Id: pppoe.conf,v 1.11 2005/08/09 02:49:12 dfs Exp $
#***********************************************************************

# When you configure a variable, DO NOT leave spaces around the "=" sign.

# Ethernet card connected to DSL modem
ETH='eth0'

# PPPoE user name.  You may have to supply "@provider.com"  Sympatico
# users in Canada do need to include "@sympatico.ca"
# Sympatico uses PAP authentication.  Make sure /etc/ppp/pap-secrets
# contains the right username/password combination.
# For Magma, use xxyyzz@magma.ca
USER='fishyu@cer'

# Bring link up on demand?  Default is to leave link up all the time.
# If you want the link to come up on demand, set DEMAND to a number indicating
# the idle time after which the link is brought down.
DEMAND=no
#DEMAND=300

# DNS type: SERVER=obtain from server; SPECIFY=use DNS1 and DNS2;
# NOCHANGE=do not adjust.
DNSTYPE=SPECIFY

# Obtain DNS server addresses from the peer (recent versions of pppd only)
# In old config files, this used to be called USEPEERDNS.  Changed to
# PEERDNS for better Red Hat compatibility
PEERDNS=no

DNS1=202.115.64.33
DNS2=202.115.64.34

# Make the PPPoE connection your default route.  Set to
# DEFAULTROUTE=no if you don't want this.
DEFAULTROUTE=no
不知道这个是什么意思,设为yes和no好像都不行,下面的我没有更改过


### ONLY TOUCH THE FOLLOWING SETTINGS IF YOU'RE AN EXPERT

# How long pppoe-start waits for a new PPP interface to appear before
# concluding something went wrong.  If you use 0, then pppoe-start
# exits immediately with a successful status and does not wait for the
# link to come up.  Time is in seconds.
#
# WARNING WARNING WARNING:
#
# If you are using rp-pppoe on a physically-inaccessible host, set
# CONNECT_TIMEOUT to 0.  This makes SURE that the machine keeps trying
# to connect forever after pppoe-start is called.  Otherwise, it will
# give out after CONNECT_TIMEOUT seconds and will not attempt to
# connect again, making it impossible to reach.
CONNECT_TIMEOUT=30

# How often in seconds pppoe-start polls to check if link is up
CONNECT_POLL=2

# Specific desired AC Name
ACNAME=

# Specific desired service name
SERVICENAME=

# Character to echo at each poll.  Use PING="" if you don't want
# anything echoed
PING="."

# File where the pppoe-connect script writes its process-ID.
# Three files are actually used:
#   $PIDFILE       contains PID of pppoe-connect script
#   $PIDFILE.pppoe contains PID of pppoe process
#   $PIDFILE.pppd  contains PID of pppd process
CF_BASE=`basename $CONFIG`
PIDFILE="/var/run/$CF_BASE-pppoe.pid"

# Do you want to use synchronous PPP?  "yes" or "no".  "yes" is much
# easier on CPU usage, but may not work for you.  It is safer to use
# "no", but you may want to experiment with "yes".  "yes" is generally
# safe on Linux machines with the n_hdlc line discipline; unsafe on others.
SYNCHRONOUS=no

# Do you want to clamp the MSS?  Here's how to decide:
# - If you have only a SINGLE computer connected to the DSL modem, choose
#   "no".
# - If you have a computer acting as a gateway for a LAN, choose "1412".
#   The setting of 1412 is safe for either setup, but uses slightly more
#   CPU power.
CLAMPMSS=1412
#CLAMPMSS=no

# LCP echo interval and failure count.
LCP_INTERVAL=20
LCP_FAILURE=3

# PPPOE_TIMEOUT should be about 4*LCP_INTERVAL
PPPOE_TIMEOUT=80

# Firewalling: One of NONE, STANDALONE or MASQUERADE
FIREWALL=STANDALONE

# Linux kernel-mode plugin for pppd.  If you want to try the kernel-mode
# plugin, use LINUX_PLUGIN=/etc/ppp/plugins/rp-pppoe.so
LINUX_PLUGIN=

# Any extra arguments to pass to pppoe.  Normally, use a blank string
# like this:
PPPOE_EXTRA=""

# Rumour has it that "Citizen's Communications" with a 3Com
# HomeConnect DSL Modem DualLink requires these extra options:
# PPPOE_EXTRA="-f 3c12:3c13 -S ISP"

# Any extra arguments to pass to pppd.  Normally, use a blank string
# like this:
PPPD_EXTRA=""


########## DON'T CHANGE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING
# If you wish to COMPLETELY overrride the pppd invocation:
# Example:
# OVERRIDE_PPPD_COMMAND="pppd call dsl"

# If you want pppoe-connect to exit when connection drops:
# RETRY_ON_FAILURE=no
[/PHP]

主机没开或者没上网,自己拨号出现的问题
[PHP]root@love:~# pppoe-start
.. Connected!
root@love:~# pppoe-status
pppoe-status: Link is up and running on interface ppp0
ppp0      Link encapoint-to-Point Protocol
          inet addr:124.161.75.129  P-t-P:124.161.75.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:30 (30.0 b)  TX bytes:37 (37.0 b)

root@love:~# ping 202.115.64.33
PING 202.115.64.33 (202.115.64.33) 56(84) bytes of data.
From 192.168.3.25 icmp_seq=2 Destination Host Unreachable
From 192.168.3.25 icmp_seq=3 Destination Host Unreachable
[/PHP]

奇怪这么会是 from 192.168.3.25
另外 man pppoe看到的,不会是eth0不能有IP吧
OPTIONS
       -I interface
              The  -I  option  specifies  the  Ethernet interface to use.  Under Linux, it is typically eth0 or
              eth1.  The interface should be "up" before you start pppoe, but should not be configured to  have
              an IP address.

有望多多 指点,谢谢
 楼主| 发表于 2007-1-16 19:24:35 | 显示全部楼层

人呢?
回复 支持 反对

使用道具 举报

发表于 2007-1-16 21:47:43 | 显示全部楼层
我来回一个。其实没大看你贴出来的那么多东东
你设定了静态ip192.168.xx.xx,拨号自然就行不通了啊,它要给你分一个外网的ip才能上网啊。
我觉得你这种情况最好是设置adsl猫自动拨号,它一般都带路由和dhcp,然后整个hub连一下就可以了,能带好几台电脑上网呢。
如果你不想再多买个hub,就把网卡重新设一下,再ppoeconf。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-16 21:57:12 | 显示全部楼层
Post by brucebird
我来回一个。其实没大看你贴出来的那么多东东
你设定了静态ip192.168.xx.xx,拨号自然就行不通了啊,它要给你分一个外网的ip才能上网啊。
我觉得你这种情况最好是设置adsl猫自动拨号,它一般都带路由和dhcp,然后整个hub连一下就可以了,能带好几台电脑上网呢。
如果你不想再多买个hub,就把网卡重新设一下,再ppoeconf。


呵呵,谢谢
在学校宿舍的
学校IP不够用经常无法拨号,共享也可以省点网费
不过在xp下面倒是一点问题都没有(装了个pppoe同时共享上网)

设为loopback后好像不重启不行,比较麻烦就是了
/etc/rc.d/rc.inet1 restart 只能改ip

不过改天试试把网关留空试试...(现在又播不上号)

补充点:学校网络类似局域网
            设为同一IP段可以相互访问的,拨号是虚拟拨号(pppoe)
回复 支持 反对

使用道具 举报

发表于 2007-1-18 02:55:20 | 显示全部楼层
拨号时,不设网关试试
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-18 10:39:45 | 显示全部楼层
这几天没有网号,痛苦..

前天搜索时候好像看到说单网卡共享上网确实是问题
不过可以虚拟网卡or透明代理..
有点复杂
回复 支持 反对

使用道具 举报

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

本版积分规则

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