T
T
tictac172020-03-14 00:21:09
Mikrotik
tictac17, 2020-03-14 00:21:09

How to keep port number after passing NAT in Mikrotik?

A question. I need that after passing through NAT in Mikrotik, when initiating a connection from an ip-phone, for example, from port 5060, it is also broadcast in 5060 (UDP). That is, so that Mikrotik saves the port after broadcasting and, say, the telephony server sees that the phone connects to it from port 5060, and not the one that Mikrotik randomly offers. In kinetic routers, this is solved simply - with the ip nat udp-port-preserve command, and port translation becomes one-to-one. How about Mikrotik?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andy_U, 2020-03-14
@Andy_U

Some years ago I set up port forwarding for torrents and skype at home. But there the programs themselves support uPNP and you can fix the port. I mark incoming connections to these ports (different for different machines in the network) for chain=preprouting and allow them in chain = forward (I have everything disabled by default). And the dst-nat rules, as far as I remember, are created dynamically by workstations via uPNP. Total, and incoming connections are correctly routed. If there is neither uPNP, nor the port on the phone can not be fixed, then I don’t know. But you need to dig somewhere here anyway.

D
Drill, 2020-03-14
@Drill

/ip firewall nat
add chain=srcnat action=src-nat to-addresses=ВАШ_ВНЕШНИЙ_IP to-ports=5060 protocol=udp src-address=ДОКАЛЬНЫЙ_IP_ТЕЛЕФОНА src-port=5060   out-interface=ВНЕШНИЙ_ИНТЕРФЕЙС

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question