GVKun编程网logo

CentOS 6.4 电信ADSL 拨号连接的配置(centos宽带拨号)

3

本文将介绍CentOS6.4电信ADSL拨号连接的配置的详细情况,特别是关于centos宽带拨号的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于C#

本文将介绍CentOS 6.4 电信ADSL 拨号连接的配置的详细情况,特别是关于centos宽带拨号的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于C# 实现ADSL自动断网和拨号的方法(适用于拨号用户)、CentOS 6和CentOS 7上搭建web服务器的SSL证书配置、CentOS 7拨号上网(ADSL & PPPoE)、CentOS adsl 拨号共享上网的知识。

本文目录一览:

CentOS 6.4 电信ADSL 拨号连接的配置(centos宽带拨号)

CentOS 6.4 电信ADSL 拨号连接的配置(centos宽带拨号)

1.下载 rp-pppoe-3.8.tar.gz

http://down1.chinaunix.net/distfiles/rp-pppoe-3.8.tar.gz

2.安装 rp-pppoe(对文件所在文件夹右键在终端打开)

解压 rp-pppoe-3.8.tar.gz :


#tar -zxf rp-pppoe-3.8.tar.gz


进入生成的目录:


#cd rp-pppoe-3.8


在所在目录内运行脚本 go:


#./go


将自动进行编译和安装

3、网络配置 (红色为输入,蓝色为注释)

[root@Cheng liaojch3]#pppoe-setup (输入 pppoe-setup )



Welcome to the Roaring Penguin PPPoE client setup.
First,I will runsome checks on your system to make sure the PPPoE client is installedproperly...


Looks good!


Now,please enter some information:


USER NAME
>>> Enter your PPPoE user name (default cz743720):cz743720 (输入上网账号)

INTERFACE
>>> Enter the Ethernet interface connected to the DSL modem
For Solaris,this is likely to be something like /dev/hme0.
For Linux,it will be ethn,where 'n' is a number.
(default eth0):eth0 (选择你的网卡,默认为 eth0)


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 secondsafter which the link should be dropped.
If you want the link tostay 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):no (这里填 no 或 直接回车)


DNS

Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide 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.128.86 (输入首选 DNS 地址,这个很重要,我一开始看网上是填 sever 表示自动获取DNS,但没有成功,

后来我查了自己所在城市DNS地址,这里是广东“其他地区”的首选DNS,建议百度自己的DNS地址)



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.143 (备用 DNS 地址,同样查一下)



PASSWORD


>>> Please enter your PPPoE password: (输入密码)


>>> Please re-enter your PPPoE password: (再次输入密码)



FIREWALLING


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

The firewall choices are:
0 - NONE: This script will not set any firewall rules. You are responsiblefor ensuring the security of your machine.
You are STRONGLYrecommended 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):0 (选择防火墙,0表示不开启防火墙)


** Summary of what you entered **
Ethernet
Interface: eth0

User name: cz743720

Activate-on-demand: No

Primary DNS:202.96.128.86

Secondary DNS:202.96.128.143

Firewalling:NONE

>>> Accept these settings and adjust configuration files (y/n)?y (填 y 确认)




Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/resolv.conf (But first backing it up to /etc/resolv.conf-bak)
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets (But first backing it up to /etc/ppp/pap-secrets-bak) (But first backing it up to /etc/ppp/chap-secrets-bak)


Congratulations,it should be all set up!


Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring
it down. Type 'pppoe-status' to see the link status.


[root@Cheng liaojch3]#pppoe-start ( 用 pppoe-start 进行连接)

. Connected! (连接成功,你可以用 ping www.baiud.com 进行测试一下)

4、上网命令(用 root 权限)

拨号上网 pppoe-start
断开上网 pppoe-stop
查看状态 pppoe-status

C# 实现ADSL自动断网和拨号的方法(适用于拨号用户)

C# 实现ADSL自动断网和拨号的方法(适用于拨号用户)

