说明:简单的来说,同一网段内可用的IP数量只有64个;(不一定正确)最直接的解释就是每个客户端占用两个IP,因为根据IP掩码位/30得知可用的IP就是两个。对于为什么只有64个,下面是官方的解释。
解释:
分配静态IP的方式是通过ipconfig-push设置的,而ifconfig-push地址代表虚拟客户端和服务器IP端点。它们必须从连续/30个子网中取得,以便与Windows客户端和TAP-Windows驱动程序兼容。具体来说,每个端点对的IP地址中的最后一个八位字节必须从该集合中取出:
[1,2] [5,6] [9,10] [13,14] [17,18]
[21,22] [25,26] [29,30] [33,34] [37,38]
[41,42] [45,46] [49,50] [53,54] [57,58]
[61,62] [65,66] [69,70] [73,74] [77,78]
[81,82] [85,86] [89,90] [93,94] [97,98]
[101,102] [105,106] [109,110] [113,114] [117,118]
[121,122] [125,126] [129,130] [ 133,134] [137,138]
[141,142] [145,146] [149,150] [153,154] [157,158]
[161,162] [165,166] [169,170] [173,174] [177,178]
[181,182] [185,186] [189,190]
[201,202] [205,206] [209,210] [213,214] [217,218]
[221,222] [225,226] [229,230] [233,234] [237,238]
[241,242] [245,246] [249,250] [253,254]
解决方案:
既然每个网段只有64个,那么换个思路,搞多几个网段;
参考:
https://openvpn.net/index.php/open-source/documentation/howto.html#policy
https://serverfault.com/questions/826560/how-to-set-a-static-ip-client-side-in-openvpn