CentOS adsl 拨号共享上网

陈钰铠 发布于 2013/06/07 15:58
阅读 1K+
收藏 0
 

eth0 连接内网

DEVICE=eth0
HWADDR=00:e0:4c:e2:6a:af
TYPE=Ethernet
UUID=82f11ffe-a88c-4849-9bd8-53dd85f85c31
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
NETWORK=192.168.0.0
IPV6INIT=no
USERCTL=no

eth1 外网

DEVICE=eth1
HWADDR=00:e0:4c:10:0a:98
TYPE=Ethernet
UUID=1d0dd10c-ce59-44b0-8da7-c488a235f7aa
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
IPV6INIT=no
USERCTL=no

adsl  拨号用rp-pppoe

执行/etc/init.d/network restart时

正在关闭接口 ppp0:                                        [确定]
正在关闭接口 eth0: 设备状态:3 (断开连接)
                                                           [确定]
正在关闭接口 eth1: 设备状态:3 (断开连接)
                                                           [确定]
关闭环回接口:                                             [确定]
弹出环回接口:                                             [确定]
弹出界面 eth0: 活跃连接状态:激活的
活跃连接路径:/org/freedesktop/NetworkManager/ActiveConnection/4
                                                           [确定]
弹出界面 eth1: 活跃连接状态:激活的
活跃连接路径:/org/freedesktop/NetworkManager/ActiveConnection/5
                                                           [确定]
弹出界面 ppp0:( 这里持续很长时间) /usr/sbin/adsl-start: line 217: 13802 Terminated              $CONNECT "$@" > /dev/null 2>&1
                                                           [失败]

再重新连接时,sudo pppoe-start (adsl-start) 网页就打不开了。

用ifconfig 显示已经连接

eth0      Link encap:Ethernet  HWaddr 00:E0:4C:E2:6A:AF  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:4cff:fee2:6aaf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:263 errors:0 dropped:0 overruns:0 frame:0
          TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:23634 (23.0 KiB)  TX bytes:7472 (7.2 KiB)

eth1      Link encap:Ethernet  HWaddr 00:E0:4C:10:0A:98  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:4cff:fe10:a98/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25342 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20674 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:24995722 (23.8 MiB)  TX bytes:2508840 (2.3 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3312 (3.2 KiB)  TX bytes:3312 (3.2 KiB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:183.55.231.60  P-t-P:183.55.228.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:207 errors:0 dropped:0 overruns:0 frame:0
          TX packets:189 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:24577 (24.0 KiB)  TX bytes:24456 (23.8 KiB)

重新拨号也不能上网 必须要重新设置一次   sudo pppoe-setup 才能上网.

sudo pppoe-setup

Welcome to the PPPoE client setup.  First, I will run some checks on
your system to make sure the PPPoE client is installed properly...

The following DSL config was found on your system:

  Device:      Name:
  ppp0         DSLppp0

Please enter the device if you want to configure the present DSL config
(default ppp0) or enter 'n' if you want to create a new one:

LOGIN NAME

Enter your Login Name (default XXXXXXX):

INTERFACE

Enter the Ethernet interface connected to the PPPoE modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where 'X' is a number.
(default eth1):

Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped.  If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses.  You may have some problems with demand-activated links.
Enter the demand value (default no):

DNS

Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
Enter the DNS information here: 202.96.134.33
Please enter the IP address of your ISP's secondary DNS server.
If you just press enter, I will assume there is only one DNS server.
Enter the secondary DNS server address here: 202.96.128.86

PASSWORD

Please enter your Password:
Please re-enter your Password:

USERCTRL

Please enter 'yes' (three letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes):

FIREWALLING

Please choose the firewall rules to use.  Note that these rules are
very basic.  You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security.  If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself.  Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc.  If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.

The firewall choices are:
0 - NONE: This script will not set any firewall rules.  You are responsible
          for ensuring the security of your machine.  You are STRONGLY
          recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
                for a LAN
Choose a type of firewall (0-2): 1( 设置0:作过两种设置,不知是不是这里出问题了?

Start this connection at boot time

Do you want to start this connection at boot time?
Please enter no or yes (default no):

** Summary of what you entered **

Ethernet Interface: eth1
User name:          XXXXXX
Activate-on-demand: No
Primary DNS:        202.96.134.33
Secondary DNS:      202.96.128.86
Firewalling:        STANDALONE
User Control:       yes
Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/resolv.conf
  (But first backing it up to /etc/resolv.conf.bak)
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
  (But first backing it up to /etc/ppp/chap-secrets.bak)
  (But first backing it up to /etc/ppp/pap-secrets.bak)



Congratulations, it should be all set up!

Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'
to bring it down.
Type '/sbin/pppoe-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
to see the link status.


上网后执行这两条命令

echo "1">/proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE

客户机双系统xp和CentOS IP皆作以下设置

ip:192.168.0.118

255.255.255.0

网关:192.168.0.1

dns无论是设为192.168.0.1还是202.96.134.33 都不能上网 但是客户机和服务器主机能互相ping 通?

请大家指点一下,问题出在哪里?

( 主机安装的是多系统,同样的客户机,无论是windows server 2008还是另外的debian系统经过设置之后,客户机都能正常上网,唯独是CentOS不行。)
 


加载中
返回顶部
顶部