I want to use it as travel router similar to the setup Lorenzo used in the presentation.
For example connect it to a hotel wifi or lan on port 1 providing the internet connection.
Then have different virtual aps running, where i connect my own devices or connect them via lan port 2.
As in the presentation it would be nice to have “MyBridged”, “MyRouted” and “MyVPN”. The other things
like “MyFriends” or hot spot or the other funny things i would not need right now, but if i could get the complete
config i could just disable them.
Also using netwatch to detect internet and vpn connection via leds would be very useful.
Thanks to the wonderful information on the forum i started doing my own config.
Because i need the router next week, i did a quick and dirty solution with different bridges,
there are probably more elegant ways to solve this (vlans?).
add action=masquerade chain=srcnat out-interface=openvpn_home
/ip route
add distance=1 dst-address=10.0.0.0/8 gateway=openvpn_home routing-mark=
redirect-to-openvpn scope=10
/system clock
set time-zone-name=Europe/Berlin
/system identity
set name=MAP
/system leds
set 3 type=on
set 4 type=on
/system scheduler
add name=autorun-client-mode on-event=“/system script run client-mode”
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon
start-time=startup
/system script
add dont-require-permissions=no name=client-mode owner=admin policy=
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=“#
wait 3s after startup to run script\r
\n:delay 3\r
\n\r
\n#ensure that master wireless is set as station\r
\n/interface wireless set wlan1 mode=station ssid="" security-profile=de
fault;\r
\n:log info "Set wlan1 network as station";\r
\n\r
\n#wait 15s for wireless to have time to connect\r
\n:delay 15;\r
\n\r
\n#check if wireless is connected to a network\r
\nlocal connectstatus [/interface get wlan1 running]\r
\n\r
\n#if wireless is connected to something, don’t do anything. Else set mast
er wireless as AP\r
\nif $connectstatus do={\r
\n:log info "Network active, keep on keeping on";\r
\n} else={\r
\n/interface wireless set wlan1 mode=ap-bridge ssid="MAP" security-profi
le=AccessPoint;\r
\n:log info "Network not active, setting master network to AP";}”
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
/tool netwatch
add comment=“Check Internet” down-script=“system leds set 3 type=off” host=
8.8.8.8 interval=30s up-script=“system leds set 3 type=on”
add comment=“Check OpenVPN” down-script=“system leds set 4 type=off” host=
10.10.10.1 interval=30s up-script=“system leds set 4 type=on”
Some things i got already working properly and others not…
Seperating the different networks with firewalling isn’t done yet at all.
I have some question to the config, maybe someone can answer those:
For the wifi interface wlan1 (client) which is connecting to the access points i choosed the mode station, what is the difference compared to station bridge and station peusdobridge?
Should i prefer one of the other two modes or stay with station?
On the virtual wlan2 i set the mode to bridge, which is wrong i guess, i want to have “level 2” access to the wireless network (bridge with the physical wlan), which mode i need for that?
I tried to setup routing and masquerading only for the MyVPN wlan, but i can also reach the hosts inside the vpn when i connect via the MyBridged wlan.
How do i have to change the routing and masquerading rules, or do i have to block this via firewall?
yes, thank you, i already set this 2 modes and they are working. only for the mybridge wlan i have no clue how to solve this…
i set the physical wlan1 to station mode and the virtual wlans ap-mode. do i have to do it the opposite way?
set physical wlan1 to ap-mode and virtual wlan2 for example to station to connect to the hotel and for wlan2 to station with dhcp-client for the bridged access?
The physical wlan has to be set to station-pseudobridge and the virtual wlan to ap-bridge or bridge.
The map is ready for this week, there were some minor things that i must change someday or which are not working as expected yet.
The openvpn-client is creating a dynamic routing rule, and i can access from myvpn AND myrouted to the vpn network.
That’s something that i must solve someday. I will probably post a complete config someday, when all the minor things were solved
and when i don’t forget it
If using it with wifi only:
Don’t forget to use access list to connect to various wifi sources including… your phone’s hotspot, so it will always find a known network and then the virtual networks can be made.
No connected network= no connection = more problems for reconfiguring ( eth and winbox will always work when done properly but it is easier when ‘it just connects’).
Yeah i defined some networks in the connect list, but i included also a fallback script, that is autorun at boot: if no network is found that
the map can connect to, the physical wlan is set to ap-bridge. So in every case you can connect to a running wlan:
/system scheduler
add name=autorun-client-mode on-event="/system script run client-mode" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup
/system script
add dont-require-permissions=no name=client-mode owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
wait 3s after startup to run script\r\
\n:delay 3\r\
\n\r\
\n#ensure that master wireless is set as station\r\
\n/interface wireless set wlan1 mode=station-pseudobridge ssid=\"\" securi\
ty-profile=default;\r\
\n:log info \"Set wlan1 network as station\";\r\
\n\r\
\n#wait 15s for wireless to have time to connect\r\
\n:delay 15;\r\
\n\r\
\n#check if wireless is connected to a network\r\
\nlocal connectstatus [/interface get wlan1 running]\r\
\n\r\
\n#if wireless is connected to something, don't do anything. Else set mast\
er wireless as AP\r\
\nif \$connectstatus do={\r\
\n:log info \"Network active, keep on keeping on\";\r\
\n} else={\r\
\n/interface wireless set wlan1 mode=ap-bridge ssid=\"MAP-FALLBACK\" secur\
ity-profile=AccessPoint;\r\
\n:log info \"Network not active, setting master network to AP\";}"