Connection when Changing Network

Hi!

When I connect to my server from LAN, it is not possible to connect over WAN IP which is adjusted. Therefore, I set also LAN IP to connect from LAN. However if I move from LAN to WAN, it is not possible to disconnect from LAN settings and connect to WAN. I always have to restart my computer. How can I fix this issue without the need of restarting the computer.

Thank you.