Help with port forwarding to Hyper-V VM
Posted: August 11th, 2020, 9:06 pm
I wonder if anyone can help me with a port forwarding issue?
I've had an old Raspberry Pi on my network for a long time. I set my Virgin cable broadband router (Hub 3.0) to forward port 22 to port 22 on the Pi (192.168.0.253). I have a Dynamic DNS hostname pointed to my external IP address, and from both outside and inside my network I can 'ssh user@hostname.ddns.net' and it works fine.
I'm now playing about with Hyper-V on my Windows 10 Pro system. I've created a VM running Ubuntu 20.04.1 LTS. I've added an external network switch to it, given it a static MAC address and told my Virgin router to always give it IP address 192.168.0.239. I've enabled ssh. So, for example, from the Pi I can 'ssh user@192.168.0.239' and this works fine.
However if I change the port forwarding rule on the router to forward port 22 to the Hyper-V VM's address (192.168.0.239), then if I try 'ssh user@hostname.ddns.net' it always just times out.
For testing purposes I've disabled the firewall on the VM 'ufw disable'.
Anyone got any clues what I might be doing wrong?
The main difference that I see between the two scenarios (Pi vs Hyper-V VM) is that the VM has two network interfaces, internal and external:
ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.166.233 netmask 255.255.240.0 broadcast 172.17.175.255
inet6 fe80::8c71:36b7:64b8:500 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:38:01:00 txqueuelen 1000 (Ethernet)
RX packets 665 bytes 89716 (89.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 507 bytes 52926 (52.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.239 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::d06e:e2df:73f6:d51a prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:38:01:04 txqueuelen 1000 (Ethernet)
RX packets 3739 bytes 449064 (449.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 496 bytes 67607 (67.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
TIA
Scott.
I've had an old Raspberry Pi on my network for a long time. I set my Virgin cable broadband router (Hub 3.0) to forward port 22 to port 22 on the Pi (192.168.0.253). I have a Dynamic DNS hostname pointed to my external IP address, and from both outside and inside my network I can 'ssh user@hostname.ddns.net' and it works fine.
I'm now playing about with Hyper-V on my Windows 10 Pro system. I've created a VM running Ubuntu 20.04.1 LTS. I've added an external network switch to it, given it a static MAC address and told my Virgin router to always give it IP address 192.168.0.239. I've enabled ssh. So, for example, from the Pi I can 'ssh user@192.168.0.239' and this works fine.
However if I change the port forwarding rule on the router to forward port 22 to the Hyper-V VM's address (192.168.0.239), then if I try 'ssh user@hostname.ddns.net' it always just times out.
For testing purposes I've disabled the firewall on the VM 'ufw disable'.
Anyone got any clues what I might be doing wrong?
The main difference that I see between the two scenarios (Pi vs Hyper-V VM) is that the VM has two network interfaces, internal and external:
ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.166.233 netmask 255.255.240.0 broadcast 172.17.175.255
inet6 fe80::8c71:36b7:64b8:500 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:38:01:00 txqueuelen 1000 (Ethernet)
RX packets 665 bytes 89716 (89.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 507 bytes 52926 (52.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.239 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::d06e:e2df:73f6:d51a prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:38:01:04 txqueuelen 1000 (Ethernet)
RX packets 3739 bytes 449064 (449.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 496 bytes 67607 (67.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
TIA
Scott.