Hyper-v VM No Internet Connection with Default Switch - windows

Posting because I lost 4 hours on this problem and Googling didn't help - solution below.
I have Hyper-V running on Windows 11 with a Windows 11 VM. The VM has no internet connection.
It seems like the DHCP server isn't issuing an IP address to my VM.
Every configuration setting looks right.
The Hyper-V configuration is standard! I'm using the Default Switch hosting NAT. It's always worked before. It was working minutes earlier when the host laptop was connected to a different Wi-Fi network.

It took 4 hours but the clue was "It was working minutes earlier when the host laptop was connected to a different Wi-Fi network."
There was something different in the network I'd joined.
The new network has:
A router with gateway 192.168.1.1
Google Home Wi-Fi (3 devices creating a Wi-Fi Mesh so that I have a strong signal throughout the house) with gateway 192.168.86.1
ipconfig on the VM reported:
Ethernet adapter Ethernet 3:
Connection-specific DNS Suffix . : mshome.net
Link-local IPv6 Address . . . . . : fe80::18da:ec53:3953:c870%6
IPv4 Address. . . . . . . . . . . : 192.168.86.27
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . : 192.168.80.1
Changing Google Home Wi-Fi to use Router LAN address 192.168.2.1 and a matching DHCP address pool fixed it.
It took a couple of minutes for the Wi-Fi mesh to be re-established but when it had finished, the VM immediately connected with a fast connection. Here's the Google Nest help article that helped me: https://support.google.com/googlenest/answer/7571856
Avoid the temptation to change to a bridged external network switch! Avoid the temptation to change any of the VM's networking config.

Related

How to go from geth in WSL to vEthernet adaptor to Router

On my windows 10 pro laptop I am running geth in WSL. The problem is I can not seem to get reach my wireless router. I am getting a status of not connected to my router. So the web3J calls returns a can not connect. I setup my geth:
geth --http.port "8545" --http.addr "192.168.1.15" --datadir test-chain-dir --http --dev
I setup eth0 to match my address in my ipv4 settings config in my vethernet adaptor
ifconfig eth0 192.168.1.15 and the mask ifconfig eth0 netmask 255.255.255.0
I also add a route ip route add default via 192.168.1.15
So what am I doing wrong? I also tried adding on the windows side the command to setup portproxy.
Is there some definitive instructions somewhere about setting up geth to work within WSL and able to reach out to the router? I wrote some simple code using web3j running on a android phone that is connected on my local network.
Thanks!

windows run docker with --network=host and access with 127.0.0.1

I have windows 10 pro and I'm trying to run a docker with network mode host.
my issue is that I can't run a docker and access it using the host ip not 127.0.0.1 and not the ip (in linux it works differently).
looks like the hyper v has it's own network that not accessible using the host ip
docker run -d --network=host nginx
output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8edd86bf292b nginx "nginx -g 'daemon of…" 3 seconds ago Up 2 seconds happy_curie
so there is no ports as expected but and no errors.
When I'm trying to open the browser using 127.0.0.1 I'm getting ERR_CONNECTION_REFUSED
if I set ports to instead of network mode host it is working
docker run -d -p 80:80 nginx
Hyper v Ethernet adapter vEthernet (DockerNAT):
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 10.0.75.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . .
Remarks:
changing in the hyper v virtual switch manager the network to be external - not helping
firewall is disabled
any idea how to work with network mode host in windows?
Unfortunately host networking is not available for Docker for Windows and neither is macvlan networking. If you are not stuck on Hyper-V, consider using Docker Toolbox on Windows.
Quoted from: https://docs.docker.com/network/network-tutorial-host/#prerequisites
The host networking driver only works on Linux hosts, and is not supported on Docker for Mac, Docker for Windows, or Docker EE for Windows Server.
Also see the following related issues on GitHub:
https://github.com/docker/for-win/issues/1644
https://github.com/docker/for-win/issues/937
https://github.com/docker/for-win/issues/543
https://github.com/docker/for-mac/issues/2716

Mac OS X 10.10.1 AMP stack offline use

