2011年9月8日 星期四

HOW TO set up a RASPPPoE Server ( for Windows )


This document describes how the free RASPPPoE driver can be used on Windows 2000 and higher as a PPPoE Server, allowing client PPPoE configurations to be tested and traced, and also providing Internet connectivity to the client.
Installation and Configuration
  1. Install the RASPPPoE driver on the Windows system.
  2. Click StartSettingsNetwork and Dial-up ConnectionsMake New Connection
  3. In the Network Connection Wizard, click the "Accept incoming connections" radio button.
  4. Select the LAN Adapter to which your RASPPPoE driver is bound.
  5. Select "Do not allow virtual private connection".
  6. Specify the "Allowed Users" details.
  7. Select the "PPPoE Protocol" Networking Component.
  8. Click Finish.
The Network Connection Wizard will then create a new Connection called "Incoming Connections" in the Network and Dial-up Connections folder. You should now view the Properties of that connection and examine the Properties of the TCP/IP Protocol bound to that connection. This is where you specify the IP address assigned to the connection end-points.
If you have access to registered IP addresses managed by a DHCP Server on your enterprise LAN, you should allow address assignment to be done via DHCP.
If you have no spare registered IP addresses, simply use a private IP address like 172.16.1.1 for the Server end of the connection and 172.16.1.2 for the Client end of the connection. To test the client's access to the Internet, simply run NAT32 Build 1036 or later, binding it to your Internet connection and to your RASPPPoE adapter (private interface).
Router Configuration
If you have a router that uses the PPPoE protocol to connect to the Internet, you need to configure it to connect to the RASPPPoE Server. This is usually done by specifying a usercode and password and then letting the router search for a PPPoE server on the network to which it connects. The usercode and password will of course have to match the values you specified when you configured the RASPPPoE Incoming Connection under Windows.
Once you have connected the router to the server, it will then have Internet access via NAT32, and all private machines connected to the router will be able to access the Internet.
You may have to set the MTU that the router uses to 1472 bytes, but the standard PPPoE MTU of 1492 usually works correctly.
Windows Client Configuration
To connect a Windows machine to the NAT32 RASPPPoE Server, open Control PanelNetwork and select the Properties of the RASPPoE Protocol. You may need to set the MTU to 1472 bytes, but the standard PPPoE MTU of 1492 usually works correctly.
Now "dial" the connection by clicking the Shortcut that the RASPPPOE.EXE program will have placed on your Desktop.
The client machine (98/SE/ME/2000/XP) will then have Internet Connectivity via the PPPoE protocol.
To trace network traffic, simply click the NAT32 Trace Icon.
Limitations
Windows 2000 Professional allows only two such connections to be in place simultaneously. Windows 2000 Server (and higher) supports more than two simultaneous RASPPPoE connections.
NAT32 supports up to 8 such connections.

linux-PPPoE-server建立


平台環境:
CentOS-5.4
rp-pppoe-3.5-32.1
ppp-2.4.4-2
一、安裝rpm package
    rpm -qa | grep ppp 命令檢查系統是否安裝rp-pppoe和pppd,如果沒有安裝需先安裝這兩個rpm package
二、修改config
cd /etc/ppp/
1.vim pppoe-server-options //修改驗證方式為chap和增加用戶DNS
    
# PPP options for the PPPoE server 
# LIC: GPL 
#require-pap 
require-chap //修改為chap驗證
login 
lcp-echo-interval 10 
lcp-echo-failure 
ms-dns 172.18.0.6 //增加為client分配的DNS地址
~
2.vim chap-secrets
# Secrets for authentication using CHAP 
# client server secret IP addresses 
chao * chao * //添加client端賬號和密碼
abc * abc * 
####### redhat-config-network will overwrite this part!!! (begin) ########## 
####### redhat-config-network will overwrite this part!!! (end) ############
3.vim options
#lock 
local //修改為允許本地用戶驗證
三、開啟PPPoE服務
/usr/sin/pppoe-server -I eth0 -L 192.168.0.1 -R 192.168.0.2 -N 65534
-I 指定LAN網卡
-L 指定SERVER IP地址
-R 指定分配給Clinet端IP地址的起始地址
-N 指定分配給Clinet端IP地址的個數
-k 使用PPP的kernel mode

然後就可以在Clinet端PPPoE-client進行撥號了。但是還不能上網,上網還需要作以下配置。

四、配置網卡
如果是實現PPPOE撥號上網,還需要配置網卡。
LINUX服務器網絡設置
  雖然也可以在圖形界面中是為網卡設置IP地址,但是真正實現網卡IP地址等信息的準確可靠,還是要在相應的文件中作設置,我們本次要設置兩塊網卡,編輯好的文件內容如下:
  [root@localhost network-scripts]# pwd 
  /etc/sysconfig/network-scripts 
  [root@localhost network-scripts]# more ifcfg-eth0 
  TYPE=Ethernet 
  BOOTPROTO=static 
  IPADDR=0.0.0.0 
  DEVICE=lan 
  HWADDR=00:0C :29:0a:69:89 
  ONBOOT=yes 
  NETMASK=0.0.0.0

  [root@localhost network-scripts]# more ifcfg-eth1 
  TYPE="Ethernet" 
  BOOTPROTO=static 
  IPADDR=10.70.10.11 
  DEVICE=wan 
  HWADDR=00:0C:29:33:69:90 
  ONBOOT=yes 
  NETMASK=255.255.0.0 
  GATEWAY=10.70.0.1
我們重點看一下ifcfg-eth1的配置文件,其中ONBOOT="yes"是必須的,可以保證系統啟動網卡自動連接到網絡上,網關的信息是我們手工添加進出去,保證有網關可以正常的訪問外部網絡,ifcfg-eth0文件中只要保證ONBOOT="yes"就可以了,當然像在routeros中一樣,我們將外網口的名字定義為wan,將內網口的名字定義為lan
五、開啟pppoe轉發功能,實現上網
   當然現在客戶端還不能上網,因為PPPOE服務器還沒有啟用NAT,我們用IPTABLES軟件來實現,寫一個這樣的腳本即可:  echo "1" >> /proc/sys/net/ipv4/ip_forward   iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o wan -j SNAT --to 10.70.10.23


  第一行的作用是啟用IP轉發,第二行是啟動IPTABLES進行NAT轉換,下面是對各個參數的解釋
  -t nat表示進行NAT轉化
  -s 192.168.0.0/24表示源地址為192.168.0.0/24這個網段
  -j SNAT --to 10.70.10.23表示將源地址都轉化成10.70.10.23這個外網地址
同樣的,我們可以對照routeros系統裡NAT的設置來理解這條命令。啟動NAT以後,這台PPPOE服務器就功能完整了,客戶端不僅可以撥通服務器,撥通後還可以上網。

How to use simple speedtest in RaspberryPi CLI

  pi@ChunchaiRPI2:/tmp $  wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py --2023-06-26 10:4...