封装类:

using System;
using System.Runtime.InteropServices;

public struct RASCONN
{
  public int dwSize;
  public IntPtr hrasconn;
  [MarshalAs(UnmanagedType.ByValTStr,SizeConst = 257)]
  public string szEntryName;
  [MarshalAs(UnmanagedType.ByValTStr,SizeConst = 17)]
  public string szDeviceType;
  [MarshalAs(UnmanagedType.ByValTStr,SizeConst = 129)]
  public string szDeviceName;
}

[StructLayout(LayoutKind.Sequential,CharSet = CharSet.Auto)]
public struct Rasstats
{
  public int dwSize;
  public int dwBytesXmited;
  public int dwBytesRcved;
  public int dwFramesXmited;
  public int dwFramesRcved;
  public int dwCrcErr;
  public int dwTimeoutErr;
  public int dwAlignmentErr;
  public int dwHardwareOverrunErr;
  public int dwFramingErr;
  public int dwBufferOverrunErr;
  public int dwCompressionRatioIn;
  public int dwCompressionRatioOut;
  public int dwBps;
  public int dwConnectionDuration;
}

[StructLayout(LayoutKind.Sequential,CharSet = CharSet.Auto)]
public struct RasEntryName
{
  public int dwSize;
  //[MarshalAs(UnmanagedType.ByValTStr,SizeConst=(int)RasFieldSizeConstants.RAS_MaxEntryName + 1)]
  public string szEntryName;
  //#if WINVER5
  // public int dwFlags;
  // [MarshalAs(UnmanagedType.ByValTStr,SizeConst=260+1)]
  // public string szPhonebookPath;
  //#endif
}
public class RAS
{
  [DllImport("Rasapi32.dll",EntryPoint = "RasEnumConnectionsA",SetLastError = true)]

  internal static extern int RasEnumConnections
    (
    ref RASCONN lprasconn,// buffer to receive connections data
    ref int lpcb,// size in bytes of buffer
    ref int lpcConnections // number of connections written to buffer
    );


  [DllImport("rasapi32.dll",CharSet = CharSet.Auto)]
  internal static extern uint RasGetConnectionStatistics(
    IntPtr hRasConn,// handle to the connection
    [In,Out]Rasstats lpStatistics // buffer to receive statistics
    );
  [DllImport("rasapi32.dll",CharSet = CharSet.Auto)]
  public extern static uint RasHangUp(
    IntPtr hrasconn // handle to the RAS connection to hang up
    );

  [DllImport("rasapi32.dll",CharSet = CharSet.Auto)]
  public extern static uint RasEnumEntries(
    string reserved,// reserved,must be NULL
    string lpszPhonebook,// pointer to full path and
    // file name of phone-book file
    [In,Out]RasEntryName[] lprasentryname,// buffer to receive
    // phone-book entries
    ref int lpcb,// size in bytes of buffer
    out int lpcEntries       // number of entries written
    // to buffer
    );

  [DllImport("wininet.dll",CharSet = CharSet.Auto)]
  public extern static int InternetDial(
    IntPtr hwnd,[In]string lpszConnectoid,uint dwFlags,ref int lpdwConnection,uint dwReserved
    );

  public RAS()
  {
  }
}
public enum DEL_CACHE_TYPE //要删除的类型。
{
  File,//表示internet临时文件
  Cookie //表示Cookie
}

public class RASdisplay
{
  [DllImport("wininet.dll",CharSet = CharSet.Auto)]
  public static extern bool DeleteUrlCacheEntry(
    DEL_CACHE_TYPE type
    );
  private string m_duration;
  private string m_ConnectionName;
  private string[] m_ConnectionNames;
  private double m_TX;
  private double m_RX;
  private bool m_connected;
  private IntPtr m_ConnectedRasHandle;

