Graphic Motion Video Art, Website, IT Network, Culture

Loading...

As one of the IT staff in a company I have any request for me. How can we manage some local networks using just 1 network address but different subnets. In other word, we use the same network address that will divided by sub network. Yet I just think about when I want to manage some networks in different local port interface router so I divided into different network mask for the local network. But actually we can manage our networks into single network multiple subnets. So this implementation is about the understanding subnetting in ip address of the network. If you already knew it, just forget it! I just go to continue my notes.

For the example about Subnetting Ip Address C Class :

NETWORK ADDRESS = 192.168.1.0/26
Subnet Mask /26 = 11111111.11111111.11111111.11000000 = 255.255.255.192
Number of Subnet = 2^x = 2^2 = 4 segments
Number Host/Subnet = 2^y-2 = 2^6 – 2 = 62 host
Subnet block = 256 – 192 = 64, 64 + 64 = 128, 128+64=192 =  0, 64, 128, 192

x : number of binary 1 of the last 2nd octet 
y : number of binary 0 of the last 2nd octet

For more clearly about subnetting IP address you can go to boossit.wordpress.com and for you who want  automatic calculation of it, you can go to http://jodies.de/ipcalc

Ok lets get furthermore how we implement it into our Mikrotik router. 

Lets say we have the internet connection with the modem that has

IP gateway = 192.168.1.1

We have plan to share the internet connection to our local network

Number of Localnet = 4

The forth local network will be divided into 4 subnets in the same network address

Network Address = 192.168.2.0/24 so our subnets will be
Subnet Localnet1 : 192.168.2.0/26
Subnet Localnet2 : 192.168.2.64/26 
Subnet Localnet3 : 192.168.2.128/26
Subnet Localnet4 : 192.168.2.192/26

Reset your router with no default configuration, then we can start how to configure our mikrotik using 1 network address divided by 4 subnets of our local network.

1. Setup identity, DNS server, and NTP client of the Mikrotik router

We begin by setup identity of your router. Sometimes if you have some mikrotik routers, its better we give the name of router to prevent  the mistake which one of mikrotik router that now you setup or change. Then we chose the dns server reference and NTP client at first.

/system identity
set name=Agratitudesign
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/system ntp client
set enabled=yes primary-ntp=203.89.31.13 secondary-ntp=82.200.209.236

2. Setup Interface Port Names for all the Ports that will used

Just the name, you can give any interface port names as you like. In this case I was using internet for wan or gateway, and localnet-1, localnet-2, localnet-3, localnet-4 for the local network interface names.

/interface ethernet
set [ find default-name=ether1 ] name=internet
set [ find default-name=ether2 ] name=localnet-1
set [ find default-name=ether3 ] name=localnet-2
set [ find default-name=ether4 ] name=localnet-3
set [ find default-name=ether5 ] name=localnet-4


As the picture above, we use just 1 wan or internet whatever you say, and 2 local port interfaces. No matter if we just use 2 local port, the rest is just spare ports that will ready to use.

3. Setup Network IP address for the Interface Ports and the Route Gateway

For wan or internet interface we use 192.168.1.2/24, start from 192.168.1.2 its because our IP gateway from the ISP router is using 192.168.1.1. So don’t use 192.168.1.1/24 unless the router will not find the gateway of the internet.

/ip address
add address=192.168.1.2/24 interface=internet network=192.168.1.0
add address=192.168.2.1/26 interface=localnet-1 network=192.168.2.0
add address=192.168.2.65/26 interface=localnet-2 network=192.168.2.0
add address=192.168.2.129/26 interface=localnet-3 network=192.168.2.0
add address=192.168.2.193/26 interface=localnet-4 network=192.168.2.0
/ip route
add distance=1 gateway=192.168.1.1


As you can see, we use 192.168.2.1/26, 192.168.2.65/26, 192.168.2.129/26, 192.168.2.193/26 as the Network IP address for local port interfaces. /26 will has 4 subnets or segments of the total range network address hosts.

4. Setup DHCP Server and IP Pools for Our Local Subnet Interfaces

So 1 dhcp server and ip pool is for 1 local subnet interfaces. Because we have 4 local port subnet interfaces, we must create 4 dhcp servers with ip pools.

/ip pool
add name=dhcp_pool1 ranges=192.168.2.2-192.168.2.62
add name=dhcp_pool2 ranges=192.168.2.66-192.168.2.126
add name=dhcp_pool3 ranges=192.168.2.130-192.168.2.190
add name=dhcp_pool4 ranges=192.168.2.194-192.168.2.254

