[root@localhost network-scripts]# rpm -q rp-pppoe
package rp-pppoe is not installed

-----------------

[root@localhost network-scripts]# yum list |grep pppoe
rp-pppoe.x86_64                    3.10-16.el6                 base

-----------------

[root@localhost network-scripts]# yum install rp-pppoe -y

-----------------

[root@localhost network-scripts]# rpm -q rp-pppoe
rp-pppoe-3.10-16.el6.x86_64

-----------------设置支持ip转发
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1

-----------------修改服务器配置----------------
vi /etc/ppp/pppoe-server-options
# PPP options for the PPPoE server
# LIC: GPL
#require-pap
require-chap
login
lcp-echo-interval 10
lcp-echo-failure 2
logfile /var/log/pppoe.log
ms-dns 8.8.8.8
ms-dns 114.114.114.114

--------------------添加用户名密码,修改/etc/ppp/chap-secrets文件,

chap1 * "chap1" *
chap2 * "chap2" *
chap3 * "chap3" *
chap4 * "chap4" *
chap5 * "chap5" *
chap6 * "chap6" *
chap7 * "chap7" *
chap8 * "chap8" *
chap9 * "chap9" *
chap10 * "chap10" *
chap11 * "chap11" *
chap12 * "chap12" *
chap13 * "chap13" *
chap14 * "chap14" *
chap15 * "chap15" *
chap16 * "chap16" *
chap17 * "chap17" *
chap18 * "chap18" *
chap19 * "chap19" *
chap20 * "chap20" *
chap21 * "chap21" *
chap22 * "chap22" *
chap23 * "chap23" *
chap24 * "chap24" *
chap25 * "chap25" *
chap26 * "chap26" *
chap27 * "chap27" *
chap28 * "chap28" *
chap29 * "chap29" *
chap30 * "chap30" *

--------------------给eth0接口创建虚接口eth0:2并up

ifconfig eth0:1 20.20.20.2 netmask 255.255.255.0

ifconfig eth0:1 up

--------------------给eth0接口创建虚接口eth0:2重启网络生效

cd /etc/sysconfig/network-script/

cp ifcfg-eth0 ifcfg-eth0:2

vi ifcfg-eth0:2

DEVICE=eth0:1
HWADDR=00:0C:29:AD:F8:B7
TYPE=Ethernet
UUID=d60f7bad-0f18-420a-8e19-3e361f8ffed4
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=20.20.20.2
NETMASK=255.255.255.0

service network restart

--------------------添加防火墙规则,做nat转换 iptables -t nat -A POSTROUTING -s 20.20.20.0/24 -j MASQUERADE           (iptables -t nat -A POSTROUTING -s 20.20.20.0/24 -o eth1 -j SNAT --to-source 192.172.1.172) iptables -A FORWARD -p tcp --syn -s 20.20.20.0/24 -j TCPMSS --set-mss 1256

service iptables save   保存防火墙规则到配置文件/etc/sysconfig/iptables echo 1 > /proc/sys/net/ipv4/ip_forward sysctl -w net.ipv4.ip_forward=1

第一条是添加nat,转换来自20.20.20.0/24网段的ip        (MASQUERADE是针对连接公网的接口是自动获取地址) 或者:iptables -t nat -A POSTROUTING -s 20.20.20.0/24 -o eth1 -j SNAT --to-source 192.172.1.172 第二条是修改mtu 第四条打开转发 第五条是修改转发文件

--------------------如下FORWARD链中REJECT的规则,阻止了数据报文的转发,进行删除iptables -D FORWARD 1,然后service iptables save保存到配置

iptables -nvL FORWARD

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination        
  389 23343 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
    0     0 TCPMSS     tcp  --  *      *       20.20.20.0/24        0.0.0.0/0           tcp flags:0x17/0x02 TCPMSS set 1256

--------------------启动pppoe-server
pppoe-server -I eth0:1 -L 20.20.20.1 -R 20.20.20.100-200