  Rasstats status = new Rasstats();
  public RASdisplay()
  {
    m_connected = true;

    RAS lpras = new RAS();
    RASCONN lprasConn = new RASCONN();

    lprasConn.dwSize = Marshal.SizeOf(typeof(RASCONN));
    lprasConn.hrasconn = IntPtr.Zero;

    int lpcb = 0;
    int lpcConnections = 0;
    int nRet = 0;
    lpcb = Marshal.SizeOf(typeof(RASCONN));

    nRet = RAS.RasEnumConnections(ref lprasConn,ref lpcb,ref
      lpcConnections);

    if (nRet != 0)
    {
      m_connected = false;
      return;

    }

    if (lpcConnections > 0)
    {
      //for (int i = 0; i < lpcConnections; i++)

      //{
      Rasstats stats = new Rasstats();

      m_ConnectedRasHandle = lprasConn.hrasconn;
      RAS.RasGetConnectionStatistics(lprasConn.hrasconn,stats);


      m_ConnectionName = lprasConn.szEntryName;

      int Hours = 0;
      int Minutes = 0;
      int Seconds = 0;

      Hours = ((stats.dwConnectionDuration / 1000) / 3600);
      Minutes = ((stats.dwConnectionDuration / 1000) / 60) - (Hours * 60);
      Seconds = ((stats.dwConnectionDuration / 1000)) - (Minutes * 60) - (Hours * 3600);


      m_duration = Hours + " hours " + Minutes + " minutes " + Seconds + " secs";
      m_TX = stats.dwBytesXmited;
      m_RX = stats.dwBytesRcved;
      //}
    }
    else
    {
      m_connected = false;
    }


    int lpNames = 1;
    int entryNameSize = 0;
    int lpSize = 0;
    RasEntryName[] names = null;

    entryNameSize = Marshal.SizeOf(typeof(RasEntryName));
    lpSize = lpNames * entryNameSize;

    names = new RasEntryName[lpNames];
    names[0].dwSize = entryNameSize;

    uint retval = RAS.RasEnumEntries(null,null,names,ref lpSize,out lpNames);

    //if we have more than one connection,we need to do it again
    if (lpNames > 1)
    {
      names = new RasEntryName[lpNames];
      for (int i = 0; i < names.Length; i++)
      {
        names[i].dwSize = entryNameSize;
      }

      retval = RAS.RasEnumEntries(null,out lpNames);

    }
    m_ConnectionNames = new string[names.Length];


    if (lpNames > 0)
    {
      for (int i = 0; i < names.Length; i++)
      {
        m_ConnectionNames[i] = names[i].szEntryName;
      }
    }
  }

  public string Duration
  {
    get
    {
      return m_connected ? m_duration : "";
    }
  }

  public string[] Connections
  {
    get
    {
      return m_ConnectionNames;
    }
  }

  public double BytesTransmitted
  {
    get
    {
      return m_connected ? m_TX : 0;
    }
  }
  public double BytesReceived
  {
    get
    {
      return m_connected ? m_RX : 0;

    }
  }
  public string ConnectionName
  {
    get
    {
      return m_connected ? m_ConnectionName : "";
    }
  }
  public bool IsConnected
  {
    get
    {
      return m_connected;
    }
  }

  public int Connect(string Connection)
  {
    int temp = 0;
    uint INTERNET_AUTO_DIAL_UNATTENDED = 2;
    int retVal = RAS.InternetDial(IntPtr.Zero,Connection,INTERNET_AUTO_DIAL_UNATTENDED,ref temp,0);
    return retVal;
  }
  public void disconnect()
  {
    RAS.RasHangUp(m_ConnectedRasHandle);
  }
}

调用方法:

RASdisplay ras = new RASdisplay();
ras.disconnect();//断开连接
ras.Connect("ADSL");//重新拨号

注意:断开后连接时,如果不想出现确认对话框,请按下面的步骤进行设置:

1、右击“网上邻居”--属性;

