pppoe

解决Ubuntu16.04拨号上网及有线连接频繁断网的问题

最近从Ubuntu14.04换到了16.04,学校又从锐捷校园网换成了深澜,于是上网时候遇到了一些小问题。 首先解决在Ubuntu下拨号上网

首先终端输入

$ sudo pppoeconf

之后就会出现一个界面,一直选yes就可以(Enter键确认,Tab键切换选项)

之后到了输入用户名和密码,务必记得将原位置的文字删干净

一路yes就搞定了。

之后上网只要在终端中输入下面命令就可以了

$ sudo pon dsl-provider

如果要切断网络

$ sudo poff dsl-provider

解决频繁断网的问题

以上就解决了Ubuntu拨号上网的问题,但是连上网之后想要看一下网页发现经常打不开网页,频繁断网,于是在终端中测试了一下网络果然是网络连接断断续续的。

$ ping www.baidu.com
PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data.
64 bytes from 220.181.112.244: icmp_seq=1 ttl=50 time=18.8 ms
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
64 bytes from 220.181.112.244: icmp_seq=6 ttl=50 time=18.8 ms
64 bytes from 220.181.112.244: icmp_seq=7 ttl=50 time=18.7 ms
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable

针对这个问题,改一下配置文件就可以解决

终端输入

$ sudo gedit /etc/ppp/peers/dsl-provider

将配置文件按如下更改(更改lcp-echo-interval、lcp-echo-failure、mtu、persist、maxfail、holdoff)

# Minimalistic default options file for DSL/PPPoE connections
noipdefault
defaultroute
replacedefaultroute
hide-password
#lcp-echo-interval 30
#lcp-echo-failure 4
lcp-echo-interval 10
lcp-echo-failure 10
noauth
persist
#mtu 1492
#persist
#maxfail 0
#holdoff 20
mtu 1000
persist
maxfail 0
holdoff 0
plugin rp-pppoe.so
nic-enp0s25
usepeerdns
user "××××××××××"

之后保存。

然后

$ sudo gedit /etc/ppp/options

找到以下两个参数位置,并更改数值

lcp-echo-interval 10
lcp-echo-failure 10

保存。

最后重启一下拨号连接就可以了

$ sudo poff dsl-provider
$ sudo pon dsl-provider