1

I have two vms(Oracle VirtualBox) with Ubuntu 22.04 lts. Bridged network is configured between these vms.

On the first vm i run Cassandra docker container. My goal is to make it accessible from the second vm with cqlsh using static ip of that container.

Making cqlsh connection work using first vm's IP and container's port(9042) was fairly simple, using "bridge" driver network in docker. However, to make container's static IP visible from the second vm i apparently need to use "macvlan" type network by setting its parent to the bridge network that both vms are connected to(in my case it's called enp0s8). Relying on docker docs

docker network create -d macvlan --gateway 192.168.1.198 --subnet 192.168.1.197/28 -o parent=enp0s8 CASnetwork

But this approach makes it so that i can't even ping my container from its host vm. However i can see that container is using its assigned IP

docker exec -it cassandra1 nodetool status

Datacenter: datacenter1

=======================

Status=Up/Down

|/ State=Normal/Leaving/Joining/Moving

--  Address        Load        Tokens  Owns (effective)  Host ID                               Rack 

UN  192.168.1.200  297.98 KiB  256     100.0%            4254dee6-fe6e-49ce-afa6-6cb6561b2bf3  rack1


And it's not listening on any ports now.

~/Cassandra$ sudo lsof -nPi | grep 90

systemd-r  445 systemd-resolve   13u  IPv4  19069      0t0  UDP 127.0.0.53:53 

systemd-r  445 systemd-resolve   14u  IPv4  19070      0t0  TCP 127.0.0.53:53 (LISTEN)

Here is my docker-compose.yml

version: '3.8'

services:
  cassandra1:
    image: cassandra:latest
    container_name: cassandra1
    ports:
      - 9042:9042
      - 7000:7000
    environment:
      - CASSANDRA_SEEDS=cassandra1
      - CASSANDRA_CLUSTER_NAME='cassandra-cluster'
      - CASSANDRA_NUM_TOKENS=256
      - CASSANDRA_RPC_ADDRESS=0.0.0.0
      - CASSANDRA_LISTEN_ADRESS=192.168.1.200
      - CASSANDRA_START_PRC=true
      - CASSANDRA_BROADCAST_ADDRESS=192.168.1.200
    networks:
      CASnetwork:
        ipv4_address: 192.168.1.200
    volumes:
      - cassandra-data:/var/lib/cassandra

volumes:
  cassandra-data:
    driver: local

networks:
  CASnetwork:
      name: CASnetwork
      external: true

Can someone point me where possibly the problem lies

Alan Synix
  • 11
  • 2

0 Answers0