--------------------查看pppoe-server的进程
[root@localhost network-scripts]# ps aux |grep pppoe
root       3200  0.0  0.0   4104   300 ?        S    04:04   0:00 pppoe-server -I eth0:1 -L 20.20.20.1 -R 20.20.20.100-200
root       3201  0.0  0.1  49488  1860 ?        Ss   04:04   0:00 pppd pty /usr/sbin/pppoe -n -I eth0:2 -e 1:a0:9d:86:16:2c:99 -S '' file /etc/ppp/pppoe-server-options 20.20.20.1:20.20.20.100 nodetach noaccomp nobsdcomp nodeflate nopcomp novj novjccomp default-asyncmap
nobody     3204  0.0  0.0   6184   708 ?        S    04:04   0:00 /usr/sbin/pppoe -n -I eth0:2 -e 1:a0:9d:86:16:2c:99 -S
root       3215  0.0  0.1  49488  1848 ?        Ss   04:04   0:00 pppd pty /usr/sbin/pppoe -n -I eth0:2 -e 2:a0:9d:86:fc:89:13 -S '' file /etc/ppp/pppoe-server-options 20.20.20.1:20.20.20.101 nodetach noaccomp nobsdcomp nodeflate nopcomp novj novjccomp default-asyncmap
nobody     3216  0.0  0.0   6184   704 ?        S    04:04   0:00 /usr/sbin/pppoe -n -I eth0:2 -e 2:a0:9d:86:fc:89:13 -S
root       3229  0.0  0.1  49488  1848 ?        Ss   04:06   0:00 pppd pty /usr/sbin/pppoe -n -I eth0:2 -e 3:a0:9d:86:fc:89:73 -S '' file /etc/ppp/pppoe-server-options 20.20.20.1:20.20.20.102 nodetach noaccomp nobsdcomp nodeflate nopcomp novj novjccomp default-asyncmap
nobody     3230  0.0  0.0   6184   708 ?        S    04:06   0:00 /usr/sbin/pppoe -n -I eth0:2 -e 3:a0:9d:86:fc:89:73 -S
root       3240  0.0  0.0 103248   872 pts/0    S+   04:06   0:00 grep pppoe

[root@localhost network-scripts]# service pppoe-server status
pppoe-server (pid 1573) 正在运行...
[root@localhost network-scripts]#

--------------------设置开机启动

添加如下命令到脚本/etc/rc.d/rc.local中

pppoe-server -I eth0:2 -L 20.20.20.1 -R 20.20.20.100-200

-------------------------------------

对于虚拟机的虚接口桥接到真实主机的无线网卡时,常出现虚接口消失的情况,可以使用python写个检测程序

#!/usr/local/bin/python3

import os,re,time

while True:

val = os.popen("ifconfig").read()

if ["eth1:1"] == re.findall(r"eth1:1",val):

print("eth1:1 is exist")

time.sleep(3)

else:

os.popen('ifconfig eth1:1 40.10.10.1 netmask 255.255.255.0')

time.sleep(3)

os.popen('ifconfig eth1:1 up')

time.sleep(3)

print("eth1:1 has been created")

if ["eth1:3"] == re.findall(r"eth1:3",val):

print("eth1:3 is exist")

time.sleep(3)

else:

os.popen('ifconfig eth1:3 100.100.100.1 netmask 255.255.255.0')

time.sleep(3)

os.popen('ifconfig eth1:3 up')

time.sleep(3)

print("eth1:3 has been created")

print("eth1:1 and eth1:3 are all up")

