DD-WRT(pptp-client):连接到VPN时自动添加路由和DNS信息?
我正在使用 DD-WRT 的 PPTP 客户端连接到 VPN。在服务/PPTP 客户端配置页面上,我指定了远程子网 192.168.112.0 和掩码 255.255.255.0。
建立连接后,该路由将自动添加。但是,还可以通过该连接使用其他子网,例如 192.168.7.0,但我必须在命令行中手动添加这些路由才能使其正常工作。
我相信 VPN 服务器必须发送路由列表,因为当我使用 Windows XP 连接到 VPN 时,所有这些子网的路由都会自动添加到路由表中。
有没有办法让 DD-WRT 在建立连接时自动添加这些路由?也就是说,如果 VPN 服务器后面的网络配置发生变化,我无需手动编辑 DD-WRT 上的路由表。
DNS 服务器也是如此,有没有办法避免手动输入用于 VPN 连接的 DNS 服务器?
I'm using DD-WRT's PPTP client to connect to a VPN. On the Services / PPTP Client configuration page, I specified remote subnet 192.168.112.0 and the mask 255.255.255.0.
Once the connection is established, that route is automatically added. However, there other subnets that are available through that connection, such as 192.168.7.0 but I have to manually add these routes at the command line to make it work.
I believe the VPN server must be sending a list of routes because when I use Windows XP to connect to the VPN, routes for all those subnets are automatically added to the routing table.
Is there a way to have DD-WRT automatically add these routes when the connection is established? That was, if the network configuration changes behind the VPN server, I wouldn't have to manually edit the routing table on my DD-WRT.
Same thing for the DNS server, is there a way to avoid manually entering the DNS server to use for the VPN connection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当 ppp 连接启动时,此脚本:
在您的系统中执行。请注意,有一些变量是从服务器传递的。阅读最后一个
for
语句,它将启动更多脚本:在
/etc/ppp/ip-up.d
文件夹中,我有一个名为40 的文件-dns.sh
。它看起来像这样,它将使用 VPN 服务器发送的 DNS 服务器设置/etc/resolve.conf
对于建立连接时要在路由表中推送的路由,您应该能够执行以下操作类似的伎俩。转至 pppd 手册页查看需要使用的变量名称。
这个代码示例来自我的 Gentoo Linux PC,但是这个东西是 Linux 通用的,所以它也可以在 DD-WRT 上工作。
When the ppp connection starts this script:
is executed in your system. Note that there are some variables that are passed from the server. Read the last
for
statement, it will start a few more scripts:in the
/etc/ppp/ip-up.d
folder I have a file called40-dns.sh
. It looks like this and it will set the/etc/resolve.conf
with the DNS servers sent by the VPN serverFor the routes to be pushed in the routing table on connection estabilished you should be able to do a similar trick. Go to the pppd man pages to see the variable names that you need to use.
This code samples are from my Gentoo Linux PC, but this stuff is Linux generic so it will work also on DD-WRT.
虽然之前的答案对于 Linux 一般而言是正确的,但您无法在某些 ddwrt 路由器上轻松编辑或添加文件。
我使用的所有 4 个 ddwrt 路由器都会在 pptp 客户端运行时生成这些文件,因此无法仅更改或添加文件。
这是一种似乎适用于大多数路由器的解决方法 http:// stadar.org/content/ddwrt-pptp-client-add-routes-after-connection
Although previous answer is correct for linux in general, you cannot edit or add files that easily on some ddwrt routers.
All 4 ddwrt routers I use generate these files when pptp client is run, making it impossible to just change or add files.
Here is a workaround that seems to work on most routers http://stadar.org/content/ddwrt-pptp-client-add-routes-after-connection