networking – How to change configuration of existing docker network

networking – How to change configuration of existing docker network

The simplest approach to this would be to delete the VPN network and create it anew with new parameters but the same name. If you use docker-compose up to recreate containers, include the networks section in the first container that you recreate.

First, run this to delete the existing network:

docker network rm VPN

Then add the macvlan network definition to yml of your first re-created container. Here is the networks section I used, adapted somewhat to your situation:

networks:
  VPN:
    driver: macvlan
    enable_ipv6: true                   # if needed
    driver_opts:
      parent: eth0
    ipam:
      config:
        - subnet: 192.168.0.0/24
          gateway: 192.168.0.1
          ip_range: 192.168.0.8/30      # reserve some IP addresses for other machines
                                        # in that subnet - adjust as needed
        - subnet: xx:xx:xx:xx::/63      # put your IPv6 subnet here if needed
          gateway: xx:xx:xx:xx:xx::xx   # IPv6 (external) of your router
          

Alternatively, you could change your new router config to match the old one, and leave your macvlan VPN as is.

networking – How to change configuration of existing docker network

Leave a Reply

Your email address will not be published.