Linux实战(11):配置PPPOE拨号
生活随笔
收集整理的這篇文章主要介紹了
Linux实战(11):配置PPPOE拨号
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言:
由于需要做網站數據的抓取,普通的固定代理會容易被封禁,所以我們就用PPPOE通過動態撥號換不同的IP地址來解決該問題,下面PPPOE設置的整個方法過程:
移除NetworkManager安裝rp-pppoe
第一步 搜尋pppoe可以找到pppoe相關套件,我們要使用的是rp-pppoe。
yum search pppoe
第二步 使用yum安裝rp-pppoe。
yum install rp-pppoe -y
第三步 移除NetworkManaget。
yum erase NetworkManager
第四步 開始配置PPPoE連線。
root@PppoeServer Test ~ # 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...
LOGIN NAME #需要輸入在運營商處購買的寬帶賬號
Enter your Login Name (default root): 680000038162
INTERFACE #選擇關聯網卡,默認為eth0可能由于安裝多張網卡而非eth0,這個需要根據自己的實際情況而定
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 eth0): em2
Do you want the link to come up on demand, or stay up continuously? #撥號類型選擇,取決于自己所選套餐,默認為no
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): no
DNS #DNS的配置,如果你知道可以手動輸入,如果不知道可以輸入Server,讓ISP自動分配
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.106.0.20
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: 8.8.8.8
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): no
FIREWALLING # 防火墻配置,這里默認0就好
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): 0
Start this connection at boot time
Do you want to start this connection at boot time? # 是否開機啟動,這里選擇yes
Please enter no or yes (default no):yes
** Summary of what you entered **
Ethernet Interface: em2
User name: 680000038162
Activate-on-demand: No
Primary DNS: 202.106.0.20
Secondary DNS: 8.8.8.8
Firewalling: NONE
User Control: no
Accept these settings and adjust configuration files (y/n)? # 確認上面配置無誤后,保存配置到文件
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.
root@PppoeServer Test ~ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether f0:1f:af:d6:01:61 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.252/24 brd 192.168.1.255 scope global em1
valid_lft forever preferred_lft forever
3: em2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether f0:1f:af:d6:01:62 brd ff:ff:ff:ff:ff:ff
4: p2p1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether a0:36:9f:94:a4:d8 brd ff:ff:ff:ff:ff:ff
5: p2p2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether a0:36:9f:94:a4:da brd ff:ff:ff:ff:ff:ff
root@PppoeServer Test ~ # ifup ppp0
root@PppoeServer Test ~ # pppoe-status
pppoe-status: Link is up and running on interface ppp0
6: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc pfifo_fast state UNKNOWN qlen 3
link/ppp
inet 114.252.45.64 peer 114.252.32.1/32 scope global ppp0
valid_lft forever preferred_lft forever
root@PppoeServer Test ~ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether f0:1f:af:d6:01:61 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.252/24 brd 192.168.1.255 scope global em1
valid_lft forever preferred_lft forever
3: em2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether f0:1f:af:d6:01:62 brd ff:ff:ff:ff:ff:ff
4: p2p1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether a0:36:9f:94:a4:d8 brd ff:ff:ff:ff:ff:ff
5: p2p2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether a0:36:9f:94:a4:da brd ff:ff:ff:ff:ff:ff
6: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc pfifo_fast state UNKNOWN qlen 3
link/ppp
inet 114.252.45.64 peer 114.252.32.1/32 scope global ppp0
valid_lft forever preferred_lft forever
上面是整個PPPOE的連接創建過程,后續可以通過ifdown ppp0和pppoe-status來進行停止連接和狀態查看。
注意
本篇全文復制粘貼,非原創——原文地址
總結
以上是生活随笔為你收集整理的Linux实战(11):配置PPPOE拨号的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单反入门推举(最佳初学者单反相机推举)
- 下一篇: 什么是新闻纸(新闻纸介绍)