2、在随后出现的“宽带连接”窗口中,右击宽带连接,单击“属性”;

3、在随后出现的属性对话框中,单击“选项”;

4、把随后出现的“提示名称、密码和证书等”前面的对号去掉,点“确定”退出;

以上这篇C# 实现ADSL自动断网和拨号的方法(适用于拨号用户)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程小技巧。

CentOS 6和CentOS 7上搭建web服务器的SSL证书配置

CentOS 6和CentOS 7上搭建web服务器的SSL证书配置

centos 6和centos 7上搭建web服务器的ssl证书配置

在搭建web服务器时,为了确保数据的安全性,我们经常会使用SSL证书来加密网站的访问。本文将介绍在CentOS 6和CentOS 7上搭建web服务器时,如何进行SSL证书的配置。

在开始之前,我们需要准备以下几个文件:

  1. SSL证书文件 (.crt)
  2. 私钥文件 (.key)
  3. CA证书文件(可选,如果你从CA机构购买了证书)

首先,我们需要确保我们的操作系统已经安装了Apache服务器以及相关的SSL模块。在CentOS 6上,可以使用以下命令来安装Apache:

sudo yum install httpd
sudo yum install mod_ssl
登录后复制
登录后复制

在CentOS 7上,则需要使用以下命令:

sudo yum install httpd
sudo yum install mod_ssl
登录后复制
登录后复制

安装完成后,我们需要在Apache的配置文件中进行SSL证书的配置。在CentOS 6上,配置文件为/etc/httpd/conf.d/ssl.conf,在CentOS 7上则为/etc/httpd/conf.d/ssl.conf。打开该文件进行编辑。

首先,我们需要找到以下几行代码,取消注释并修改成自己的证书文件路径:

SSLCertificateFile /path/to/your/certificate.crt
SSLCertificateKeyFile /path/to/your/privatekey.key
登录后复制

如果你购买了CA证书,还需要找到以下行代码进行修改:

SSLCertificateChainFile /path/to/your/CA.crt
登录后复制

保存并关闭文件后,我们需要重启Apache服务器以使配置生效。在CentOS 6上,可以使用以下命令:

sudo service httpd restart
登录后复制

在CentOS 7上,则使用以下命令:

sudo systemctl restart httpd
登录后复制

重启后,Apache服务器将加载配置文件中指定的SSL证书。

为了测试是否配置成功,我们可以使用curl命令来访问网站,并查看返回结果中是否包含SSL证书的相关信息。可以使用以下命令:

curl -I https://yourwebsite.com
登录后复制

其中yourwebsite.com是你的网站域名。

如果返回结果中包含类似以下信息,则说明SSL证书配置成功:

HTTP/2 200
...
Server: Apache
...
SSL certificate verify ok.
登录后复制

至此,我们已经成功在CentOS 6和CentOS 7上搭建了带有SSL证书的web服务器。

总结:
本文介绍了在CentOS 6和CentOS 7上搭建web服务器时,如何进行SSL证书的配置。在搭建web服务器时,使用SSL证书可以确保数据的安全性。通过对Apache服务器的配置文件进行修改,并重启服务器,我们可以轻松地为网站添加SSL证书。

以上就是CentOS 6和CentOS 7上搭建web服务器的SSL证书配置的详细内容,更多请关注php中文网其它相关文章!

CentOS 7拨号上网(ADSL & PPPoE)

CentOS 7拨号上网(ADSL & PPPoE)

http://www.cnblogs.com/gotodsp/p/5513945.html

步骤概述:

1、搜寻PPPoE相关软件,本人使用的是rp-pppoe

  yum search pppoe

2、使用yum安装rp-pppoe

  yum install rp-pppoe -y

3、开始配置PPPoE连接

  pppoe-setup

4、输入ISP提供的账户

5、输入以太网卡代号,默认是eth0(注:CentOS 7已不是默认eth0,自行使用ifconfig命令即可找到)

