正在加载...

OpenVPN 分配固定IP

[ 2011/06/13 12:47 | by selboo ]

OpenVPN 分配固定IP

修改server.conf 添加一行:
client-config-dir /usr/local/openvpn-2.1.3/client

添加客户端固定IP
cat > /usr/local/openvpn-2.1.3/client/selboo
ifconfig-push 192.168.70.117 192.168.70.118
Ctrl+d

我之前配置为:
ifconfig-push 192.168.70.117 255.255.255.0

客户端连接就报错

Mon Jun 13 11:49:21 2011 There is a problem in your selection of --ifconfig endpoints [local=192.168.70.117, remote=255.255.255.0].  The local and remote VPN endpoints must exist within the same 255.255.255.252 subnet.  This is a limitation of --dev tun when used with the TAP-WIN32 driver.  Try 'openvpn --show-valid-subnets' option for more info.
Mon Jun 13 11:49:21 2011 Exiting

因为 openvpn只支持255.255.255.252 的子网,252 子网只有 三个IP,一个给客户端,一个给服务器,一个给广播地址
所以client目录下面的文件内容只能是:

子网              ,   有效的主机                             ,   广播地址            
192.168.70.0    ,   192.168.70.1  到 192.168.70.2      ,   192.168.70.3    
192.168.70.4    ,   192.168.70.5  到 192.168.70.6      ,   192.168.70.7    
192.168.70.8    ,   192.168.70.9  到 192.168.70.10     ,   192.168.70.11  
192.168.70.12   ,   192.168.70.13  到 192.168.70.14    ,   192.168.70.15  
192.168.70.16   ,   192.168.70.17  到 192.168.70.18    ,   192.168.70.19  
192.168.70.20   ,   192.168.70.21  到 192.168.70.22    ,   192.168.70.23  
192.168.70.24   ,   192.168.70.25  到 192.168.70.26    ,   192.168.70.27  
192.168.70.28   ,   192.168.70.29  到 192.168.70.30    ,   192.168.70.31  
192.168.70.32   ,   192.168.70.33  到 192.168.70.34    ,   192.168.70.35  
192.168.70.36   ,   192.168.70.37  到 192.168.70.38    ,   192.168.70.39  
192.168.70.40   ,   192.168.70.41  到 192.168.70.42    ,   192.168.70.43  
192.168.70.44   ,   192.168.70.45  到 192.168.70.46    ,   192.168.70.47  
192.168.70.48   ,   192.168.70.49  到 192.168.70.50    ,   192.168.70.51  
192.168.70.52   ,   192.168.70.53  到 192.168.70.54    ,   192.168.70.55  
192.168.70.56   ,   192.168.70.57  到 192.168.70.58    ,   192.168.70.59  
192.168.70.60   ,   192.168.70.61  到 192.168.70.62    ,   192.168.70.63  
192.168.70.64   ,   192.168.70.65  到 192.168.70.66    ,   192.168.70.67  
192.168.70.68   ,   192.168.70.69  到 192.168.70.70    ,   192.168.70.71  
192.168.70.72   ,   192.168.70.73  到 192.168.70.74    ,   192.168.70.75  
192.168.70.76   ,   192.168.70.77  到 192.168.70.78    ,   192.168.70.79  
192.168.70.80   ,   192.168.70.81  到 192.168.70.82    ,   192.168.70.83  
192.168.70.84   ,   192.168.70.85  到 192.168.70.86    ,   192.168.70.87  
192.168.70.88   ,   192.168.70.89  到 192.168.70.90    ,   192.168.70.91  
192.168.70.92   ,   192.168.70.93  到 192.168.70.94    ,   192.168.70.95  
192.168.70.96   ,   192.168.70.97  到 192.168.70.98    ,   192.168.70.99  
192.168.70.100  ,   192.168.70.101  到 192.168.70.102  ,   192.168.70.103  
192.168.70.104  ,   192.168.70.105  到 192.168.70.106  ,   192.168.70.107  
192.168.70.108  ,   192.168.70.109  到 192.168.70.110  ,   192.168.70.111  
192.168.70.112  ,   192.168.70.113  到 192.168.70.114  ,   192.168.70.115  
192.168.70.116  ,   192.168.70.117  到 192.168.70.118  ,   192.168.70.119  
192.168.70.120  ,   192.168.70.121  到 192.168.70.122  ,   192.168.70.123  
192.168.70.124  ,   192.168.70.125  到 192.168.70.126  ,   192.168.70.127  
192.168.70.128  ,   192.168.70.129  到 192.168.70.130  ,   192.168.70.131  
192.168.70.132  ,   192.168.70.133  到 192.168.70.134  ,   192.168.70.135  
192.168.70.136  ,   192.168.70.137  到 192.168.70.138  ,   192.168.70.139  
192.168.70.140  ,   192.168.70.141  到 192.168.70.142  ,   192.168.70.143  
192.168.70.144  ,   192.168.70.145  到 192.168.70.146  ,   192.168.70.147  
192.168.70.148  ,   192.168.70.149  到 192.168.70.150  ,   192.168.70.151  
192.168.70.152  ,   192.168.70.153  到 192.168.70.154  ,   192.168.70.155  
192.168.70.156  ,   192.168.70.157  到 192.168.70.158  ,   192.168.70.159  
192.168.70.160  ,   192.168.70.161  到 192.168.70.162  ,   192.168.70.163  
192.168.70.164  ,   192.168.70.165  到 192.168.70.166  ,   192.168.70.167  
192.168.70.168  ,   192.168.70.169  到 192.168.70.170  ,   192.168.70.171  
192.168.70.172  ,   192.168.70.173  到 192.168.70.174  ,   192.168.70.175  
192.168.70.176  ,   192.168.70.177  到 192.168.70.178  ,   192.168.70.179  
192.168.70.180  ,   192.168.70.181  到 192.168.70.182  ,   192.168.70.183  
192.168.70.184  ,   192.168.70.185  到 192.168.70.186  ,   192.168.70.187  
192.168.70.188  ,   192.168.70.189  到 192.168.70.190  ,   192.168.70.191  
192.168.70.192  ,   192.168.70.193  到 192.168.70.194  ,   192.168.70.195  
192.168.70.196  ,   192.168.70.197  到 192.168.70.198  ,   192.168.70.199  
192.168.70.200  ,   192.168.70.201  到 192.168.70.202  ,   192.168.70.203  
192.168.70.204  ,   192.168.70.205  到 192.168.70.206  ,   192.168.70.207  
192.168.70.208  ,   192.168.70.209  到 192.168.70.210  ,   192.168.70.211  
192.168.70.212  ,   192.168.70.213  到 192.168.70.214  ,   192.168.70.215  
192.168.70.216  ,   192.168.70.217  到 192.168.70.218  ,   192.168.70.219  
192.168.70.220  ,   192.168.70.221  到 192.168.70.222  ,   192.168.70.223  
192.168.70.224  ,   192.168.70.225  到 192.168.70.226  ,   192.168.70.227  
192.168.70.228  ,   192.168.70.229  到 192.168.70.230  ,   192.168.70.231  
192.168.70.232  ,   192.168.70.233  到 192.168.70.234  ,   192.168.70.235  
192.168.70.236  ,   192.168.70.237  到 192.168.70.238  ,   192.168.70.239  
192.168.70.240  ,   192.168.70.241  到 192.168.70.242  ,   192.168.70.243  
192.168.70.244  ,   192.168.70.245  到 192.168.70.246  ,   192.168.70.247  
192.168.70.248  ,   192.168.70.249  到 192.168.70.250  ,   192.168.70.251  
192.168.70.252  ,   192.168.70.253  到 192.168.70.254  ,   192.168.70.255  

最后编辑: selboo 编辑于2011/09/03 00:50
Tags: ,
,
发表评论
表情
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]