ubuntu7-ubuntu采用pppoe搭建pppoe server

一、安装pppoe

root@raisecom-VirtualBox:/etc# sudo apt-get install pppoe

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  linux-hwe-5.4-headers-5.4.0-42
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  pppoe
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 69.1 kB of archives.
After this operation, 250 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu bionic/universe amd64 pppoe amd64 3.11-0ubuntu1 [69.1 kB]
Fetched 69.1 kB in 1s (60.1 kB/s)
Selecting previously unselected package pppoe.
(Reading database ... 190384 files and directories currently installed.)
Preparing to unpack .../pppoe_3.11-0ubuntu1_amd64.deb ...
Unpacking pppoe (3.11-0ubuntu1) ...
Setting up pppoe (3.11-0ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@raisecom-VirtualBox:/etc# 

二、修改配置文件

2.1 vim /etc/ppp/options


# Originally created by Jim Knoble <jmknoble@mercury.interpath.net>
# Modified for Debian by alvar Bray <alvar@meiko.co.uk>
# Modified for PPP Server setup by Christoph Lameter <clameter@debian.org>
#
# To quickly see what options are active in this file, use this command:
#   egrep -v '#|^ *$' /etc/ppp/options

# Specify which DNS Servers the incoming Win95 or WinNT Connection should use
# Two Servers can be remotely configured

//PPPoE server给PPPoE client分配的主备DNS server
ms-dns 172.16.8.8
ms-dns 114.114.114.114

# Specify which WINS Servers th


# Require the peer to authenticate itself using PAP.

//禁止PAP鉴权
#+pap

# Don't agree to authenticate using PAP.

//禁止PAP鉴权
-pap

# Require the peer to authenticate itself using CHAP [Cryptographic
# Handshake Authentication Protocol] authentication.

//允许CHAP鉴权
+chap

# Don't agree to authenticate using CHAP.

//允许CHAP鉴权
#-chap

2.2 vim /etc/ppp/chap-secrets

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses

//设置PPPoE client拨号的用户名test和密码123456,其他不限制采用通配符*
test * 123456 *

2.3 vim /etc/ppp/pppoe-server-options

//此文件如果没有,请用touch命令创建,在此文件中补全以下内容即可。

auth
require-chap
logfile /var/log/pppd.log

三、开启IP转发

//进入/etc/sysctl.conf ​​​​​,将net.ipv4.ip_forward=1的注释取消即可。

root@raisecom-VirtualBox:/etc/ppp# vim /etc/sysctl.conf 

# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6

//重启sysctl 进程

root@raisecom-VirtualBox:/etc/ppp# sudo sysctl -p

四、运行PPPoE server

root@raisecom-VirtualBox:/etc/ppp# ifconfig

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.108.1  netmask 255.255.255.0  broadcast 10.10.108.255
        inet6 fe80::a00:27ff:fe87:1296  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:87:12:96  txqueuelen 1000  (Ethernet)
        RX packets 16538473  bytes 19321012576 (19.3 GB)
        RX errors 0  dropped 3160  overruns 0  frame 0
        TX packets 17450102  bytes 23858359633 (23.8 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

//以下命令重启失效

​​​​​​​-I 参数为网络端口名称,可以使用ifconfig命令查看当前工作的端口。
-L 参数为一个PPP连接中,PPPoE服务器的IP地址,即当前Ubuntu服务器的地址。
-R 参数为当有客户连接到服务器上时,从哪个IP地址开始分配。
-N 参数为至多可以有多少个客户同时连接到当前服务器上。

root@raisecom-VirtualBox:/etc/ppp# sudo pppoe-server -I enp0s8 -L 10.10.108.11 -R 10.10.108.20 -N 10

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值