/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=localnet-1 name=dhcp1
add address-pool=dhcp_pool2 disabled=no interface=localnet-2 name=dhcp2
add address-pool=dhcp_pool3 disabled=no interface=localnet-3 name=dhcp3
add address-pool=dhcp_pool4 disabled=no interface=localnet-4 name=dhcp4

/ip dhcp-server network
add address=192.168.2.0/26 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.2.1
add address=192.168.2.64/26 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.2.65
add address=192.168.2.128/26 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.2.129
add address=192.168.2.192/26 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.2.193



5. Create Localnets Masquerade Nat rules on Firewall Nat 

We have 4 masquerading nat rules on firewall nat. If you want to make off of or disable the internet connections for those local port subnet interfaces, you can do it by disable this rules that you want to make off.

/ip firewall nat 
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.2.0/26 disabled=no comment="localnet-1"
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.2.64/26 disabled=no comment="localnet-2"
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.2.128/26 disabled=no comment="localnet-3"
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.2.192/26 disabled=no comment="localnet-4" 



For any new of the mikrotik router configuration, we should try to reboot the router, for all the rules on it is working stable and actual like we were setup before. After this, you should can use the internet connection from each local port subnet interfaces. Then from the clients side, you can see what the IP number and IP gateway they get from.


6. Setup Bridge for Local Network Port Subnet Interfaces

Obviously the clients on different network or sub network that use different interface  can not communicate the data one another thorough local networks. This is why we have to setup the bridge for those clients that was using different port interface on your router. 


The picture above is client subnet 1 is remote client subnet 2 that is using chrome remote desktop thorough internet connection. Client 1 and Client 2 are using different interface of the router. Event we share the file folder on the clients, we still could not see the file folder that have shared thorough local network.

So what will we do now is setup the bridge for each local subnet interface on mikrotik router. Open your winbox and insert this kind rules.

/interface bridge
add name=bridge_localnet
/interface bridge port
add bridge=bridge_localnet interface=localnet-1
add bridge=bridge_localnet interface=localnet-2
add bridge=bridge_localnet interface=localnet-3
add bridge=bridge_localnet interface=localnet-4

Setup bridge on each interface is like you merge the interfaces and follow dhcp server of the bridge interface that you have to setup. If you stop in this step, of course it will make all local network broken, because the clients using dhcp server for each interface that now already merge. 


What we have to do is change one of localnet dhcp server to the bridge interface name, in this case bridge_localnet like the picture below. Or you can create a new rule for the bridge dhcp server like this

/ip address
add interface=bridge_localnet address=192.168.2.1/24
/ip pool
add name=dhcp_pool_bridge ranges=192.168.2.2-192.168.2.254
/ip dhcp-server
add address-pool=dhcp_pool_ disabled=no bridge interface=bridge_localnet
/ip dhcp-server network
add address=192.168.2.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.2.1


The local subnet network will working again which is no longer using each own subnet dhcp server, otherwise is using one of the bridge dhcp server. Lets check the client get the IP, and now you can share the file folder that you want it. As the picture below the network sharing for each client across the interface router.


That’s all that I can inform you depending on experiment about implementing subnet on local port interfaces and setup the bridge interfaces on dhcp server Mikrotik router. For more clearly lets the video!



Related to this topic here the complete rules if we don’t require to use subnetting for the local port interfaces Mikrotik router!

/system identity
set name=Agratitudesign

/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4

/system ntp client
set enabled=yes primary-ntp=203.89.31.13 secondary-ntp=82.200.209.236

/interface ethernet
set [ find default-name=ether1 ] name=internet
set [ find default-name=ether2 ] name=localnet-1
set [ find default-name=ether3 ] name=localnet-2
set [ find default-name=ether4 ] name=localnet-3
set [ find default-name=ether5 ] name=localnet-4

/ip address
add address=192.168.1.2/24 interface=internet network=192.168.1.0
add address=192.168.2.1/24 interface=localnet-1 network=192.168.2.0
add address=192.168.3.1/24 interface=localnet-2 network=192.168.3.0
add address=192.168.4.1/24 interface=localnet-3 network=192.168.2.0
add address=192.168.5.1/24 interface=localnet-4 network=192.168.2.0

/ip route
add distance=1 gateway=192.168.1.1

/ip pool
add name=dhcp_pool1 ranges=192.168.2.2-192.168.2.254
add name=dhcp_pool2 ranges=192.168.3.2-192.168.3.254
add name=dhcp_pool3 ranges=192.168.4.2-192.168.4.254
add name=dhcp_pool4 ranges=192.168.5.2-192.168.5.254

