1. 程式人生 > >CentOS7下寬頻連線

CentOS7下寬頻連線

背景

辦了個寬頻,沒有路由器。需要電腦撥號上網。windows下挺簡單,三步搞定。但是Linux有點傻眼。使用的Centos沒有adsl工具,只能自行安裝。切到Linux下沒網,所以先在windows下載好軟體包,放到可訪問的目錄下。

下載

#wget https://www.roaringpenguin.com/files/download/rp-pppoe-3.12.tar.gz

前提是得有個網,沒網自行解決

安裝

檢視README

QUICKSTART
----------

If you're lucky, the "quickstart" method will work.  After unpacking
the
archive, become root and type: ./go This should configure, compile and install the software and set up your DSL connection. You'll have to answer a few questions along the way. If you want the GUI wrapper, type: ./go-gui If ./go and ./go-gui didn't work, read the rest of this README. Compiling ---------
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 4) Compile: $ make 4) Install (this step must be done as root) # make install
5) Now read doc/HOW-TO-CONNECT --

自行安裝,如果遇到依賴得軟體,自行下載安裝。總之,把它裝上就行了。

配置

# pppoe-setup

配置具體內容
1. Enter your PPPoE user name : ISP提供的賬戶,給你是啥就是啥:比如:dianxian123
2. Enter the Ethernet interface :使用ifconfig命令,第一個就是,注意不要預設eth0,尤其筆記本。依據ifconfig命令結果填寫,比如enp9s0
3. Enter the demand value:若長時間連線,連線會被自動中斷,no
4. Enter the DNS information here:ISP得DNS地址。上網搜一個。DNS查詢: http://www.ip.cn/dns.html,找個本省得,或者公共得。填寫IP
5. Enter the secondary DNS server address here:備份的DNS地址
6. Please enter your PPPoE password:賬號的密碼
7. Please re-enter your PPPoE password:確認輸入密碼
8. Choose a type of firewall:選擇防火牆:關了吧。0
9. Accept these settings and adjust configuration files:確認輸入的配置資訊是否正確,y
客戶端配置完成

操作

# pppoe-start
# pppoe-status
# pppoe-stop

連不上?

確認下DSL配置檔案NOBOTE是否為YES

# cd /etc/sysconfig/network-scripts/
# vim ifcfg-Wired-ConnetXXX

已連線就是上不了網

要放大召了,TMD用手機百度搜了半天沒有個毛結果,翻過倒過去,結果條目雖多,其實沒有幾篇文章,原創只有幾篇。相互抄襲,而且對我都不可用。
在快要放棄的時候想起來,打通乙太網連線和pppoe的連線是否還需要路由呢?

# ifconfig

看到ppp0的資訊

ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1480
        inet 192.168.84.174  netmask 255.255.255.255  destination 10.10.10.10
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 48531  bytes 46033448 (43.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 45044  bytes 5083861 (4.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

重點看inet 192.168.84.174。為乙太網卡新增一個路由到此ip

# route add default gw 192.168.84.174

哈哈哈,ping通了。大功告成。終於可以使用Linux愉快的上網了!!!離windows又遠了一步。

PS:其實在windows一切都挺好的,但是當做機器學習使用一些python包時,玩windows感覺不爽。比如不相容,dos終端命令不習慣。