6、配置:若长时间连线,连线会被自动中断(我不干,选no)

7、配置主DNS服务器

8、配置次DNS服务器

9、两次输入账户密码以确认

10、配置普通账户是否有网络连接权限

11、配置防火墙(没有特殊需求选0就OK)

12、配置是否开机自动拨号连接

13、确认刚填写的配置信息

14、连接网络尽情享受吧!

相关命令@ 连接网络:/sbin/ifup ppp0,断开连接:/sbin/ifdown ppp0,查看网络状态:/sbin/pppoe-status

....................................... 这是华丽丽的分割线 .......................................

获取以太网卡代号
 1 [dsp@dsp Desktop]$ ifconfig
 2 enp9s0: flags=4163<UP,broADCAST,RUNNING,MULTICAST>  mtu 1500 # 有线网卡
 3         ether 20:1b:06:3d:22:05  txqueuelen 1000 (Ethernet)  4         RX packets 0  bytes 0 (0.0 B)  5         RX errors 0  dropped 2297  overruns 0  frame 0
 6         TX packets  7         TX errors 0 overruns 0  carrier 0  collisions  8         device interrupt 18  
 9 
10 lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
11         inet 127.0.0.1  netmask 255.0.0.0
12         inet6 ::1  prefixlen 128  scopeid 0x10<host>
13         loop  txqueuelen 0 (Local Loopback) 14         RX packets 2  bytes 110 (110.0 B) 15         RX errors 0  overruns 16         TX packets 17         TX errors 18 
19 virbr0: flags=4099<UP,128);font-size:12px !important;line-height:1.5 !important;">1500
20         inet 192.168.122.1  netmask 255.255.255.0  broadcast 122.255
21         ether 52:54:00:36:45:23  txqueuelen 0 (Ethernet) 22         RX packets 23         RX errors 24         TX packets 25         TX errors 26 
27 wlp8s0: flags=1500 # 无线网卡
28         inet 0.151  netmask 0.255
29         inet6 fe80::4ad2:24ff:fee8:f962  prefixlen 64  scopeid 0x20<link>
30         ether 48:d2:24:e8:f9:62  txqueuelen 31         RX packets 20017  bytes 16100210 (15.3 MiB) 32         RX errors 33         TX packets 18263  bytes 2641746 (2.5 MiB) 34         TX errors 0
配置rp-pppoe客户端
  1 [root@dsp Desktop]# pppoe-setup   2 Welcome to the PPPoE client setup.  First,I will run some checks on
  3 your system to make sure the PPPoE client is installed properly...
  4 
  5 LOGIN NAME
  6 
  7 Enter your Login Name (default dsp): 12345        # 网络服务提供商提供的账户
  8 
  9 INTERFACE
 10 
 11 Enter the Ethernet interface connected to the PPPoE modem
 12 For Solaris,this is likely to be something like /dev/hme0.
 13 For Linux,it will be ethX,where 'X' is a number.
 14 (default eth0): enp9s0                            # 选择以太网卡,有线网卡
 15 
 16 Do you want the link to come up on demand,or stay up continuously?
 17 If you want it to come up on demand,enter the idle time in seconds
 18 after which the link should be dropped.  If you want the link to
 19 stay up permanently,enter no' (two letters,lower-case.)
 20 NOTE: Demand-activated links do not interact well with dynamic IP
 21 addresses.  You may have some problems with demand-activated links.
 22 Enter the demand value (default no): no           # 输入no,否则若长时间连线,连线会被自动中断
 23 
 24 DNS
 25 
 26 Please enter the IP address of your ISPs primary DNS server.
 27 If your ISP claims that the server will provide dynamic DNS addresses', 28 enter server' (all lower-case) here.
 29 If you just press enter,I will assume you kNow what you are
 30 doing and not modify your DNS setup.
 31 Enter the DNS information here: 8.8.8.8           # 主DNS服务器IP,本人使用Google Public DNS
 32 Please enter the IP address of your ISPs secondary DNS server.
 33 If you just press enter,I will assume there is only one DNS server.
 34 Enter the secondary DNS server address here: 8.8.4.4        # 二级DNS服务器IP
 35 
 36 PASSWORD                         # 账户对应的密码,需两次输入以确认无误
 37 
 38 Please enter your Password: 
 39 Please re-enter your Password: 
 40 
 41 USERCTRL
 42 
 43 Please enter yes' (three letters,255);line-height:1.5 !important;">case.) if you want to allow
 44 normal user to start or stop DSL connection (default yes): yes  # 普通用户是否可以启动停止网络连接
 45 
 46 FIREWALLING
 47 
 48 Please choose the firewall rules to use.  Note that these rules are
 49 very basic.  You are strongly encouraged to use a more sophisticated
 50 firewall setup; however,these will provide basic security.  If you
 51 are running any servers on your machine,you must choose NONE' and
 52 set up firewalling yourself.  Otherwise,the firewall rules will deny
 53 access to all standard servers like Web,e-mail,ftp,etc.  If you
 54 are using SSH,the rules will block outgoing SSH connections which
 55 allocate a privileged source port.
 56 
 57 The firewall choices are:
 58 0 - NONE: This script will not set any firewall rules.  You are responsible
 59           for ensuring the security of your machine.  You are STRONGLY
 60           recommended to use some kind of firewall rules.
 61 1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
 62 2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
 63                 for a LAN
 64 Choose a type of firewall (0-2): 0               # 选 0 65 
 66 Start this connection at boot time
 67 
 68 Do you want to start this connection at boot time?
 69 Please enter no or yes (default no):yes            # 是否系统启动是就连接网络
 70 
 71 ** Summary of what you entered **               
 72 
 73 Ethernet Interface: enp9s0
 74 User name:          12345
 75 Activate-on-demand: No
 76 Primary DNS:        8.8.8.8
 77 Secondary DNS:      4.4
 78 Firewalling:        NONE
 79 User Control:       yes
 80 Accept these settings and adjust configuration files (y/n)? y    # 确认刚才输入的网络配置信息
 81 Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
 82 Adjusting /etc/resolv.conf
 83   (But first backing it up to /etc/resolv.conf.bak)
 84 Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
 85   (But first backing it up to /etc/ppp/chap-secrets.bak)
 86   (But first backing it up to /etc/ppp/pap-secrets.bak)
 87 
 88 
 89 Congratulations,it should be all set up!
 90 
 91 Type /sbin/ifup ppp0' to bring up your xDSL link and /sbin/ifdown ppp0' # rp-pppoe的操作命令
 92 to bring it down.
 93 Type /sbin/pppoe-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
 94 to see the link status.
 95 
 96 [root@dsp Desktop]# /sbin/ifup ppp0      # 启动网络连接
 97 [root@dsp Desktop]# /sbin/pppoe-status    # 查看网络连接状态
 98 pppoe-status: Link is up and running on interface ppp0
 99 6: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc pfifo_fast state UNKNowN qlen 3
100     link/ppp 
101     inet 10.198.0.17 peer 1.1/32 scope global ppp0
102        valid_lft forever preferred_lft forever

参考资料:鸟哥,让CentOS进行PPPoE拨号上网,可用于ADSL网络环境!

CentOS adsl 拨号共享上网

CentOS adsl 拨号共享上网

 

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不行。)
 


今天关于CentOS 6.4 电信ADSL 拨号连接的配置centos宽带拨号的分享就到这里,希望大家有所收获,若想了解更多关于C# 实现ADSL自动断网和拨号的方法(适用于拨号用户)、CentOS 6和CentOS 7上搭建web服务器的SSL证书配置、CentOS 7拨号上网(ADSL & PPPoE)、CentOS adsl 拨号共享上网等相关知识,可以在本站进行查询。

本文标签: