Community discussions

MikroTik App
 
jmacias
just joined
Topic Author
Posts: 9
Joined: Thu Oct 08, 2009 8:50 pm
Location: Houston, TX

Trouble mapping 1 private address to another private address

Sun Sep 09, 2012 1:17 am

Greetings!

This morning I embarked on a Saturday morning Mikrotik adventure attempting to get an APP from my cable provider to function with my home network (with a Mikrotik router).

Here is a brief layout of my network.
ether5 - WAN connection to my provider (public IP)
bridge1 - My LAN devices, including a bridged wireless AP (192.168.1.0/24)
ether2 - TV Receiver/DVR (192.168.10.0/29, device static leased to 192.168.10.6)
Challenge #1 (solved): My first challenge was that the APP (similar to BuddyTV) expects my cable receiver/DVR to be on the same network as my iPhone. Up until this morning the DVR connected directly to my provider's modem, on a different network than the rest of my LAN. I figured I could simply connect the DVR to my Mikrotik, and all would be fine, which was not the case. The DVR obtained an IP for my LAN, but the TV transmission would stop after just a few seconds and lose connection. After doing some research, I learned I needed an IGMP proxy (http://forum.mikrotik.com/viewtopic.php?f=2&t=26514), which I configured on my bridge1, and successfully fixed the transmission problems. However that introduced challenge #2...

Challenge #2 (solved): As soon as I setup the IGMP proxy on my bridge1, the TV stream was fixed, but now my LAN was being flooded with multicast. I found multiple threads detailing work-arounds for this (as RouterOS does not support IGMP snooping), and ultimately decided on removing ether2 from the bridge, creating a secondary network (192.168.10.0/29) on ether2. This helped stopped the LAN multicast issue, but then I ran into issues masquerading both private networks. After some more research I fixed with information found in thread: http://forum.mikrotik.com/viewtopic.php?f=2&t=62954 using these 2 rules:
3   chain=srcnat action=masquerade src-address=192.168.1.0/24 out-interface=!bridge1 

 4   chain=srcnat action=masquerade src-address=192.168.10.0/29 out-interface=!ether2 

This now introduced Challenge #3...

Challenge #3 (unsolved): Now I have successfully setup an IGMP proxy for the TV transmission to work properly, and separated networks so my LAN is not degraded with multicast. But now my problem is that the APP itself (that started this whole journey), is trying to discover the TV Receiver/DVR on the same network as my phone (192.168.1.0/24), which will never be successful. So I figure what I need to do is NAT an address out of 192.168.1.0/24, I decided on 192.168.1.6, to the address of the DVR: 192.168.10.6. That way when the APP tries to do its discovery, and scans on host address 192.168.1.6, it will redirect to 192.168.10.6. I found multiple threads detailing 1-to-1 NAT, and used the following rules:
1   chain=dstnat action=dst-nat to-addresses=192.168.1.6 dst-address=192.168.10.6 

 2   chain=srcnat action=src-nat to-addresses=192.168.10.6 src-address=192.168.1.6
However, this does not seem to be working properly, as the rules are not getting any hits. The full set of rules I am using are below, and I have tried changing the ordering without success:
 0   ;;; Masquerade for Provider/WAN
     chain=srcnat action=masquerade src-address=192.168.1.0/24 out-interface=ether5 

 1   chain=dstnat action=dst-nat to-addresses=192.168.1.6 dst-address=192.168.10.6 

 2   chain=srcnat action=src-nat to-addresses=192.168.10.6 src-address=192.168.1.6 

 3   chain=srcnat action=masquerade src-address=192.168.1.0/24 out-interface=!bridge1 

 4   chain=srcnat action=masquerade src-address=192.168.10.0/29 out-interface=!ether2


Here is my routing table if necessary:
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADS  0.0.0.0/0                          99.x.x.1              0
 1 ADC  99.x.x.0/22    99.x.x.x  ether5                    0
 2 ADC  192.168.1.0/24     192.168.1.1     bridge1                   0
 3 ADC  192.168.10.0/29    192.168.10.1    ether2                    0
Am I am missing something obvious? Are my NAT rules incorrect? Or should I be using a different method to accomplish this?

Hopefully I have explained this with enough detail. Thanks for reading!
 
tws101
Member Candidate
Member Candidate
Posts: 283
Joined: Thu Sep 08, 2011 11:25 pm

Re: Trouble mapping 1 private address to another private add

Tue Sep 11, 2012 10:27 pm

The issue for problem 3 is your NAT rules.

The src-nat replaces the source address... I think you need the netmap rule

netmap - creates a static 1:1 mapping of one set of IP addresses to another one. Often used to distribute public IP addresses to hosts on private networks