/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=localnet-1 name=dhcp1
add address-pool=dhcp_pool2 disabled=no interface=localnet-2 name=dhcp2
add address-pool=dhcp_pool3 disabled=no interface=localnet-3 name=dhcp3
add address-pool=dhcp_pool4 disabled=no interface=localnet-4 name=dhcp4

/ip dhcp-server network
add address=192.168.2.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.2.1
add address=192.168.3.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.3.1
add address=192.168.4.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.4.1
add address=192.168.5.0/24 dns-server=8.8.8.8,8.8.4.4 gateway=192.168.5.1

/ip firewall nat 
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.2.0/24 disabled=no comment="localnet-1"
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.3.0/24 disabled=no comment="localnet-2"
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.4.0/24 disabled=no comment="localnet-3"
add action=masquerade chain=srcnat out-interface=internet src-address=192.168.5.0/24 disabled=no comment="localnet-4"

/interface bridge
add name=bridge_localnet

/interface bridge port
add bridge=bridge_localnet interface=localnet-1
add bridge=bridge_localnet interface=localnet-2
add bridge=bridge_localnet interface=localnet-3
add bridge=bridge_localnet interface=localnet-4

/ip address
add interface=bridge_localnet address=192.168.2.1/24

/ip pool
add name=dhcp_pool5 ranges=192.168.2.2-192.168.2.254

/ip dhcp-server
add address-pool=dhcp_pool5 disabled=no interface=bridge_localnet

/ip dhcp-server network
add address=192.168.2.0/24 gateway=192.168.2.1

Share This Article :
Related Articles

8 comments :

  1. Next article will be how to build our own web server to be accessible thorough public IP, even you just have dynamic public IP by your ISP on our own PC. This is about how we can port forwarding local PC as the web server that will be accessing from outside IP gateway on our router!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Nice article, Bli. I just start learning and practicing Mikrotik--just don't have a real device, so I'm use virtualbox, soo limited, but for practice it's just enough.

    I have situation. Month ago, I got a project to setup local network and find out, their office use RB450 Mikrotik. I've check out the setup, port 2-4 used for hotspot (10.x.10.1, 10.x.11.1, 10.x.12.x) and 1 port for lan (192.x.x.1). The problem comes with no one have the access to router, and because they wanna add more BW and Telkom's techical officer meet me and asking for the login (whilst I don't have it) they put a Juniper Network device, and want to configure it. The Juniper not work properly (IMHO) because the BW remain the same. They have BW: 100Mbps speedy/indihome (I guess). Each hotspot has 5M download and lan has 48/50M download (max-limit--I guess). I see the possibility their (the office chairman) asking me to reset and re-configure that Mikrotik. That's why I'm starting to re-learn it.

    For the basic, your articles help me alot. I've been setup a real situation: Modem Andromax--Virtual mikrotik--real pc (won't having access if router not configured)--virtual xp (client port hotspot)--virtual wins7 (client port hotspot), tired to seek the tutorial/video with the real situation, so I have to figure it out by myself. And, it work. Next step is learning BW management (understanding it (in-out, etc)).

    I've read almost all of you post about BW management. So now, here the question "There's any chance we can do some discussion, maybe by email?

    ReplyDelete
  4. Very helpful suggestions that help in the optimizing website. thank for sharing the link.

    หนังซอมบี้

    ReplyDelete
  5. You're so cool! I don't suppose to learn something like this before. Thank you for sharing this hotmail sign in

    ReplyDelete
  6. We are a team of experienced software developers in Eastern Europe. We provide best deals, at lucrative rates to our customers. CONTACT US, if you are looking for one.

    ReplyDelete
  7. autocad crack from keyslog.com
    total video converter full crack from forcrack

    ReplyDelete
  8. After going through the blog post on "Local Port Interfaces same Network different Subnets and Bridge Mikrotik," I found it to be incredibly informative and practical. The step-by-step instructions provided for configuring Mikrotik routers to manage multiple local networks using a single network address but different subnets were clear and easy to follow. The post also highlighted the concept of subnetting IP addresses, which can be valuable for anyone dealing with networking setups. It's impressive how the author explained the topic in a straightforward manner, making it accessible even for those who may not be familiar with subnetting. I couldn't agree more with the idea of playing games to refresh the mind and enhance problem-solving abilities. Personally, my favorite game,asphalt 8 mod apk, has been a great source of mental rejuvenation and has improved my problem-solving skills. It's fascinating how engaging in such games can provide a unique avenue for sharpening cognitive abilities while also offering a fun and enjoyable experience.

    ReplyDelete

Back to Top