Ah ok this info helps a lot.
This is *possible*, but unsupported... you're correct in thinking that the public IP is different from the IP of the actual machine, and it takes quite a bit of technical knowledge to make that not the case. (You've got to make sure that at each level of the networking infrastructure, from the ISP down to the router you connect to at home, traffic is getting routed to the right place.)
It's not something we support, and not something I'd even recommend spending your time working on unless you really, really know your way around networking. (FWIW, this sort of thing is complicated enough that when X-Plane needs it---for our web servers---we pay other people to deal with it for us.)
X-Plane's networking really only functions well when the two computers are on the same network. For example, if you had friends over to fly together and they're using your same wifi router.
The other option is to use a third party server. This is why services such as VATSIM exist.