archlinux pppoe拨号连接使用详解[转载]

RouterOS 2.9.27 + archlinux 200806
routerOS上架设pppoe server,archlinux当pppoe client,archlinux上有一块网卡eth0

目的:
archlinux pppoe拨号到pppoe server


pppoe server 配置
  service name  :  pppoe-service
  local address  :  192.168.88.210
  remote address  :  192.168.88.211-192.168.88.220
  secret name  :  test
  secret password  :  123456
  caller id  :  
ip-->dns-->settings
  primary dns  :  192.168.88.89
  seconday dns  :  202.100.64.68

步骤如下:

Quotation

注意:
/etc/rc.conf 里注意的两点
pppoe和eth0原来的ip配置没有关系的
但是pppoe和routes 配置有关系,如果想使用pppoe获得的网关那么就修改为 ROUTES=(!gateway)

1、安装好这两个包,可以先 pacman -Q | grep ppp 命令查看下是否安装

[root@myhost ~]# pacman -S ppp rp-pppoe

2、未配置pppoe前先查看下/etc/resolv.conf,建议先备份一下文件

[root@vkill ~]# ls -l /etc/resolv.conf
lrw-r--r-- 1 root root 20 Aug  9 10:09 /etc/resolv.conf

3、配置pppoe

[root@myhost ~]# pppoe-setup
>>>enter your pppoe user name  :test
>>>enter eth ethernet interface connected to the DSL modem (default eth0)  :eth0
>>>enter the demand value (default no)  :no
>>>enter the DNS information here  :server
>>>please enter your pppoe password  :123456
>>>please re-enter your pppoe password  :123456
>>>choose a type of firewall  :2
>>>accept these settings and adjust configuration files (y/n)  :y

4、修改pppoe client 配置

[root@myhost ~]# vi /etc/ppp/pppoe.conf
#几个需要注意的地方
defaultroute=yes
#servicename如果局域网内有多个pppoe server时这个就有用了,如果时连接电信adsl就留空
#具体参见http://blog.vkill.net/read.php?75
servicename=pppoe-service  

5、开启连接pppoe,连接成功

[root@myhost ~]# pppoe-start
. Connected!

6、再次查看下/etc/resolv.conf,可以看到已经变为符号连接了,所以在使用pppoe前还是备份下/etc/resolv.conf比较好

[root@vkill ~]# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 20 Aug  9 10:09 /etc/resolv.conf -> /etc/ppp/resolv.conf
[root@vkill ~]# ls -l /etc/ppp/resolv.conf
-rw-r--r-- 1 root root 50 Aug  9 10:10 /etc/ppp/resolv.conf

注意:
默认pppoe-start成功后/etc/resolv.conf权限是777,/etc/ppp/resolv.conf权限是644
如果发现普通用户无法使用dns时有可能就是/etc/resolv.conf权限的问题,手动修改下权限即可

[root@myhost ~]# chmod 777 /etc/resolv.conf
[root@myhost ~]# chmod 644 /etc/ppp/resolv.conf

7、ifconfig查看,可以看到多了一个ppp0连接

[root@vkill ~]# ifconfig
......
ppp0      Link encap:Point-to-Point Protocol
          inet addr:192.168.88.219  P-t-P:192.168.88.210  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1488  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:308 (308.0 b)  TX bytes:227 (227.0 b)

8、查看当前路由

[root@myhost ~]# route
destination  gateway  geenmask  flags  metric  ref  use  iface
......
default    *  0.0.0.0    U  0  0  0  ppp0

如未看到default ... ppp0这条,需要手动创建,命令如下

[root@myhost ~]# route add default dev ppp0

9、查看dns,可以看到都获取到了

[root@myhost ~]# cat /etc/resolv.conf
nameserver 192.168.88.89
nameserver 202.100.64.68

10、设置开机自动拨号

[root@myhost ~]# vi /etc/rc.conf
#添加adsl到DAEMONS就可以了,@是后台
DAEMONS=(syslog-ng network netfs crond sshd @adsl)

11、如果pppoe server绑定了mac地址,怎么连接?
试验时pppoe server 修改一配置
  secret name  :  test
  secret password  :  123456
  caller id  :  00:01:23:45:67:89

首先修改/etc/rc.conf

[root@vkill ~]# vi /etc/rc.conf
......
#修改为如下设置,照个人情况
eth0="eth0 hw ether 00:01:23:45:67:89"
eth1="eth0 192.168.88.100"
INTERFACES=(eth0 eth1)

修改完成后重启网络后连接就可以了

[root@vkill ~]# /etc/rc.d/network restart
[root@vkill ~]# /etc/rc.d/adsl restart


后记:
pppoe-start 命令等价于 /etc/rc.d/adsl restart
pppoe-stop 命令等价于 /etc/rc.d/adsl stop

pppoe的密码保存在 CHAP密码文件 /etc/ppp/chap-secrets 中,要是pppoe密码变根了可以直接去这个文件修改
 
 
 
posted @ 2017-07-03 19:11  木栩  阅读(3612)  评论(0编辑  收藏  举报