Broken SSH Connections

Hello All,

I have a weird situation happening when routing SSH traffic through VYOS. So i have 2 networks behind VYOS. 192.168.50.0/24 & 192.168.51.0/24. When attempting to connect to any device via SSH while traversing VYOS SSH sessions can not be established via putty. When i login to vyos and ssh via the CLI it works with no problems. No here is the kicker. If I try the same ssh traffic that doesn’t work when I’m connected outside of VYOS but use the telnet command to connect via port 22 I’m successfully able to connect.

Does anyone have any idea what could be causing this issue? Also, when running a tcpdump i can see the traffic reach the devices that sit behind vyos however a RST flag is sent.

Thanks for all responses.

Check your NAT (port forwards)

Check your firewall

I’m guessing NAT is ok as the traffic is making it to the destination host. Also, it works when i send a simple telnet command to the open port 22. I’m leaning more towards a firewall issue myself. Here is the running configuration for the firewall: It was my understanding that this firewall policy would allow ALL traffic.

Thanks for all responses

[color=#ff6699]firewall {
[/color]
[color=#ff6699] state-policy {[/color]
[color=#ff6699] established {[/color]
[color=#ff6699] action accept[/color]
[color=#ff6699] }[/color]
[color=#ff6699] invalid {[/color]
[color=#ff6699] action accept[/color]
[color=#ff6699] }[/color]
[color=#ff6699] related {[/color]
[color=#ff6699] action accept[/color]
[color=#ff6699] }[/color]
[color=#ff6699] }[/color]
[color=#ff6699]}
[/color]

Are you sure your traffic is making it through the NAT? Are you positive it isn’t landing on the VyOS itself? Have you applied that firewall to any interfaces? Can you post a complete config (with personal info, like public IP, redacted)

I’m positive it is making it through NAT as I am able to see the RST FLAG on the target machine when running a packet capture on the destination host.

The running config is posted below. This is all lab so the IP’s are harmless.

The question I have though is it possible that VYOS is intercepting the SSH port 22 traffic since it is also listening on port 22? I haven’t tested that theory but I guess I can once I am in front of my lab.

Again thank for any and all responses.


[color=#ff3333] show config[/color]

[color=#ff3333]interfaces {[/color]
[color=#ff3333] ethernet eth3 {[/color]
[color=#ff3333] address 10.1.1.250/32[/color]
[color=#ff3333] address 10.1.1.250/24[/color]
[color=#ff3333] description OUTSIDE[/color]
[color=#ff3333] duplex auto[/color]
[color=#ff3333] hw-id 00:0c:29:dc:59:ad[/color]
[color=#ff3333] smp_affinity auto[/color]
[color=#ff3333] speed auto[/color]
[color=#ff3333] }[/color]
[color=#ff3333] ethernet eth4 {[/color]
[color=#ff3333] address 192.168.50.1/24[/color]
[color=#ff3333] description PFsense[/color]
[color=#ff3333] duplex auto[/color]
[color=#ff3333] hw-id 00:0c:29:dc:59:b7[/color]
[color=#ff3333] smp_affinity auto[/color]
[color=#ff3333] speed auto[/color]
[color=#ff3333] }[/color]
[color=#ff3333] ethernet eth5 {[/color]
[color=#ff3333] address 192.168.51.1/24[/color]
[color=#ff3333] description CheckPointR80.10[/color]
[color=#ff3333] duplex auto[/color]
[color=#ff3333] hw-id 00:0c:29:dc:59:c1[/color]
[color=#ff3333] smp_affinity auto[/color]
[color=#ff3333] speed auto[/color]
[color=#ff3333] }[/color]
[color=#ff3333] loopback lo {[/color]
[color=#ff3333] }[/color]
[color=#ff3333]}[/color]
[color=#ff3333]nat {[/color]
[color=#ff3333] destination {[/color]
[color=#ff3333] }[/color]
[color=#ff3333] source {[/color]
[color=#ff3333] }[/color]
[color=#ff3333]}[/color]
[color=#ff3333]service {[/color]
[color=#ff3333] dns {[/color]
[color=#ff3333] forwarding {[/color]
[color=#ff3333] cache-size 150[/color]
[color=#ff3333] listen-on eth3[/color]
[color=#ff3333] name-server 10.1.1.15[/color]
[color=#ff3333] }[/color]
[color=#ff3333] }[/color]
[color=#ff3333] ssh {[/color]
[color=#ff3333] port 22[/color]
[color=#ff3333] }[/color]
[color=#ff3333]}[/color]
[color=#ff3333]system {[/color]
[color=#ff3333] config-management {[/color]
[color=#ff3333] commit-revisions 20[/color]
[color=#ff3333] }[/color]
[color=#ff3333] console {[/color]
[color=#ff3333] }[/color]
[color=#ff3333] domain-name TestLabRouter.Local[/color]
[color=#ff3333] gateway-address 10.1.1.1[/color]
[color=#ff3333] host-name PacketRouter[/color]
[color=#ff3333] login {[/color]
[color=#ff3333] user vyos {[/color]
[color=#ff3333] authentication {[/color]
[color=#ff3333] encrypted-password ****************[/color]
[color=#ff3333] plaintext-password ****************[/color]
[color=#ff3333] }[/color]
[color=#ff3333]}[/color]
[color=#ff3333] level admin[/color]
[color=#ff3333] }[/color]
[color=#ff3333] }[/color]
[color=#ff3333] name-server 10.1.1.15[/color]
[color=#ff3333] ntp {[/color]
[color=#ff3333] server 0.pool.ntp.org {[/color]
[color=#ff3333] }[/color]
[color=#ff3333] server 1.pool.ntp.org {[/color]
[color=#ff3333] }[/color]
[color=#ff3333] server 2.pool.ntp.org {[/color]
[color=#ff3333] }[/color]
[color=#ff3333] }[/color]
[color=#ff3333] package {[/color]
[color=#ff3333] auto-sync 1[/color]
[color=#ff3333] repository community {[/color]
[color=#ff3333] components main[/color]
[color=#ff3333] distribution helium[/color]
[color=#ff3333] password ****************[/color]
[color=#ff3333] url http://packages.vyos.net/vyos[/color]
[color=#ff3333] username “”[/color]
[color=#ff3333] }[/color]
[color=#ff3333] }[/color]
[color=#ff3333] syslog {[/color]
[color=#ff3333] global {[/color]
[color=#ff3333] facility all {[/color]
[color=#ff3333] level notice[/color]
[color=#ff3333] }[/color]
[color=#ff3333] facility protocols {[/color]
[color=#ff3333] level debug[/color]
[color=#ff3333] }[/color]
[color=#ff3333] }[/color]
[color=#ff3333] }[/color]
[color=#ff3333] time-zone UTC[/color]
[color=#ff3333]} [/color]

It is possible VyOS is grabbing that traffic, because you did not specify a ‘listen address’ for it.

what is the command to specify a listen address. I thought that is what I have setup with the following syntax - [size=small][color=#ff3333][font=monospace, Courier]set service ssh port ‘22’[/font][/color][/size]

[color=#ff3333][size=small][font=monospace, Courier]Again,[/font][/size][/color]

[size=small][color=#ff3333][font=monospace, Courier]Thanks for all responses.[/font][/color][/size]

vyos@sh-bdr-vyfw# set serv ssh
Possible completions:

  • listen-address
    Local addresses SSH service should listen on

So I tried the command [color=#ff3333]set serv ssh listen-address[/color] and still had the same issue. So i changed the ssh port to something weird and was still unable to connect.

I’m sure it has to be a setting and/or command that can be run to stop the VYOS software from intercepting and responding to all SSH sessions traversing it.

Its almost like VYOS is performing a man in the middle attack. This only occurs during the exchanging of the certificate. If I telnet to the destination using port 22 instead of 23 it connects with no problem.

so the vyos router has an IP address of 10.1.1.250 and i’m testing from pc’s on the same network. However when i test from my wireless network of 172.16.1.1/24 it connects all the way through with no problem. at this point i’m confused.

Im open to trying anything as I have stated before this is a lab environment for learning purposes.

Thanks for all responses.


Quick Update - port 80 or 443 traffic along with SSH traffic does not work when traversing VYOS from outside.

Is your ETH3 address setting correct? You have a /32 and a /24 listed.

Just an FYI, VyOS does not intercept traffic or do any MITM stuff with SSH. I think you have a misconfiguration in your basic networking layout.

I removed the /32 address. I was testing a theory.

My other thought is that VYOS is attempting to hide NAT the traffic coming from the other 2 interfaces behind the eth3 address.That is the only thing I can thing of at this point.

Based on your config you have NO NAT at all, and no firewall rules applied to any interfaces, so VyOS isn’t really doing anything with your traffic. VyOS isn’t nefariously doing anything, because you haven’t told it to do anything with your traffic. :wink:

Fix your NAT

Technically, I’m only using VYOS strictly for routing. All traffic coming from behind the VYOS should not be NAT’d at all so that should be ok. My packet captures show it making it to the devices behind VYOS. Would the black-hole possibly be the culprit that is sending the RST flag? as it is protecting private networks from entering what it considers to be the outside interface?


Update - Let me explain my setup.
10.1.1.1/24 = default GW - Internet
10.1.1.10 - Windows Server Running VmWare - Physically connected to network 10.1.1.1/24
10.1.1.11 - Assigned static IP to VYOS VMware image
192.168.1.1/24 Internal Interface assigned to VYOS
192.168.2.1/24 DMZ Interface assigned to VYOS

So I have a static route in my internal real 10.1.1.1/24 network that reads 192.168.2.1/24 gw 10.1.1.11

That way my 10.1.1.1 knows how to route traffic to the DMZ.

I can see the traffic reach reach the DMZ from my server at 10.1.1.10 however I see RST flags being sent when I attempt to connect.

I’m guessing VYOS is treating the traffic from my 10.1.1.1/24 as living on the VYOS interface since the configuration is set to 10.1.1.11/24 and causing a routing loop. I’m just guessing here.

I’ve created the following firewall rules on all interfaces -
[color=#ff3333]set firewall name Allow-All default-action ‘accept’[/color]

I’ve re-designed my network and started configuring VYOS from scratch just in case I did something crazy.

I am working on a diagram as we speak.

I know this is a pretty old topic but I’m curious to know if you ever figured it out. I’m seeing the same behavior on version1.3 and am struggling to make sense of it. Thanks.

hey there, might be better starting a fresh thread, and posting your config.

I actually just figured this one in my 1.3 installation…I had a bad MTU setting on one of my sub-interfaces.

1 Like