You are not logged in.

#1 2024-06-16 02:24:02

redshoe
Member
Registered: 2015-12-16
Posts: 250

[Solved] How to use two different IP for one SSH server

What I am trying to do is to transfer files in between PC A to PC B via SSH or SFTP protocol using ethernet. PC B already has SSH setup and running via internet connection with WLAN. But, I would like to have another connection via ethernet. Is it possible to add another IP with different subnet mask in order to achieve this? Or is there another way of doing this?

Thanks.

Last edited by redshoe (2024-06-16 16:09:01)

Offline

#2 2024-06-16 02:44:02

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 449

Re: [Solved] How to use two different IP for one SSH server

By default OpenSSH (and probably other servers) listens on all local addresses. It shouldn't be a problem to have multiple SSH connections via different interfaces.
What specific problem did you encounter?
What happens when you try to transfer files using ethernet interface address?
Are PC A and PC B in the same WLAN? Are they connected directly with ethernet cable?

Offline

#3 2024-06-16 05:45:57

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,664

Re: [Solved] How to use two different IP for one SSH server

Assuming there's an actual problem and this isn't just anticipatory: can you ping via the ethernet?

Offline

#4 2024-06-16 14:11:21

cryptearth
Member
Registered: 2024-02-03
Posts: 1,860

Re: [Solved] How to use two different IP for one SSH server

As this is a follow up to https://bbs.archlinux.org/viewtopic.php?id=296785 - Have you followed the information you were given: Properly set up the ethernet NICs on thier own subnet different from the wifi?
If so it should work out of the box without any further config required.

PC A
wifi: 192.168.1.100/24
ethernet: 192.168.2.1/24

PC B
wifi: 192.168.1.101/24
ethernet: 192.168.2.2/24

You should be able to connect via both wifi and ethernet by specifying the ip of the connection you want to use.

Hint: assign the same subnet to both wifi and ethernet might work but lijely cause issues.

Offline

#5 2024-06-16 15:28:50

redshoe
Member
Registered: 2015-12-16
Posts: 250

Re: [Solved] How to use two different IP for one SSH server

Yeah. I just set the network (via ethernet) with different subnet than the WLAN, and it worked right off the bat. For some reason, I thought there should be some kind of special treatment for sshd_config in order for this to work. Thank you for your help.

Offline

#6 2024-06-16 15:54:37

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,664

Re: [Solved] How to use two different IP for one SSH server

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#7 2024-06-16 17:08:36

cryptearth
Member
Registered: 2024-02-03
Posts: 1,860

Re: [Solved] How to use two different IP for one SSH server

redshoe wrote:

Yeah. I just set the network (via ethernet) with different subnet than the WLAN, and it worked right off the bat. For some reason, I thought there should be some kind of special treatment for sshd_config in order for this to work. Thank you for your help.

As pointed out by dimich: unless a service is bound to only a specific interface a normal server socket usually lustens on every incomming connection.
So usually care must be taken if one wants a service to only be bound to a specific interface.

Offline

Board footer

Powered by FluxBB