Linux設置pppoe撥號上網
我們現在上網好多都是通過pppoe撥號上網,在windows下我們下載一個客戶端就可以很輕鬆的實現,現在我們用linux也想上網怎麼辦?我們也可以通過pppoe撥號連接到互聯網
環境:
操作系統:CentOs release 6.4
需要的軟件:
rp-pppoe-3.11.tar.gz
我們先安裝一個pppoe客戶端
[root@localhost ~]# ll |grep ppoe
-rw-r--r--. 1 root root 223234 Apr 13 19:01 rp-pppoe-3.11.tar.gz
這是一個pppoe源代碼包拆包解壓到 /usr/local/src目錄
[root@localhost ~]# tar -zxvf rp-pppoe-3.11.tar.gz -C /usr/local/src
解壓完後我們看看它的安裝說明
[root@localhost ~]# cd /usr/local/src
[root@localhost src]# cd rp-pppoe-3.11/
[root@localhost src]#ll
total 48
-rw-r--r--. 1 user1 user1 1882 Aug 18 2012 README
-rw-r--r--. 1 user1 user1 561 Aug 18 2012 SERVPOET
drwxr-xr-x. 2 user1 user1 4096 Aug 18 2012 configs
drwxr-xr-x. 2 user1 user1 4096 Aug 18 2012 doc
-rwxr-xr-x. 1 user1 user1 845 Aug 18 2012 go
-rwxr-xr-x. 1 user1 user1 1941 Aug 18 2012 go-gui
drwxr-xr-x. 3 user1 user1 4096 Aug 18 2012 gui
drwxr-xr-x. 2 user1 user1 4096 Aug 18 2012 man
-rw-r--r--. 1 user1 user1 4109 Aug 18 2012 rp-pppoe.spec
drwxr-xr-x. 2 user1 user1 4096 Aug 18 2012 scripts
drwxr-xr-x. 4 user1 user1 4096 Aug 18 2012 src
我們查看一下README安裝說明
[root@localhost rp-pppoe-3.11]# vim README
Compile and install pppd if you don't already have it. Then:
1) Unpack:
$ tar xzvf rp-pppoe-xxx.tar.gz//已完成
2) Change to source directory://已完成
$ cd src
3) Configure:
$ ./configure// ./config配置編譯規則
4) Compile:
$ make
5) Install (this step must be done as root)
# make install
6) Now read doc/HOW-TO-CONNECT
--
David F. Skoll <[email protected]> | Roaring Penguin Software Inc.
http://www.roaringpenguin.com
我們按照文件裏的說明執行第三、四、五步
[root@localhost rp-pppoe-3.11]# cd src
編譯
[root@localhost src]# ./configure
執行make
[root@localhost src]# make
安裝make install
[root@localhost src]# make install
Type 'make install' as root to install the software.
mkdir -p /usr/sbin
/usr/bin/install -c -m 755 pppoe /usr/sbin
/usr/bin/install -c -m 755 pppoe-server /usr/sbin
if test -x licensed-only/pppoe-server-control ; then /usr/bin/install -c -m 755 licensed-only/pppoe-server-control /usr/sbin; fi
Type 'pppoe-setup' to configure the software.
讓我們通過pppoe-setup來設置
設置pppoe
[root@localhost src]# pppoe-setup
提示設置用戶名默認[email protected]
這裏填寫運營商給你提供的賬戶密碼
[root@localhost rp-pppoe-3.11]# pppoe-setup
Welcome to the Roaring Penguin PPPoE client setup. First, I will run
some checks on your system to make sure the PPPoE client is installed
properly...
Looks good! Now, please enter some information:
USER NAME
>>> Enter your PPPoE user name (default 15638892360):
輸入用戶名回車
提示選擇網卡默認eth0
INTERFACE
>>> Enter the Ethernet interface connected to the DSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethn, where 'n' is a number.
(default eth0):
選擇按需連接還是永久在線默認永久在線
Do you want the link to come up on demand, or stay up continuously?
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):
提示讓你輸入你的IPS(Internet服務提供商)的主DNS 服務器地址
DNS
Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide 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:
輸入密碼和確認密碼
PASSWORD
>>> Please enter your PPPoE password:
>>> Please re-enter your PPPoE password:
配置防火牆,這裏有三個級別
FIREWALLING
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):
配置完成後會顯示的的配置,並詢問是否保存
** Summary of what you entered **
Ethernet Interface: eth0
User name:
Activate-on-demand: No
DNS: Do not adjust
Firewalling: NONE
>>> Accept these settings and adjust configuration files (y/n)?
保存後會提示配置的保存位置,並提示下一步操作
Adjusting /etc/ppp/pppoe.conf
Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
(But first backing it up to /etc/ppp/pap-secrets-bak)
(But first backing it up to /etc/ppp/chap-secrets-bak)
Congratulations, it should be all set up!
Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring
it down. Type 'pppoe-status' to see the link status.
啓動pppoe
[root@CentOS rp-pppoe-3.11]# pppoe-start
pppoe-start: There already seems to be a PPPoE connection up (PID 37234)
登陸成功!