before the update to Yosemite (on Mavericks) i was able to access my locally hosted sites via apache even when the wifi was completely turned off. i set up my AMP stack according to this tutorial: http://wizardmode.com/2012/06/apache-php-mysql-dev-on-os-x-lion-with-a-minimum-of-pain/
FROM THE TUTORIAL
One more thing. OS X will refuse to do DNS lookups if you’re not connected to a network (under some circumstances). There’s a simple way around that, in two steps:
First, install VirtualBox. Create a new virtual machine, and give it a Host-only network adapter. (You can use the FreeDos image, if you don’t actually need a virtual machine for anything. It’s small.) Start the virtual machine at least once.
You can do this from the commandline with this snippet (after VirtualBox is installed):
(ifconfig | grep -s vboxnet) || VBoxManage hostonlyif create ipconfig vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0
This prevents OS X from disabling normal DNS resolution when you’re not connected to a network.
Second, create a ‘dev’ domain resolver entry:
sudo mkdir -p /etc/resolver
sudo tee /etc/resolver/dev <<EOT
nameserver 127.0.0.1
domain dev
search_order 1
EOT
This tells OS X that it can always ask localhost (your dnsmasq server) for domain resolution for .dev domains when it doesn’t have other DNS servers.
Now if you type ifconfig in a terminal, one of the lines should start with vboxnet0: – if it does, great! OS X will happily do DNS lookups even if you’re on an airplane, so you can keep using your .dev domains wherever you are.
END TUTORIAL SECTION
after the update i went through hell to get all my local sites running and now they only work if i have an internet connection
I am running dnsmasq according to the tutorial and I did the whole VirtualBox trick. here is the relevant output of ifconfig:
vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:00
inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255
vboxnet1: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 0a:00:27:00:00:01
I'm not really sure what's going wrong. Here is a screenshot of my wifi network settings:
you can see the opendns servers and then localhost for dns resolution purposes.
furthermore, here is scutil --dns output:
DNS configuration
resolver #1
nameserver[0] : 208.67.222.222
nameserver[1] : 208.67.220.220
nameserver[2] : 127.0.0.1
flags : Request A records, Request AAAA records
reach : Reachable
resolver #2
domain : dev
nameserver[0] : 127.0.0.1
flags : Request A records, Request AAAA records
reach : Reachable,Local Address
order : 1
DNS configuration (for scoped queries)
resolver #1
nameserver[0] : 208.67.222.222
nameserver[1] : 208.67.220.220
nameserver[2] : 127.0.0.1
if_index : 4 (en0)
flags : Scoped, Request A records, Request AAAA records
reach : Reachable
I'm really at a loss here for what's happening and going wrong. I've tried debugging some of the shell scripts from the tutorial to see if they are causing problems but I can't figure it out. This should be simple as pie IMO. Why is this such a nightmare?
Any help would be greatly, greatly appreciated as I'm wasting valuable time that could be used for building useful things on this mess. THANK YOU!!!!
As of 10.10 and discoveryd no DNS resolution can take place when you are disconnected from all networks.
you can confirm this by running scutil --dns once when connected, and again when disconnected.
Here is a video that shows the difference in behavior between 10.9 and 10.10 https://www.youtube.com/watch?v=3m9OI_AjCx8
I've tried to escalate this with Apple, the response was that it's expected behavior.
The only workaround I know of is to re-add mDNSResponder as per http://arstechnica.com/apple/2015/01/why-dns-in-os-x-10-10-is-broken-and-what-you-can-do-to-fix-it/

Ruby - How to send a text string from a TCP Server to a client on a different computer with Ruby?

I've been trying to learn this for days and nothing is working. When I write code like this
for the client.
require 'socket'
tcp_client=TCPSocket.new('localhost',2000)
while grab_string=tcp_client.gets
puts(grab_string)
end
tcp_client.close
and code like this for the server.
# Set up a server program.
require 'socket'
tcp_server=TCPServer.new(2000)
loop{
waiting_client=tcp_server.accept
path='C:\Users\Nil_Face\Music\Bad Religion - Anxiety.mp3'
test=File.new(path,'rb')
waiting_client.puts(File.basename(path))
test.close
waiting_client.close
}
It works just fine but when I use that server on my desktop and try to get that text string to appear on the client located on a different computer. It doesn't work. Why won't the client connect to the server when their both on different computers? And how can I get them to?
Your client is connecting to 'localhost', which is the same computer where the client runs.
tcp_client=TCPSocket.new('localhost',2000)
The client should be connecting to the hostname/ip of the machine on which the server is running. Change 'localhost' with the IPv4 address / inet addr of the server machine, in this case '192.168.1.10'.
On windows:
ipconfig
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : local.domain
IPv4 Address. . . . . . . . . . . : 192.168.1.10
On Linux:
# /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr FF:FF:FF:FF:FF:FF
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
If you're getting connection timed out. You can try connecting with telnet from the command prompt:
telnet 192.168.1.10 2000
From the server computer, you can also verify that the server is running and is accepting connections with netstat:
netstat -an
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:2000 0.0.0.0:0 LISTENING
If those are all correct, you probably have a firewall that is blocking the connection.

How to use Putty to connect to a virtual machine?

I am running a virtual machine on Virtual Box
On running ifconfig eth1, I get
inet addr: 192.168.56.11 and many more values.
How do I use Putty (ssh) here?
I entered 192.168.56.11 on the Host Name and 80 on the Port Number, but Putty can't connect.
I am trying to follow the guidelines from this course:
https://s3-us-west-2.amazonaws.com/cs144-misc/instructions/vm.html
What exactly does Putty do? I don't understand why I need to do this.
PuTTY will open a "network" between both machines. You'll get a console (like the shell) when you'll be connected. Really useful to administrate remote server from your computer.
Usually, the port is not 80, but 22.
For oracle vm virtual box:
1)Power of your machine
2)goto Settings -> Network -> Adapter1 -> Enable Network Adapter -> select "Bridge Adapter" in Attache To tab and click 'ok" button
3) open terminal in virtual box and type" ifconfig"
in first paragraph
eth0 Link encap:Ethernet HWaddr 08:00:27:fb:d1:28
inet addr:172.16.2.199
4) Here ip address is "172.16.2.199" using this ip and port 22 ,you can login through putty and winscp also
Try opening terminal through VMWare's console on Ubuntu and then run below given code:
sudo apt-get install openssh-server
I had faced the same issue.
Note: I assume you have already started the VM, importing the ISO image, and tried to access the machine with 10.X.X.X or 172.X.X.X range IP address from the Putty agent and got an time-out message.
Before making any changes to the network configuration on the VM or trying bridge-adapters, as suggested by many of the articles online, I suggest you to check 2 robust points which forms the bus for your VM on VirtualBox and Putty agent installed on your system.
1st Point:
Opening Host Network Manager in File section of your Oracle VirtualBox
Adding a host-only ethernet network (I suggest to keep a 192.X.X.X range)
2nd Point: Adding a host-only adapter, under the network settings of your VM.
Host-Only Adapter settings
If you follow these steps before booting up the VM for the first time, your VM will be allocated with a 192 range IP address (by the dhcp) the moment it boots up and starts running. Now all you need to do is, install and openssh-server and use the 192-range IP address with the Putty agent and Voila!!
Hope this help! Greetings!

Resources