linux pppoe拨号上网
安装软件和修改配置文件:
[root@cv ~]# yum -y install rp-pppoe
[root@cv ~]# cp /usr/share/doc/rp-pppoe-3.11/configs/pppoe.conf /etc/ppp/
[root@cv ~]# cat /etc/ppp/pppoe.conf | grep -v ^# | grep -v ^$ 修改配置文件
ETH=ens37
USER=sj205
DEMAND=no
DNSTYPE=SERVER
PEERDNS=yes
DNS1=
DNS2=
DEFAULTROUTE=yes
CONNECT_TIMEOUT=30
CONNECT_POLL=2
ACNAME=
SERVICENAME=
PING="."
CF_BASE=`basename $CONFIG`
PIDFILE="/var/run/$CF_BASE-pppoe.pid"
SYNCHRONOUS=no
CLAMPMSS=1412
LCP_INTERVAL=20
LCP_FAILURE=3
PPPOE_TIMEOUT=80
FIREWALL=NONE
LINUX_PLUGIN=
PPPOE_EXTRA=""
PPPD_EXTRA=""
输入账号密码:
[root@cv ~]# cat /etc/ppp/pap-secrets 、
# Secrets for authentication using PAP
# client server secret IP addresses
“sj205” * “88886666”
拨号成功:
[root@cv ~]# pppoe-start
[root@cv ~]# pppoe-status
pppoe-status: Link is up and running on interface ppp0
6: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1480 qdisc pfifo_fast state UNKNOWN group default qlen 3
link/ppp
inet 173.0.6.83 peer 173.0.0.1/32 scope global ppp0
valid_lft forever preferred_lft forever
[root@cv ~]# ifconfig ppp0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1480
inet 173.0.6.83 netmask 255.255.255.255 destination 173.0.0.1
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 4 bytes 198 (198.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 138 bytes 6872 (6.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
配置代理内网上网:
[root@cv ~]# iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
[root@cv ~]# iptables-save >> /etc/sysconfig/iptables
[root@cv ~]# systemctl enable iptables
[root@cv ~]# echo “net.ipv4.ip_forward=1” >> /etc/sysctl.conf
[root@cv ~]# sysctl -p
[root@cv ~]# echo “pppoe-start” >> /etc/rc.local
[root@cv ~]# chmod o+x /etc/rc.d/rc.local