Ubuntu – Making the sftp server and still not know the cause of problem

internetnetworkingserversftpssh

I building a linux server and today I have a problem. I'm using ubuntu for user not ubuntu server.
My server use 2 ways to connect and use 2 different router

*1: Using an 4 ports LAN card to make a bonding mode, the router have gateway 192.168.1.1, the IP of bonding is 192.168.1.147 .The bonding is working good, I can easy connect to sever.

*2: Using normal internet port on mainboard, gateway is 192.168.5.1, IP for server is 192.168.5.11 . This connection use for SFTP server.

Check this pictures to see my connection:
ifconfig -a ifconfig -a

I make a sftp server using openssh, here is my test case using filezilla:

  • Connect to server via LAN ip 192.168.1.147 and external ip of router 192.168.1.1: working

  • Connect to server via LAN ip 192.168.5.11: working

  • Connect via external ip of router 191.168.5.1: not working

The result of not work test from filezilla:

Status: Connecting to 123.21.47.2:3389…

Response: fzSftp started, protocol_version=8

Command: open "Deadlinesftp@123.21.47.2" 3389

Error: Network error: Connection timed out

Error: Could not connect to server

I have already do the port redirection on router, and this router work well with another windows server. I feel like something in ubuntu OS is blocking the connection via external ip of 192.168.5.1, I turned off the ubuntu firewall and still not work. I have to focus on 192.168.5.1 because this is the internet line use for ftp or sftp, can't use another one.

Does anyone here know why and can help me with this problem please.

Thank you so much.

Best Answer

The issue here is that you can only have one default gateway and you have two and enp5s0 is defined first, so that takes all traffic and enp6s0 gets none...

That leaves you with the following possibilities:
(all are mutually exclusive, the higher the number, the more difficult)

  1. You can have one of the two IPs face the internet (default) and the other one internal only. (static routes)
  2. You need to add a 3rd external Internet router (E.G. A Cisco ISR 111x with dual WAN ports) that will bond the 2 external routers you already have and will save state for the external connections and set that router as the default gateway for both (on different IP addresses)
  3. You can bond both NICs together and let the bond save state: you have no control over what goes where: the bond does that for you like the third router would do in hardware.
  4. You can split up the internet in 2 and define half of all Internet address ranges on #5 (Let's say all of the USA; static routes) and all of the rest of the world on #6 (default).
Related Question