公司来了一个奇葩需求pppoe client+server+EOIP+vlan

1、PPPOE SERVER在上海,有多根ADSL,不同的ADSL有不同的vlan对应不同的帐号

2、北京的ROS和上海的ROS用EOIP,在IP基础上创建桥接隧道

3、北京的ROS上同时建立PPPOE SERVER

4、北京ROS和PC机器在一个二层网络里,PC机器可以通过PPPOE拨号到北京的ROS,我们设定PPPOE的帐号密码跟上海的PPPOE帐号密码一样,一一对应。

5、北京ROS上面,eoip创建好以后,在eoip上创建不同的vlan编号,在北京的ROS上通过不同的vlan,不同的帐号密码,拨号不同的ADSL

6、PC机器PPPOE拨号成功以后,同时北京的ROS对应的PPPOE拨号也拨号;PC机器PPPOE退出以后,同时北京的ROS对应的PPPOE拨号也退出。

拓扑图如下:

 

上海这边的路由器配置:

/interface bridge
add name=bridge1-lan
add name=bridge2-wan
/interface ethernet
set [ find default-name=ether1 ] name=ether1-wan
set [ find default-name=ether2 ] name=ether2-vlan2
set [ find default-name=sfp1 ] disabled=yes
/interface eoip
add local-address=192.168.2.99 mac-address=02:CF:80:02:C1:17 name=\
eoip-tunnel1 remote-address=192.168.13.253 tunnel-id=22
/interface vlan
add interface=bridge2-wan name=vlan37 vlan-id=37
add interface=bridge2-wan name=vlan38 vlan-id=38
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/interface bridge port
add bridge=bridge1-lan interface=ether3
add bridge=bridge1-lan interface=ether4
add bridge=bridge1-lan interface=ether5
add bridge=bridge2-wan interface=ether1-wan
add bridge=bridge2-wan interface=eoip-tunnel1
/ip address
add address=192.168.2.99/24 interface=ether2-vlan2 network=192.168.2.0
/ip route
add distance=1 dst-address=192.168.0.0/16 gateway=192.168.2.201

北京这边的路由器配置:

/interface bridge add name=bridge1-lan
/interface eoip add mac-address=02:CD:94:16:20:95 name=eoip-tunnel1 remote-address=192.168.2.99 tunnel-id=22
/interface vlan add interface=eoip-tunnel1 name=vlan37 vlan-id=37
/interface vlan add interface=eoip-tunnel1 name=vlan38 vlan-id=38
/interface pppoe-client add interface=vlan37 name=pppoe-out-vlan37 password=85582349 user=02585582349
/interface pppoe-client add interface=vlan38 name=pppoe-out-vlan38 password=85582354 user=02585582354
/ppp profile add dns-server=114.114.114.114 name=profile-pppoe on-down=":local u \$user\r\
\ninterface pppoe-client disable [find user=\$u]\r\
\n" on-up=":local u \$user\r\
\ninterface pppoe-client enable [find user=\$u]\r\
\n" only-one=yes
/interface bridge port add bridge=bridge1-lan interface=ether1
/interface bridge port add bridge=bridge1-lan interface=ether2
/interface bridge port add bridge=bridge1-lan interface=ether3
/interface bridge port add bridge=bridge1-lan interface=ether4
/interface bridge port add bridge=bridge1-lan interface=ether5
/interface pppoe-server server add disabled=no interface=bridge1-lan one-session-per-host=yes service-name=pppoe-server
/ip address add address=192.168.13.253/24 interface=bridge1-lan network=192.168.13.0
/ip firewall mangle add action=mark-routing chain=prerouting new-routing-mark=02585582349 passthrough=no src-address=100.10.1.1
/ip firewall mangle add action=mark-routing chain=prerouting new-routing-mark=02585582354 passthrough=no src-address=100.10.1.2
/ip firewall nat add action=masquerade chain=srcnat out-interface=all-ppp
/ip route add distance=1 gateway=pppoe-out-vlan37 routing-mark=02585582349
/ip route add distance=1 gateway=pppoe-out-vlan38 routing-mark=02585582354
/ip route add distance=1 dst-address=192.168.0.0/16 gateway=192.168.13.254
/ppp secret add local-address=100.10.1.254 name=02585582354 password=85582354 profile=profile-pppoe remote-address=100.10.1.102 service=pppoe
/ppp secret add local-address=100.10.1.254 name=02585582349 password=85582349 profile=profile-pppoe remote-address=100.10.1.101 service=pppoe