Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static IP #2

Closed
Jacobh06 opened this issue Aug 5, 2023 · 10 comments
Closed

Static IP #2

Jacobh06 opened this issue Aug 5, 2023 · 10 comments
Labels
question Further information is requested

Comments

@Jacobh06
Copy link

Jacobh06 commented Aug 5, 2023

Everyone,

Can a static IP be configured for the docker-compose image? When I deploy the image, it creates a new network and comes up on a completely (non-existent) network. I've been playing with the docker-compose syntax, but haven't been successful in figuring it out. Hoping you can help add this information as optional.

Thanks,
Jake

@JeDaYoshi
Copy link
Owner

Hey there!

Could you share the docker-compose.yml file you're trying to deploy this with?
Shouldn't be an issue, since it depends mainly on Docker - not doing anything weird that would not make it work.

@JeDaYoshi JeDaYoshi added the question Further information is requested label Aug 5, 2023
@Jacobh06
Copy link
Author

Jacobh06 commented Aug 5, 2023

I really didn't do anything complicated with the configuration you provided. Maybe I'm just not understanding what I need to do to access the container for configuration.

services:
nextdns:
container_name: nextdns
image: jedayoshi/nextdns:latest
restart: always
ports:
- 53:53/tcp
- 53:53/udp
environment:
NEXTDNS_PROFILE: xxxxxx
NEXTDNS_CACHE_SIZE: 10m
NEXTDNS_REPORT_CLIENT_INFO: true
NEXTDNS_USE_HOSTS: true
volumes:
- /docker/nextdns/hosts:/etc/hosts:ro

@JeDaYoshi
Copy link
Owner

I don't see that you're defining a static IP in there.

Here's an example that should work fine:

version: "3"

services:
  nextdns:
    container_name: nextdns
    image: jedayoshi/nextdns:latest
    restart: always
    networks:
      nextdns:
        ipv4_address: 10.53.53.2
    ports:
      - 53:53/tcp
      - 53:53/udp
    environment:
      NEXTDNS_PROFILE: xxxxxx
      NEXTDNS_CACHE_SIZE: 10m
      NEXTDNS_REPORT_CLIENT_INFO: true
      NEXTDNS_USE_HOSTS: true
    volumes:
      - /docker/nextdns/hosts:/etc/hosts:ro

networks:
  nextdns:
    name: nextdns
    ipam:
      config:
        - subnet: 10.53.53.0/30

The IP would be 10.53.53.2. 10.53.53.1 is used by Docker for the interface.

@JeDaYoshi
Copy link
Owner

Keep in mind that ports is forwarding the :53 ports to the container, so if you want to do queries in your network, you'd be pointing them to the IP of the machine running the container. Locally it'd be 127.0.0.1.

@Jacobh06
Copy link
Author

Jacobh06 commented Aug 5, 2023

Appreciate the quick responses here!

I assume I want to configure this on my local network subnet, correct? Aka, I want the container to respond on my local subnet so I can forward DNS queries through it instead of my router.

Or, am I just forwarding DNS queries to the Docker Server IP address and those port 53 queries are then going to the container and the container IP isn't needed? Maybe this is what I was missing.

@JeDaYoshi
Copy link
Owner

No, using your local network's subnet will not work and would cause conflicts since it's creating another interface for this and they'd not be bridged together.

A simpler solution would be to just depend on ports since it already does what you want to do. You'd use your server's IP address on the devices you want NextDNS on, since all requests will be forwarded to the container. No need to do anything further.

@Jacobh06
Copy link
Author

Jacobh06 commented Aug 5, 2023

Ok, so I went back to my original docker-compose configuration. This should then allow me to point my local clients to the docker server IP for DNS queries. These local clients then should register within my NextDNS cloud portal? Is there any other configuration that I need to do?

I tried to console into the container and run the command "nextdns log", but that system not supported. Something I'm missing?

@JeDaYoshi
Copy link
Owner

No need to register them in the NextDNS portal. All you need to do is set NEXTDNS_PROFILE with your profile ID and you should be good to go; just point the DNS servers in your devices to the IP of the server running the Docker container.

Try using docker-compose logs -f for logs.

@Jacobh06
Copy link
Author

Jacobh06 commented Aug 5, 2023

It's the small things in life... haha. Thanks for all the help. I think I finally got this working as expected.

@JeDaYoshi
Copy link
Owner

No problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants