You are not logged in.
Similar to this post (https://bbs.archlinux.org/viewtopic.php?id=250193), I have a host on my LAN that I can connect to using my public IP. I want to connect to it from within my LAN, using the public IP, and have that connection never leave my LAN.
I can connect this way, and if I use tracepath using the public IP I get:
1?: [LOCALHOST] pmtu 1500
1: hostname 0.388ms reached
1: hostname 0.284ms reached
Resume: pmtu 1500 hops 1 back 1
That seems to indicate that it's using the local route (1 hop), right?
However, if I transfer a file, using scp or rsync, then it is about 8x slower using the public IP rather than the local IP. Is there a way to fix this? Or, is this to be expected? Is the router doing extra work to process the packets in the case with the public IP?
Offline
Plain rsync or w/ ssh? (-e)
I want to connect to it from within my LAN, using the public IP
Why, though?
I mean, your plan is to have the traffic to that IP not route through the interwebs what at some point will require something smart to kick in and map the WAN IP to your LAN IP, so in effect, your goal is to NOT use the WAN IP.
Online
It is likely that your traffic can be simply switched by your "router" if you use the internal IP. The external IP has to be routed, there is probably a firewall that has to look at the connection as well. That all impacts speed.
The commonly used "router" description is not technically correct, it is an IAD (integrated access device) as it contains modem, router, firewall, switch, wifi ap, ...
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Online
I may be complicating things here, so please ignore if it is indeed so. One option here is to use split-horizon DNS. Then the same name can be resolved to ether the WAN or LAN IP depending on the query source address. Just an idea; I realise it is slightly tangential.
Offline
Plain rsync or w/ ssh? (-e)
Using -e
Why, though?
I mean, your plan is to have the traffic to that IP not route through the interwebs what at some point will require something smart to kick in and map the WAN IP to your LAN IP, so in effect, your goal is to NOT use the WAN IP.
The primary use case is that I have a script to backup directories to a host at home. By pointing to the WAN IP, I can connect to it whether I'm sitting at home or elsewhere. However, when I'm at home, it makes the transfer much slower than using the LAN IP.
It is likely that your traffic can be simply switched by your "router" if you use the internal IP. The external IP has to be routed, there is probably a firewall that has to look at the connection as well. That all impacts speed.
I suspected that it might be something like this. The WAN IP is mapped to the LAN IP of the host using the router's port forwarding. So maybe there's extra processing that takes place using the WAN IP.
I may be complicating things here, so please ignore if it is indeed so. One option here is to use split-horizon DNS. Then the same name can be resolved to ether the WAN or LAN IP depending on the query source address. Just an idea; I realise it is slightly tangential.
This sounds like a potential solution. I'll look into it. Or, maybe I want https://wiki.archlinux.org/title/OpenSS … figuration?
Offline
Depending on your router, hairpinning / hairpin routing might be another option.
Offline
Depending on your router, hairpinning / hairpin routing might be another option.
That should be what is currently in use.
The primary use case is that I have a script to backup directories to a host at home.
If you want to avoid split horizon DNS, you could modify that script to check the local IP first.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Online