Score:0

unable to ssh into guest OS (openBSD) from host (fedora) via port forwarding on kvm

id flag

The guest OS is running on ip address 192.168.122.217. I am able to ssh into the machine via this ip address

[kabira@linux ~]$ ssh  [email protected] 
[email protected]'s password:

But when I forward port 4567 to 192.168.122.217:22 I am not able to connect, no matter what firewall rule I apply. I have done the following:

  • turned off firewall on openBSD
  • added following rules in firewalld --- forward 4567 to 192.168.122.217 (both tcp and udp) --- allowed all ports from 192.168.122.217 and 192.168.0.183"

as show below with list-all command:

FedoraServer (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources: 
  services: cockpit dhcpv6-client mdns ssh
  ports: 5901/tcp
  protocols: 
  forward: yes
  masquerade: no
  forward-ports: 
        port=4567:proto=tcp:toport=22:toaddr=192.168.122.217
        port=4567:proto=udp:toport=22:toaddr=192.168.122.217
  source-ports: 
  icmp-blocks: 
  rich rules: 
        rule family="ipv4" source address="192.168.0.183" port port="4567" protocol="tcp" accept
        rule family="ipv4" source address="192.168.0.183" accept
        rule family="ipv4" source address="192.168.122.217" accept
        rule family="ipv4" source address="192.168.0.183" port port="4567" protocol="udp" accept
        rule family="ipv4" source address="192.168.0.107" port port="5432" protocol="tcp" accept
        rule family="ipv4" source address="192.168.0.1/24" port port="4567" protocol="tcp" accept

all I am getting is immediate connection refused when trying to connect to 192.168.0.183 on port 4567.

I also added iptables rules, however that didn't work either.

Score:0
id flag

its not the best idea to use NAT if one is running services on the guest OS. Best to use bridged network. But its much harder to configure. Using bridge network, the IP of the guest os is available on the lan. I found this https://linuxconfig.org/how-to-use-bridged-networking-with-libvirt-and-kvm to be most comprehensive step by step guide for this.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.