2
votes

I have two OpenWrt (18.06.4) VM's (A and B) in VirtualBox and I'm trying to send messages in a publisher-subscriber scheme using ZeroMQ. A is the server, B is the client.

I'm using the following code:

and it works on my computer, so I decided to try it on the VMs.

I had to compile both (using the SDK) so I can execute them in the VMs. I compiled two times, changing one minor detail:

1) client listening to the IP 10.0.1.4 of the server

2) client listening to the IP 192.168.56.10 of the server

Both versions were tested in the VMs and in both, the server sends the messages (the send function executes and prints the message sent) but the client never receives any message (message is always null).

About my network configuration. In VirtualBox, I have a Nat Network (10.0.1.0/24) and a virtualbox network (192.168.56.1/24). Both VM A and B have a host-only adapter (vboxnet0) and a NAT network adapter. The machines can ping each other.

The network configuration of the machines is the following:

A

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'
    option ula_prefix 'fd03:84ea:bc33::/48'

config interface 'lan'
    option ifname 'eth0'
        option proto 'static'
    option ipaddr '192.168.56.10'
    option netmask '255.255.255.0'

config interface 'wan'
    option ifname 'eth1'
    option proto 'dhcp'

Note: The NAT network IP ('wan') is currently 10.0.1.4

B

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'
    option ula_prefix 'fdea:4700:64aa::/48'

config interface 'lan'
    option ifname 'eth0'
    option proto 'static'
    option ipaddr '192.168.56.20'
    option netmask '255.255.255.0'

config interface 'wan'
    option ifname 'eth1'
    option proto 'dhcp'

Note: The NAT network IP ('wan') is currently 10.0.1.5

Do you guys have any idea what the problem might be? Should I change the network configuration inside each VM and/or change the adapters on VirtualBox?

1

1 Answers

1
votes

Avoid the dependency on symbolic-address resolution:

// zmq_bind (publisher, "tcp://*:5563");          // PUB-side wildcard-address translated
   zmq_bind (publisher, "tcp://10.0.1.4:5563");  //           explicit address

// zmq_connect (subscriber, "tcp://localhost:5563"); // SUB-side symbolic-address
   zmq_connect (subscriber, "tcp://10.0.1.4:5563"); //           explicit-address