Ethernet shield doing some strange(r) things

Hi everyone, I hope you can help me with this problem. I'm unable to find a way to fix it and I will do my best to explain:

I have an arduino with the ethernet shield connected to my router. I also have an app called "cmd" in my iPhone to send udp packets to my router's public IP. This router has the ports configured pointing to arduino's local IP.

If I send an UDP packet with my iPhone using mobile data, it will work.
If I send the packet when the iPhone is connected via WIFI to my friend's router, it will work.
If I send the packet with the iPhone connected to the same router than arduino, it WON'T work.

So everytime I want to send a packet at home I have to disable WIFI in my iPhone first, so it will send the packet via 4G/3G or whatever.

Maybe it's arduino's problem or maybe it's my router's problem.

I'm not an expert on this stuff, so please help me. Right now I want to know why this happens more than fixing it xD

That's not an Arduino question but a question of "how to configure my router".

If the WiFi device (iPrison) is connected to the router's WiFi network it's on the internal network. Almost any router won't do port forwarding on the internal network. If you're on the internal network change the destination IP to the one of the Arduino instead of the router's public IP.

pylon:
That's not an Arduino question but a question of "how to configure my router".

If the WiFi device (iPrison) is connected to the router's WiFi network it's on the internal network. Almost any router won't do port forwarding on the internal network. If you're on the internal network change the destination IP to the one of the Arduino instead of the router's public IP.

I thought the problem was something wrong with my code, that's why I'm asking here.

And I don't know why my router will not do port forwarding on the internal network, if I send a packet to a public IP via wifi, the router should do it even if the destination is itself.

EDIT: nevermind, I finally discovered it's my router's problem, something related to hairpining NAT or so.