华为AR路由器模拟PPPOE认证服务器

我这里模拟三条运营商接入

配置AR1:

1.创建PPPOE虚拟模板1、2、3

interface Virtual-Template1
ppp authentication-mode pap
remote address pool 1
ip address 100.100.100.1 255.255.255.0
#
interface Virtual-Template2
ppp authentication-mode pap
remote address pool 2
ip address 200.200.200.1 255.255.255.0
#
interface Virtual-Template3
ppp authentication-mode pap
remote address pool 3
ip address 202.202.202.1 255.255.255.0

q

2.应用模板到对应接口

interface GigabitEthernet0/0/0
pppoe-server bind Virtual-Template 2
#
interface GigabitEthernet0/0/1
pppoe-server bind Virtual-Template 1
#
interface GigabitEthernet0/0/2
pppoe-server bind Virtual-Template 3

q

3.创建PPPOE账号

aaa

local-user pppoeuser password cipher pppoepwd

local-user pppoeuser2 password cipher pppoepwd2

local-user pppoeuser3 password cipher pppoepwd3

q

save

配置USG:

安全策略自行配置,这里就不多配置了,主要以生成PPPOE账号为主

#DNS配置、将运营商线路绑定DNS
dns resolve
dns server 114.114.114.114
dns server unnumbered interface Dialer0
dns server unnumbered interface Dialer1
dns server unnumbered interface Dialer2
dns proxy enable
#绑定PPPOE线路1(100M)
interface Dialer0
 link-protocol ppp
 ppp chap user pppoeuser
 ppp chap password cipher  xxxxxxxxxxxx
 ppp pap local-user pppoeuser password cipher xxxxxxxxxxxxxx
 ppp ipcp dns admit-any
 ip address ppp-negotiate
 dialer user pppoeuser
 dialer bundle 1
#绑定PPPOE线路2(200M)
interface Dialer1
 link-protocol ppp
 ppp chap user pppoeuser2
 ppp chap password cipher xxxxxxxxxxxxxxxxxxx
 ppp pap local-user pppoeuser2 password cipher xxxxxxxxxxxxxxxxx
 ppp ipcp dns admit-any
 ip address ppp-negotiate
 dialer user pppoeuser2
 dialer bundle 2
#绑定PPPOE线路3(500M)
interface Dialer2
 link-protocol ppp
 ppp chap user pppoeuser3
 ppp chap password cipher xxxxxxxxxxxxxxxxxxxx
 ppp pap local-user pppoeuser3 password cipher xxxxxxxxxxxxxxxxxxxxxxx
 ppp ipcp dns admit-any
 ip address ppp-negotiate
 dialer user pppoeuser3
 dialer bundle 3
#将PPPOE线路绑定到接口
interface GigabitEthernet  x/x/x
 pppoe-client dial-bundle-number 1
 undo shutdown
interface GigabitEthernet x/x/x
 pppoe-client dial-bundle-number 2
 undo shutdown
interface GigabitEthernet x/x/x
 pppoe-client dial-bundle-number 3
 undo shutdown
#配置到公网路由,含静态线路
ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet x/x/x xxx.xxx.xxx.1
ip route-static 0.0.0.0 0.0.0.0 Dialer0
ip route-static 0.0.0.0 0.0.0.0 Dialer1
ip route-static 0.0.0.0 0.0.0.0 Dialer2
#允许静态地址、PPPOE线路NAT转换
nat-policy
 rule name GuideNat1611107228409
  egress-interface GigabitEthernet x/x/x
  action source-nat easy-ip
 rule name GuideNat1611109674919
  egress-interface Dialer0
  action source-nat easy-ip
 rule name GuideNat1611111522976
  egress-interface Dialer1
  action source-nat easy-ip
 rule name GuideNat1611111585664
  egress-interface Dialer2
  action source-nat easy-ip

 

centos7安装python3.7

1.安装环境

cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

2.安装epel网络yum源

yum -y install epel-release

3.更新yum源

yum clean all

yum makecache

4.更新rpm包

yum -y update

5.安装依赖环境

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel zlib1g-dev zlib*

zlib1g-dev可能会报不存在,暂时忽略

6.下载python3.7

cd /usr/local/src

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz

如果国内下载过慢或链接失效,请使用以下链接

wget -c http://itityunwei.cn/linux_package/Python-3.7.0.tar.xz

7.解压python3.7

tar -vxf  Python-3.7.0.tar.xz (注意:不要加j参数)

8.安装python3.7

mkdir -p /usr/local/python3

cd /usr/local/src/Python-3.7.0

./configure –prefix=/usr/local/python3 –enable-optimizations –with-ssl

make && make install

9.创建软连接(快捷方式)

ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3

ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3

ln -s /usr/local/python3/bin/virtualenv /usr/local/bin/virtualenv  (不存在,后面创建虚拟环境用,后面会安装)

10.检查python3是否成功安装

python3  -v

pip3  -v

11.修改pip源为国内源

cd /root

mkdir .pip

cd .pip

vim pip.conf

[global]

index-url = https://mirrors.aliyun.com/pypi/simple

12.二次编译安装python3,加入with-ssl

cd /usr/local/src/Python-3.7.0

./configure  –with-ssl

make && make install

13.升级pip3并安装虚拟环境

pip3 install –upgrade pip

pip3 install virtualenvwrapper

14.编辑.bash_profile文件

cd /root

cp .bash_profile   .bash_profile.back

vim  .bash_profile

底部新增以下几行

export WORKON_HOME=/Envs
export VIRTUALENVWRAPPER_VIRTUALENV=/Users/mosson/Library/Python/3.7/bin/virtualenv
export VIRTUALENVWRAPPER_PYTHON=/usr/local/python3/bin/python3
source /usr/local/python3/bin/virtualenvwrapper.sh

生效配置文件

source  .bash_profile

15.创建虚拟环境

创建虚拟环境
[root@localhost ~]# mkvirtualenv 虚拟环境的名字
如果需要特殊指定其他版本的python
[root@localhost ~]# mkvirtualenv -p python解释器所在的位置 虚拟环境存放的目录(默认是在/Envs)
切换虚拟环境
[root@localhost ~]# workon 虚拟环境的名字
退出虚拟环境
[root@localhost ~]# deactivate
查看虚拟环境
[root@localhost ~]# lsvirtualenv

16.解决python2和python3共存问题,以方便快速切换python版本,支持多个python版本共存

cd /usr/local/bin/

mv python  python2  (注意:这里的python是指当前系统运行的python版本,默认为python2,也是系统在全局任意界面读取的python版本,我这里要让python3全局生效,以替代python2作为默认版本,所以要重命名python为python2,最好是原来什么版本的执行程序就重命名为什么版本,这个python默认是python2的执行程序,重命名为python2)

mv python3  python (注意:要让python3全局生效,需要将python3重命名为python,让系统能调用python3来执行,简单说就是想要切换什么版本就重命名就行了,当然,相关版本的启动程序需要软连接到这个目录下)

cd

python

发现python3已经作为默认启动版本了

[root@localhost ~]# python
Python 3.7.0 (default, Jan 4 2021, 17:53:08)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>>  exit()

done !