I’m trying to make two machines communicate between each other.
I created a very simple application with a minimal REST api. A machine can answer with its own machine id.
Then I tried to make one machine send a request to the other machine’s api. I read about private networking, and I thought this isd possible with the id of the machine and the request <machine_id>.vm.<appname>.internal
.
So basically, I’m doing a fetch request like this from machineA:
const response = await fetch(`${machineBId}.vm.test-machines.internal/api/machineId`)
const shouldBeMachineBId = await response.text()
But the fetch
request fails with an error message “Cannot reach the given URL”.
I also tried with the private IP address of machineB, but same result.
Is there something I’m missing?
The tests have been done in a Bun environment.