Centos6.5 pppoe-server的更多相关文章

  1. How to create a PPPoE Server on Ubuntu? (Untested)

    How to create a PPPoE Server on Ubuntu? March 30, 2011 coder_commenter Leave a comment Go to comment ...

  2. Ubuntu上架设PPPoE Server

    一.安裝 PPPoE Server Software1)sudo apt-get install ppp2)rp-pppoe(非apt套件)wget -c http://www.roaringpeng ...

  3. PPPoE Server Under Ubuntu/Debian

    http://imranasghar.blogspot.com/2009/05/pppoe-server-under-ubuntudebian.html ----------------------- ...

  4. pppoe server 搭建

    Ubuntu 上搭建 pppoe server sudo apt-get install pppoe $ cat /etc/ppp/pppoe-server-options # PPP options ...

  5. Linux下PPPoE Server测试环境搭建

    1.1  服务器软件安装 安裝PPPoE Server 所需的软件: 安装ppp模块: sudo apt-get install ppp   //一般默认下已安装 安装rp-pppoe,从网络上下载安 ...

  6. Centos6.5 Zabbix3 server端安装(一)

    一.准备阶段: 1.>关闭防火墙 /etc/init.d/iptables stop 2.>关闭selinux vim /etc/selinux/config SELINUX=disabl ...

  7. CentOS6.0/RedHat Server 6.4安装配置过程 详细图解!

    1.准备安装 1.1 系统简介 CentOS 是什么? CentOS是一个基于Red Hat 企业级 Linux 提供的可自由使用的源代码企业级的 Linux 发行版本.每个版本的 CentOS 都会 ...

  8. PPTP&L2TP&PPPOE client and server configure

    一. PPPOE 1. server(参考http://laibulai.iteye.com/blog/1171898) (1)安装rp-pppoe:yum install rp-pppoe (2)配 ...

  9. centos6 搭建ELK

    mark一下时间:2016年2月19日10:17:09 记录使用 Logstash: Logstash服务的组件,用于处理传入的日志. Elasticsearch: 存储所有日志 Kibana 4: ...

  10. 同时大量PPPoE连接请求,攻击PPPoE服务器,导致的用户异常掉线故障分析

    前几天接一个客户电话,PPPoE下用户异常掉线,掉线后拨号困难 到达后,我首先查看PPPoE日志,发现一秒钟内有大量PADI包,浪费服务器的SESSION,同时让服务器无法处理其他用户的请求. 打开W ...

随机推荐

  1. 【Android Studio安装部署系列】二十七、Android studio修改项目名称和包名

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 概述 实际项目开发中可能碰到项目名称写错了或者需要修改,而且包名可能也想要修改,那么如何操作呢. 本文是在Android Studio3. ...

  2. PreferencesUtils【SharedPreferences操作工具类】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 可以替代ACache用来保存用户名.密码. 相较于Acache,不存在使用猎豹清理大师进行垃圾清理的时候把缓存的数据清理掉的问题. ...

  3. Springboot 系列(九)使用 Spring JDBC 和 Druid 数据源监控

    前言 作为一名 Java 开发者,相信对 JDBC(Java Data Base Connectivity)是不会陌生的,JDBC作为 Java 基础内容,它提供了一种基准,据此可以构建更高级的工具和 ...

  4. win10安装tensorflow-gpu1.13.1+cuda10.0+cudnn7.3.1

    一,本机配置 Win10 64bit NVIDIA GeForce GTX 960M Python3.7(Anaconda) 二,安装CUDA 亲测,TensorFlow-gpu1.13.1支持cud ...

  5. easyui表格排序

    效果:点击DataGrid表格某个头部,进行升序或降序排序当前页: 问题:对应列设置  sortable:true 没有效果,刚开始以为是对应的列对应的数据库的字段类型有问题, 改动代码,使返回到前台 ...

  6. 《JavaScript高级程序设计》笔记:BOM(八)

    BOM(浏览器对象模型)提供了很多对象,用于访问浏览器的功能,这些功能与任何网页内容无关. window对象 全局作用域 定义全局变量与在window对象上直接定义属性还是有一点差别:全局变量不能通过 ...

  7. harris角点检测的简要总结

    目录 1. 概述相关 2. 原理详解 1) 算法思想 2) 数学模型 3) 优化推导 3. 具体实现 1) 详细步骤 2) 最终实现 4. 参考文献 1. 概述相关 harris角点检测是一种特征提取 ...

  8. Mac电脑 怎么导出安卓手机的相册

    1.mac上下载一个HandShaker 2.把电脑和手机设置在同一个wifi下 3.安卓手机上下载一个HandShaker 参考:https://zhidao.baidu.com/question/ ...

  9. js 计算金额是否小于总金额,大于是不能保存

    计算金额是否小于总金额,大于是不能保存 function kpjejs(oInput){ var result = 0; var vresult = "kpsq_kpzje";// ...

  10. Redis与Memocache的区别

    转载地址:http://gnucto.blog.51cto.com/3391516/998509 Redis与Memcached的区别 传统MySQL+ Memcached架构遇到的问题 实际MySQ ...