歡迎您光臨本站 註冊首頁

關於openvpn的ip分配疑問

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

關於openvpn的ip分配疑問

我client分配到的IP在windows2003上面看到的是
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : TAP-Win32 Adapter V8
   Physical Address. . . . . . . . . : 00-FF-DD-7E-E0-D1
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IP Address. . . . . . . . . . . . : 10.8.0.6
   Subnet Mask . . . . . . . . . . . : 255.255.255.252
   Default Gateway . . . . . . . . . : 10.8.0.5
   DHCP Server . . . . . . . . . . . : 10.8.0.5
   DNS Servers . . . . . . . . . . . : 10.8.0.1
   Lease Obtained. . . . . . . . . . : 2008年7月2日 12:01:49
   Lease Expires . . . . . . . . . . : 2009年7月2日 12:01:49

但是我在openvpn server上面的ipp.txt里看到的是
cat ipp.txt
client1,10.8.0.4
為什麼會為上面看到的是4而不是6呢?

請知道的老大說說.還有就是我分配靜態IP給client1,無論我怎麼寫IP和掩碼,都提示我IP是錯誤的.配置文件我保證沒有任何問題
看howtoo來做的.

server.conf

port 1194

proto tcp

dev tun

ca /tmail/vpn/openvpn/etc/keys/ca.crt
cert /tmail/vpn/openvpn/etc/keys/server.crt
key /tmail/vpn/openvpn/etc/keys/server.key  # This file should be kept secret

dh /tmail/vpn/openvpn/etc/keys/dh1024.pem

server 10.8.0.0 255.255.255.0

ifconfig-pool-persist  /tmail/vpn/openvpn/etc/ipp.txt
client-config-dir ccd

push "redirect-gateway"
push "dhcp-option DNS 10.8.0.1"

keepalive 10 120

comp-lzo

user nobody
group nobody

persist-key
persist-tun

status /var/log/openvpn-status.log

verb 4

[ 本帖最後由 scyzxp 於 2008-7-2 12:19 編輯 ]
《解決方案》

在/etc/openvpn/server.conf中增加
client-config-dir /etc/openvpn/ccd

然後在 /etc/openvpn/ccd目錄中放針對每個客戶端的個性化配置文件。
文件名就用客戶端名 生成key的時候輸入的 "Common Name" 名字

比如要設置客戶端 liushiwei為 192.168.2.24
只要在 /etc/openvpn/ccd/liushiwei文件中包含一行:

ifconfig-push 192.168.2.24 255.255.255.0


就可以了
《解決方案》

tun模式掩碼是/30的,比如你獲得的地址是10.0.0.6,那麼network就是10.0.0.4,gateway是10.0.0.5,broadcast是10.0.0.7,還會自動加1條10.0.0.0/24的默認路由
tap模式掩碼是/24,你要設置靜態ip把tun模式改成tap模式是最簡單的做法

[ 本帖最後由 911csj 於 2008-7-27 20:34 編輯 ]

[火星人 ] 關於openvpn的ip分配疑問已經有1008次圍觀

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