The windows (win7/x64) host uses IP 192.168.56.1
on its "VirtualBox Host-Only Network adapter".
The linux (Debian 8) Virtualbox guest is configured as 'host-only networking'. It uses static IP address 192.168.56.100
.
Host and guest can ping each other, and UDP packets sent from the guest with:
$ echo "hello"|netcat -u 192.168.56.1 10067
are detected by Wireshark, listening on the host' VirtualBox interface.
However they do not seem to make it through the network stack,
and my simple UDP listener program does not receive the packets:
package test;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
public class Test {
public static void main(String[] args) throws IOException {
DatagramSocket socket = new DatagramSocket(10067, InetAddress.getByAddress(new byte[]{(byte) 192,(byte) 168,56,1}));
DatagramPacket pkt = new DatagramPacket(new byte[1500], 1500);
System.out.println("waiting...");
socket.receive(pkt);
System.out.println("received "+pkt.getLength());
}
}
What I have tried so far:
- make sure the linux iptables are not active
- disable the windows firewall
- enable the firewall but add an incoming traffic rule that allows UDP with local port 10067 (domain & private & public, any IP & computer & user & program)
- bind the socket to "*" rather than "192.168.56.1" (
socket=new DatagramSocket(10067)
) - if the packet is sent from windows with
ncat -u 192.168.56.1 10067
, the program receives it correctly - the same test succeed if the packet is sent to another linux guest on the same 'host-only' network
Any suggestions?