歡迎您光臨本站 註冊首頁

xl2tpd+ipsec架設VPN,客戶端IP地址和網關地址一樣?

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

xl2tpd+ipsec架設VPN,客戶端IP地址和網關地址一樣?

我在用xl2tpd+ipsec做vpn伺服器的時候(暫時還沒有使用x509認證,想把vpn弄通了以後再來做這個認證),有個問題,已經困繞我好幾天了,都還沒有解決。
就是我的xl2tpd+ipsec已經啟動,客戶端(windows)也已經通過vpn分配的vpn帳號已經撥上來了,但有一個問題就是,客戶端獲取的網路參數一直都怪的:
IP:192.168.1.128   
子網掩碼:255.255.255.255  
網關:192.168.1.128
(IP地址和網關是一樣的,子網掩碼是4個255,xl2tpd.conf里換成其他的網段,客戶端再撥上來也是這種情況)

我大致的網路結構是,客戶端在一個網路裡面(內網通過nat上互聯網),遠程撥VPN伺服器(有一網卡設的公網,還有一網卡連接VPN所在的內網),訪問 VPN伺服器後面的區域網的服務(Windows操作系統組建的WEB伺服器)。

VPN上面的日誌為:
# more /var/log/messages
Jun  2 22:35:06 CentOS xl2tpd: Connection established to 客戶端公網IP, 40003.  Local: 49814, Remote: 16 (ref=0/0).
LNS session is 'default'
Jun  2 22:35:06 CentOS xl2tpd: Call established with 客戶端公網IP, Local: 42977, Remote: 1, Serial: 0
Jun  2 22:35:06 CentOS kernel: CSLIP: code copyright 1989 Regents of the University of California
Jun  2 22:35:06 CentOS kernel: PPP generic driver version 2.4.2
Jun  2 22:35:06 CentOS pppd: pppd 2.4.4 started by root, uid 0
Jun  2 22:35:06 CentOS pppd: Using interface ppp0
Jun  2 22:35:06 CentOS pppd: Connect: ppp0 <--> /dev/pts/0
Jun  2 22:35:07 CentOS kernel: PPP Deflate Compression module registered
Jun  2 22:35:08 CentOS pppd: Cannot determine ethernet address for proxy ARP
Jun  2 22:35:08 CentOS pppd: local  IP address VPN伺服器公網IP
Jun  2 22:35:08 CentOS pppd: remote IP address VPN伺服器私網IP
Jun  2 22:35:17 CentOS pppd: LCP terminated by peer (XM-ODM-^G^@<M-Mt^@^@^@^@)
Jun  2 22:35:17 CentOS pppd: Connect time 0.2 minutes.
Jun  2 22:35:17 CentOS pppd: Sent 33 bytes, received 3266 bytes.
Jun  2 22:35:17 CentOS xl2tpd: control_finish: Connection closed to 客戶端公網IP, serial 0 ()
Jun  2 22:35:17 CentOS xl2tpd: control_finish: Connection closed to 客戶端公網IP, port 40003 (), Local: 49814, Remote: 16


不知道到底是哪裡沒有設置好,還請朋友指點一下迷津,弄了一個星期了,還沒搞定。。。。
《解決方案》

應該是你配置文件的問題,把配置文件貼出來,大家可以一起幫你分析下
《解決方案》

xl2tpd.conf:
;
; This is a minimal sample xl2tpd configuration file for use
; with L2TP over IPsec.
;
; The idea is to provide an L2TP daemon to which remote Windows L2TP/IPsec
; clients connect. In this example, the internal (protected) network
; is 192.168.1.0/24.  A special IP range within this network is reserved
; for the remote clients: 192.168.1.128/25
; (i.e. 192.168.1.128 ... 192.168.1.254)
;
; The listen-addr parameter can be used if you want to bind the L2TP daemon
; to a specific IP address instead of to all interfaces. For instance,
; you could bind it to the interface of the internal LAN (e.g. 192.168.1.98
; in the example below). Yet another IP address (local ip, e.g. 192.168.1.99)
; will be used by xl2tpd as its address on pppX interfaces.


listen-addr = VPN伺服器公網IP
port = 1701
auth file = /etc/ppp/chap-secrets

; requires openswan-2.5.18 or higher - Also does not yet work in combination
; with kernel mode l2tp as present in linux 2.6.23+
; ipsec saref = yes
; forceuserspace = yes
;
; debug tunnel = yes


ip range = 192.168.2.3-192.168.2.254
local ip = VPN伺服器公網IP。
require chap = yes
refuse pap = yes
require authentication = yes
name = CentOS
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
《解決方案》

我用pptp 做的,結果和你一樣
《解決方案》

本帖最後由 coffee777 於 2010-06-03 20:34 編輯

你的內網ip是多少?試試DEBUG模式,加參數-D,貼來看下
你同時登錄多個用戶看得到的ip是不是相同的?
《解決方案》

本帖最後由 zhxd 於 2010-06-03 22:27 編輯

客戶端在內網的IP為:192.168.80.xx
VPN上內網的IP為:192.168.2.x(網關192.168.2.1)
同時撥了好幾個客戶端,是一樣的情況。

偶然間發現1701埠沒有開放(xl2tpd、ipsec服務都是啟動著的)。
xl2tpd -D出現:
xl2tpd: init_network: Unable to bind socket: Address already in use. Terminating.
《解決方案》

本帖最後由 coffee777 於 2010-06-04 15:00 編輯

init_network: Unable to bind socket: Address already in use. Terminating是因為你的xl2tp進程已經開啟了

你結束xl2tp進程再在使用-D參數,連接一個客戶端,貼一下輸出結果看下
《解決方案》

信春哥,問題搞定。
快信春哥,你的VPN一樣也能搞定。:lol:
《解決方案》

回復 1# zhxd


    客戶端獲取的是什麼地址呢?
《解決方案》

請問是怎麼解決的?

[火星人 ] xl2tpd+ipsec架設VPN,客戶端IP地址和網關地址一樣?已經有1695次圍觀

http://coctec.com/docs/service/show-post-13215.html