How To Create A Second Wifi Network
Steps to create a second (or third) network on a Mikrotik router, perhaps for a guest network.
Background
I like to separate different WiFi on my network. So my friends use a guest network, the kids are on their own network, etc.
Many home routers have a "tick the box" style of guest WiFi network, you tick the "guest network" box and out pops a virtual guest access point.
Mikrotik routers can do exactly the same thing, except you can have effectively unlimited access points and you need to build the network piece by piece.
Steps
In this guide, I create a separate WiFi interface for phones and tablets.
Phones rarely need full network access to other local devices. And they have a nasty habit of getting lost, stolen or otherwise broken, so having a separate WiFi access point (and password) means you don't accidentally disclose your main WiFi password.
I'll be using WinBox, but I'll also list the console details via a print command.
1. Create an Interface
First thing to do is create yourself a passphrase for your AP. I generate one from makemeapassword.org and save it in my KeePass database.
Then create a new security profile: Goto Wireless -> Security Profiles and add a new profile.
Give it an appropriate name (wpa2-phones
in my case). I disable WPA and only use WPA2, as I have no legacy devices and it improves security slightly. Finally, don't forget to enter your passphrase.
Then create a virtual access point: Goto Wireless -> Interfaces and then add a Virtual AP.
On the General tab, enter a name for the network interface (which will be used internally on your Mikrotik). Mine is wlan-phones
.
On the Wireless tab, enter an SSID to identify your network: ligos-phones
for me, then select your newly created security profile
2. Assign an IP Pool and Address
A network interface isn't much use without an IP address.
Goto IP -> Address and then add a new address.
Choose an appropriate IP address for your new network (I'm using 10.46.2.xxx
) and assign it to your new interface.
On many other routers, you assign an IP address range against the DHCP server. On a Mikrotik you create an IP Pool, which is then used by DHCP (and other things too, I guess, though I have no idea what). So we need a pool before we can configure DHCP.
Goto IP -> Pool and then add a new pool.
I tend to reserve the bottom ~60 address (from x.1
to x.63
) for static allocations, and x.255
is the broadcast address. Which means a range like 10.46.2.64 - 10.46.2.254
is my pool.
4. Create a DHCP Server
DHCP is used to assign addresses to devices as they connect to the WiFi network. They will use the pool we just created. And also assign a few other special addresses.
Goto IP -> DHCP Server -> DHCP Tab and add a new DCHP Server.
Give it a name (I named mine after the wlan-phones
interface). Select the interface you created. Extend the lease time to something reasonably long (I use 1 day). And select the address pool you created in the last step.
Now, jump over to the Networks tab and add new configuration.
The Address field is what ties the Address Pool, DHCP Server and Network Configuration all together. It should be the same as the IP address you chose, but with a zero at the end, and the netmask afterwards. 10.46.2.0/24
fits my example so far. The Netmask should be 255.255.255.0
or 24
, unless you know much more about subnets than I do.
I also set the router to be the DNS server and NTP server. And the domain to ligos.local
.
5. Assign an IPv6 Pool and Address
I also have a public IPv6 range assigned by my ISP, so I add an IPv6 address as well.
You need to create an IPv6 pool first, based on your public address assignment, before you can advertise it on an interface or assign an address. Also, because there's much more auto discovery built into IPv6, config is much less complicated.
Update 2018-11-10: Mikrotik now validates overlapping address pools, so you should just add new addresses which use the public pool.
Goto IPv6 -> Address. You'll note that link local addresses (starting with fe80
) have been dynamically created for your new interface. This is totally normal.
Now, add a new address.
Note, RouterOS version 6.43.4 seems to ignore whatever prefix you type in (the bit between the /56
your ISP assigns you and the ::1/64
) and assign the next highest one. I'm not sure if that's by design or a bug, but its a little annoying.
6. Add Firewall Rules
Before everything will work, you'll need a few firewall rules.
I've created a defacto routing policy based on Address Lists. By adding the new network masks to existing Address Lists, everything just works without any further changes to firewall rules. Though I'll list the firewall rules as well, for your reference.
There are 4 categories I have at the moment:
- all_internal - a list of all my internal networks. I need to add my new
10.46.2.0/24
network here. - internal_trusted - networks which may access LAN resources. As my new phones network doesn't need blanket local access, I don't add it.
- internal_restricted - networks which cannot access LAN resources (unless I add explicit rules). I add
10.46.2.0/24
here. - named_blah - specific named devices. Because you can't use DNS names in firewall rules.
Note the 10.46.1.0/26
network in internal_trusted. Although 10.46.1.0/24
is restricted by default, I trust a small part of that network (this lets my kids' devices access printers and SMB shares).
The most important firewall rule is the NAT rule, which translates public IP addresses to private ones. Without this, no Internet connectivity is possible.
The filters tab are where the firewall rules actually live. They enforce whatever policies I have, that is, what may access what. There are three categories of rules I have:
- Stats rules - these are just to track GBs and number of packets.
- Allow rules - to allow particular connections.
- Deny rules - the Mikrotik firewall allows everything by default, so you need some rules to reverse that behaviour.
Note that most rules are applied to the forward
chain. This is the one used when forwarding packets between networks (as opposed to packets within the same networks).
IPv6 firewall is considerably simpler: just the accounting rules. Although that's probably more due to my laziness than best practise.
7. Testing
Once configured, you should be able to ping the new IP addresses you just created.
And the final test is to connect a phone to the new WiFi network. Make sure it gets an IP address (if not, the WiFi interface itself or the DHCP server is mis-configured). And try to access the Internet (if you can't, the NAT rule or another firewall rule is probably broken).
It's also useful to keep an eye on the Log, as errors may appear in there to help you track down problems. And look against firewall rules to see when packet counts increase, that is a hint where things might be getting blocked.
Conclusion
You can create many new WiFi networks on a Mikrotik router to segregate and restrict devices.
The process is more involved than on most home routers, but considerably more flexible.
How To Create A Second Wifi Network
Source: https://blog.ligos.net/2016-10-04/Create_Another_Network_On_A_Mikrotik.html
Posted by: hamiltonwathre.blogspot.com
0 Response to "How To Create A Second Wifi Network"
Post a Comment