0

I have two Ubuntu Virtual Machines behind an Azure Load Balancer. I'm observing some inconsistencies with the source IP addresses set in outgoing UDP packets from the VM's. I'm trying to come up with a simple ncat command or script that I can run on the VM's to test the source IP's.

My idea is to create a circular path (note the Load Balancer is transparent as far as the scripts and test go):

client -> LB -> VM1 -> VM2 -> LB -> client

What I can't workout is how to pass the command through VM1 to VM2 to get it to execute a connection back to the client.

I'm thinking it needs to be the same command on VM1 and VM2:

ncat --sh-exec "/bin/bash" -k -u -l 1235

And the client connects to VM1 and sends it a command which gets through to VM2 and cause it to execute an ncat connection back to the client:

ncat -u 10.0.0.4 1235
echo "ncat -u $NCAT_REMOTE_ADDR $NCAT_REMOTE_PORT" | ncat -u 10.0.0.7 1235
```

The connection makes it to VM2 but not back to the client.
sipsorcery
  • 218
  • 1
  • 7

1 Answers1

0

I found a manual way to do it.

On both VM's: ncat --sh-exec "/bin/bash" -k -u -l 1235

On the client:

ncat -u 10.0.0.4 1235
echo $HOSTNAME
vm1
ncat -u 10.0.0.5 1235
echo $HOSTNAME
vm2
ncat -u <client IP> 1235
hi

I'm not listening for the incoming UDO packet back to the client. I'm running tcpdump to see what the source IP address is on the return leg to the client.

I imagine there's a more automated way to set this up.

sipsorcery
  • 218
  • 1
  • 7