Situation
I have a Windows 10 laptop computer that I sometimes use on the road and would like to be able to do Linux development locally when there is no internet connection. I have set up a CentOS Virtual Machine for this purpose, installing all the needed software. The problem is, when the laptop can't get an internet address, then the Linux Virtual Machine does not have one either so I can't SSH or otherwise connect to it.
If I try to SSH to 127.0.0.1, I am only trying to connect to the Windows 10 operating system, not the virtual machine.
Setup
I have created a CentOS Virtual Machine using Windows 10 Hyper-V Manger. I have set up a network connection for it using the Virtual Switch Manager.
Image may be NSFW.
Clik here to view.
This works great as long as the laptop computer has an internet connection. The VM has an IP address that I set in the network scripts. I can SSH and HTTP connect to this address.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:15:5d:01:07:01 brd ff:ff:ff:ff:ff:ff inet 192.168.1.140/24 brd 192.168.1.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::215:5dff:fe01:701/64 scope link noprefixroute valid_lft forever preferred_lft forever
However, if the laptop does not have network connectivity, then the VM does not have the hard-coded IP address that I set in the network script.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000 link/ether 00:15:5d:01:07:01 brd ff:ff:ff:ff:ff:ff
I have tried starting the VM using an Internal Switch. Then, the CentOS system retains the IP address specified (192.168.1.140). But the laptop computer can not ssh to it, giving an error "No Route to Host".
Is there a way to connect to this Virtual Machine via SSH, HTTP, etc when the laptop has no external internet connection?