设为首页收藏本站language 语言切换
查看: 2359|回复: 3
收起左侧

PPTP隧道连接应用实例 有兴趣的来看看

[复制链接]
发表于 2013-8-12 15:04:26 | 显示全部楼层 |阅读模式
Router to Router安全隧道实例
以下是一个使用互联网上的加密PPTP隧道连接两个企业网局域网的例子:
图片1.jpg
在这个例子中有两个不同地区办公室的路由器,需要让两个办公局域网的主机之间实现互访:
· [HomeOffice]
接口LocalHomeOffice  10.150.2.254/24
接口ToInternet  192.168.80.1/24
· [RemoteOffice]
接口ToInternet  192.168.81.1/24
接口 LocalRemoteOffice  10.150.1.254/24
每个路由器连接到当地的ISP,任何一个路由器可以通过互联网访问到对端的路由器。
HomeOffice配置
HomeOffice端建立PPTP服务器,首先我们进入/ppp secret目录下添加客户端账号:
[admin@HomeOffice] ppp secret> add name=ex service=pptp password=123456
local-address=10.0.103.1 remote-address=10.0.103.2
[admin@HomeOffice] ppp secret> print detail
Flags: X - disabled
  0   name="ex" service=pptp caller-id="" password="123456" profile=default
      local-address=10.0.103.1 remote-address=10.0.103.2 routes==""
[admin@HomeOffice] ppp secret>
Winbox操作如下:
图片2.png
interface pptp-server server目录下,启用pptp服务器:
[admin@HomeOffice] interface pptp-server server> set enabled=yes
[admin@HomeOffice] interface pptp-server server> print
            enabled: yes
                mtu: 1460
                mru: 1460
     authentication: mschap2
    default-profile: default
[admin@HomeOffice] interface pptp-server server>
Winbox下配置进入ppp目录下启用pptp server
图片3.png
RemoteOffice配置
在RemoteOffice路由器添加一个PPTP客户:
[admin@RemoteOffice] interface pptp-client> add connect-to=192.168.80.1 user=ex \
\... password=123456 disabled=no
[admin@RemoteOffice] interface pptp-client> print
Flags: X - disabled, R - running
  0  R name="pptp-out1" mtu=1460 mru=1460 connect-to=192.168.80.1 user="ex"
       password="123456" profile=default add-default-route=no
[admin@RemoteOffice] interface pptp-client>
Winboxinterface中添加pptp-client
图片4.png
这样,一个PPTP隧道就在路由器之间创建好了。这个隧道就像在IP地址为10.0.103.1及10.0.103.2的路由器之间的三层点对点连接。
pptp局域网的互访
pptp隧道建立完成后,仅是路由器间可以互访,但两个企业间的局域网需要通过设置路由完成连接
图片5.jpg
为了在PPTP隧道上互访企业间本地网络,需要添加以下路由:
[admin@HomeOffice] > ip route add dst-address=10.150.1.0/24 gateway=10.0.103.2
[admin@RemoteOffice] > ip route add dst-address=10.150.2.0/24 gateway=10.0.103.1
或者也可以在PPTP服务器(HomeOffice)上通过用户配置的routes参数完成,RemoteOffice还是需要在/ip route中配置路由:
[admin@HomeOffice] ppp secret> print detail
Flags: X - disabled
  0   name="ex" service=pptp caller-id="" password="123456" profile=default
      local-address=10.0.103.1 remote-address=10.0.103.2 routes==""
[admin@HomeOffice] ppp secret> set 0 routes="10.150.1.0/24 10.0.103.2 1"
[admin@HomeOffice] ppp secret> print detail
Flags: X - disabled
  0   name="ex" service=pptp caller-id="" password="123456" profile=default
      local-address=10.0.103.1 remote-address=10.0.103.2
      routes="10.150.1.0/24 10.0.103.2 1"
[admin@HomeOffice] ppp secret>
目的路由:10.150.1.0/24
pptp的网关:10.0.103.2
Distance路径: 1
Winbox中修改routes参数
图片6.png
测试PPTP隧道连接:
[admin@RemoteOffice]> /ping 10.0.103.1
10.0.103.1 pong: ttl=255 time=3 ms
10.0.103.1 pong: ttl=255 time=3 ms
10.0.103.1 pong: ttl=255 time=3 ms
ping interrupted
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 3/3.0/3 ms
测试通过PPTP隧道到LocalHomeOffice接口的连接:
[admin@RemoteOffice]> /ping 10.150.2.254
10.150.2.254 pong: ttl=255 time=3 ms
10.150.2.254 pong: ttl=255 time=3 ms
10.150.2.254 pong: ttl=255 time=3 ms
ping interrupted
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 3/3.0/3 ms
通过PPTP隧道连接终端客户
下面的例子显示了通过终端电脑与远程办公网络进行PPTP加密隧道通信,如外地出差的同时,通过笔记本电脑连接会公司的网络进行远程信息管理和查询
图片7.jpg
这个例子中的路由器:
· [RemoteOffice]
接口ToInternet  192.168.81.1/24
接口Office  10.150.1.254/24
PPTP服务器上设置用户帐号:
[admin@RemoteOffice] ppp secret> add name=ex service=pptp password=123456
local-address=10.150.1.254 remote-address=10.150.1.2
[admin@RemoteOffice] ppp secret> print detail
Flags: X - disabled
  0   name="ex" service=pptp caller-id="" password="123456" profile=default
      local-address=10.150.1.254 remote-address=10.150.1.2 routes==""
[admin@RemoteOffice] ppp secret>
启用pptp服务:
[admin@RemoteOffice] interface pptp-server server> set enabled=yes
[admin@RemoteOffice] interface pptp-server server> print
            enabled: yes
                mtu: 1460
                mru: 1460
     authentication: mschap2
    default-profile: default
[admin@RemoteOffice] interface pptp-server server>
在笔记本电脑访问回公司后,需要访问内部网络资源,需要配置规则才能确保通常,有两种方法:
局域网连接方法1代理ARP必须在'Office'接口上启用,这样可以通过代理arp访问,但有个缺点是内外的DHCP服务可能会受到影响:
[admin@RemoteOffice] interface ethernet> set Office arp=proxy-arp
[admin@RemoteOffice] interface ethernet> print
Flags: X - disabled, R - running
  #    NAME                 MTU   MAC-ADDRESS       ARP
  0  R ToInternet           1500  00:30:4F:0B:7B:C1 enabled
  1  R Office               1500  00:30:4F:06:62:12 proxy-arp
[admin@RemoteOffice] interface ethernet>
winbox中进入interface目录下,选择office接口设置arpproxy-arp
图片8.png
局域网连接方法2通过nat设置masquerade,规则要求对所有来访数据进行伪装,这样保证内外网通过转换通信
[admin@RemoteOffice] /ip firewall nat> add chain=srcnat action=masquerade [admin@RemoteOffice] /ip firewall nat> print
Flags: X - disabled, R - running
  Flags: X - disabled, I - invalid, D - dynamic
0   chain=srcnat action=masquerade
[admin@RemoteOffice] interface ethernet>
winbox中添加masquerade规则:
图片9.png
还有更多的相关资料大家可以到Cdnat官网去看看,也可以到ROS软路由论坛去交流。



 楼主| 发表于 2013-8-13 09:15:39 | 显示全部楼层
自己给自己顶下再说
沙发 2013-8-13 09:15:39 回复 收起回复
回复 支持 反对

使用道具 举报

头像被屏蔽
发表于 2013-9-30 13:11:45 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
板凳 2013-9-30 13:11:45 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2013-11-11 11:13:53 | 显示全部楼层
地板 2013-11-11 11:13:53 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-4-25 20:49 , Processed in 0.144522 second(s), 30 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表