查看: 54|回复: 0

[Mikrotik Ros] RouterOs 利用L2TP实现多方异地组网,并实现在家办公

[复制链接]

124

主题

0

回帖

508

积分

管理员

积分
508
发表于 2026-8-20 21:16:38 | 显示全部楼层 |阅读模式


利用RouterOs 的L2TP协议实现多方异地组网实现互通,并实现在家办公。

当前环境EVE-ng模拟真实环境搭建
ROS-A为深圳总部--专线固定IPROS-B为长沙分公司--ADSL拨号上网ROS-C为广州分公司--ADSL拨号上网实现功能长沙和广州分公司和深圳总部公司内网互通
一、网络规划
1、各区域独自上网[break]
2、各区域通过IP地址互通(L2TP)
以下为网络拓扑图



二、ROS配置命令与截图
1、ROS-A配置

  1. /interface bridge
  2. add name=bridge1
  3. /ip pool
  4. add name=dhcp ranges=10.1.0.1-10.1.0.100
  5. /ip dhcp-server
  6. add address-pool=dhcp disabled=no interface=bridge1 name=dhcp1
  7. /interface bridge port
  8. add bridge=bridge1 interface=ether2
  9. add bridge=bridge1 interface=ether3
  10. add bridge=bridge1 interface=ether4
  11. /interface l2tp-server server
  12. set enabled=yes ipsec-secret=masktt.com use-ipsec=yes
  13. /interface list member
  14. add interface=ether1 list=WAN
  15. add interface=bridge1 list=LAN
  16. /ip address
  17. add address=10.1.0.254/24 interface=bridge1 network=10.1.0.0
  18. add address=10.10.10.10/24 interface=ether1 network=10.10.10.0
  19. /ip dhcp-client
  20. add interface=ether1
  21. /ip dhcp-server network
  22. add address=10.1.0.0/24 dns-server=114.114.114.114 gateway=10.1.0.254 \
  23.     netmask=24
  24. /ip dns
  25. set servers=114.114.114.114
  26. /ip firewall nat
  27. add action=masquerade chain=srcnat
  28. /ip route
  29. add distance=1 gateway=10.10.10.254
  30. /ppp secret
  31. add local-address=172.16.1.1 name=changsha password=changsha remote-address=\
  32.     172.16.1.2 service=l2tp
  33. add local-address=172.16.1.1 name=guangzhou password=changsha remote-address=\
  34.     172.16.1.3 service=l2tp
复制代码



2、ROS-B配置

  1. /interface bridge
  2. add name=bridge1
  3. /interface pppoe-client
  4. add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 \
  5.     password=changsha use-peer-dns=yes user=ROS-B
  6. /interface l2tp-client
  7. add connect-to=10.10.10.10 disabled=no ipsec-secret=masktt.com name=l2tp-out1 \
  8.     password=changsha use-ipsec=yes user=changsha
  9. /ip pool
  10. add name=dhcp ranges=10.2.0.1-10.2.0.100
  11. /ip dhcp-server
  12. add address-pool=dhcp disabled=no interface=bridge1 name=dhcp1
  13. /interface bridge port
  14. add bridge=bridge1 interface=ether2
  15. add bridge=bridge1 interface=ether3
  16. add bridge=bridge1 interface=ether4
  17. /interface list member
  18. add interface=pppoe-out1 list=WAN
  19. add interface=bridge1 list=LAN
  20. /ip address
  21. add address=10.2.0.254/24 interface=bridge1 network=10.2.0.0
  22. /ip dhcp-client
  23. add interface=ether1
  24. /ip dhcp-server network
  25. add address=10.2.0.0/24 dns-server=114.114.114.114 gateway=10.2.0.254 \
  26.     netmask=24
  27. /ip firewall nat
  28. add action=masquerade chain=srcnat
  29. /ip route
  30. add distance=1 dst-address=10.1.0.0/24 gateway=172.16.1.1
复制代码



3、ROS-C配置

  1. /interface bridge
  2. add name=bridge1
  3. /interface pppoe-client
  4. add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 \
  5.     password=guangzhou use-peer-dns=yes user=ROS-C
  6. /interface l2tp-client
  7. add connect-to=10.10.10.10 disabled=no ipsec-secret=masktt.com name=l2tp-out1 \
  8.     password=guangzhou use-ipsec=yes user=guangzhou
  9. /ip pool
  10. add name=dhcp ranges=10.3.0.1-10.3.0.100
  11. /ip dhcp-server
  12. add address-pool=dhcp disabled=no interface=bridge1 name=dhcp1
  13. /interface bridge port
  14. add bridge=bridge1 interface=ether2
  15. add bridge=bridge1 interface=ether3
  16. add bridge=bridge1 interface=ether4
  17. /interface list member
  18. add interface=pppoe-out1 list=WAN
  19. add interface=bridge1 list=LAN
  20. /ip address
  21. add address=10.3.0.254/24 interface=bridge1 network=10.3.0.0
  22. /ip dhcp-client
  23. add interface=ether1
  24. /ip dhcp-server network
  25. add address=10.3.0.0/24 dns-server=114.114.114.114 gateway=10.3.0.254 \
  26.     netmask=24
  27. /ip firewall nat
  28. add action=masquerade chain=srcnat
  29. /ip route
  30. add distance=1 dst-address=10.1.0.0/24 gateway=172.16.1.1
复制代码



4、长沙和广州分公司电脑与总公司内网测试截图
ROS-B长沙公司与深圳总部ping测试截图



ROS-C广州公司与深圳总部ping测试截图



以后是实操命令和winbox截图,电脑测试ping截图。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|蜀ICP备17024538号-6

在本版发帖
关注公众号
QQ客服返回顶部