You are not logged in.

#1 2023-02-03 16:57:19

nexus
Member
Registered: 2022-04-26
Posts: 3

copy rate dependent on IP used to local host

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

#2 2023-02-03 18:11:31

seth
Member
Registered: 2012-09-03
Posts: 50,001

Re: copy rate dependent on IP used to local host

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.

Offline

#3 2023-02-03 18:18:52

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: copy rate dependent on IP used to local host

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 ' |

Offline

#4 2023-02-03 18:40:11

topcat01
Member
Registered: 2019-09-17
Posts: 124

Re: copy rate dependent on IP used to local host

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

#5 2023-02-08 18:37:00

nexus
Member
Registered: 2022-04-26
Posts: 3

Re: copy rate dependent on IP used to local host

seth wrote:

Plain rsync or w/ ssh? (-e)

Using -e

seth wrote:

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.

progandy wrote:

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.

topcat01 wrote:

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

#6 2023-02-08 19:10:42

just4arch
Member
Registered: 2023-01-07
Posts: 74

Re: copy rate dependent on IP used to local host

Depending on your router, hairpinning / hairpin routing might be another option.

Offline

#7 2023-02-08 19:47:36

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: copy rate dependent on IP used to local host

just4arch wrote:

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 ' |

Offline

Board footer

Powered by FluxBB