Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Add/Change DNS server list via command line

    Scheduled Pinned Locked Moved DHCP and DNS
    6 Posts 2 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      trew13
      last edited by

      I am using the DNS resolver and have a VPN set up. The DNS resolver has DNS query forwarding on and so gets the DNS server from the general settings tab.
      Is there any way to change this from the command line as the VPN's DNS changes and I have to manually change this setting in the general settings tab.
      I've tried changing the /etc/resolv.conf file but I'm not sure if I need to reload something after changing this as it doesn't seem to update in the general settings tab (it does change the display on the main page however).
      Thanks for your help

      GertjanG 1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan @trew13
        last edited by

        @trew13 said in Add/Change DNS server list via command line:

        as the VPN's DNS changes

        During a VPN session your DNS changes ?

        Editing /etc/resolv.conf file - or any system file - isn't a good idea, it's the GUI that controls everything.

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        1 Reply Last reply Reply Quote 0
        • T
          trew13
          last edited by

          Thanks for the reply.
          When I get disconnected, and then reconnect, I get assigned a new IP address and I need to forward the DNS to that same address with a one at the end.
          So for instance if I get assigned the IP 10.20.30.40, the new place to forward DNS will be 10.20.30.1
          For now every time I get disconnected I need to manually check the IP address and change the settings. I was going to write a cron script to monitor and change this. Is there a better way to approach this problem?

          1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan
            last edited by

            Can't tell.
            Never saw a situation like that, neither some VPN setup that works like that.

            I use pfSense as a VPN server for remote login only. VPN handles all the DNS stuff.

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            1 Reply Last reply Reply Quote 0
            • T
              trew13
              last edited by

              Just to clarify, this is using the VPN client. The VPN I connect to requires me to change where I'm sending the DNS to get it to work properly.

              1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan
                last edited by

                THe VPN server (pfSense ?) could push the DNS to the client.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.