• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Temporarily setting DNS servers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Temporarily setting DNS servers


  • Subject: Re: Temporarily setting DNS servers
  • From: Allan Nathanson <email@hidden>
  • Date: Fri, 23 Apr 2004 14:15:19 -0400

On Apr 23, 2004, at 1:43 PM, Frederik Seiffert wrote:

Quinn wrote:
At 10:59 +0200 23/4/04, Frederik Seiffert wrote:
I want to override DNS settings during the presence of a VPN connection, i.e. setting new DNS servers (which are usually in the remote network behind the VPN) when the connection is established and setting them back to the old values when the connection is disconnected.
You probably should be doing this using the SCF dynamic store. The key you're looking for is:
State:/Network/Global/DNS

I already tried this but it didn't seem to work. I used scutil to change the key like this:

$ sudo scutil
> open
> get State:/Network/Global/DNS
> d.show
<dictionary> {
ServerAddresses : <array> {
0 : 192.168.1.1
}
SearchDomains : <array> {
0 : localdomain.lan
}
}
> d.add SearchDomains * localdomain.lan anotherlocaldomain.lan
> set State:/Network/Global/DNS
> quit

However, after this, /etc/resolv.conf was still the same (unlike when changing the Setup:/Network/Service/<current set>/DNS key) and resolving a server from anotherlocalnetwork.lan didn't work. I also tried sending a HUP to configd and lookupd, but no luck.

Anything else I need to do in order to get a changed setting active?

Thanks,
Frederik

The dictionary associated with the State:/Network/Global/DNS dynamic store key contains what the DNS configuration HAS BEEN SET TO and is not the way to change the configuration. What you really want to do is have your VPN code create a set of State:/Network/Service/<service-id>/{IPv4,DNS,...} keys which reflect the configuration associated with the VPN link. If there are matching "Setup:..." keys then you can have the order the VPN service to the top of the list and the default route, DNS settings, and proxy configuration will follow your link when it's active. If your VPN service is not first in the service order then you can add an OverridePrimary key to the State:/Network/Service/<service-id>/IPv4 dictionary which will promote your service to the top of the list.

- Allan

p.s. configd, and all of the configuration plugins, ignore SIGHUP
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Temporarily setting DNS servers
      • From: Frederik Seiffert <email@hidden>
References: 
 >Temporarily setting DNS servers (From: Frederik Seiffert <email@hidden>)
 >Re: Temporarily setting DNS servers (From: Malte Tancred <email@hidden>)
 >Re: Temporarily setting DNS servers (From: Frederik Seiffert <email@hidden>)
 >Re: Temporarily setting DNS servers (From: Quinn <email@hidden>)

  • Prev by Date: Re: Temporarily setting DNS servers
  • Next by Date: Re: Problem within a MoreSecurity helper tool
  • Previous by thread: Re: Temporarily setting DNS servers
  • Next by thread: Re: Temporarily setting DNS servers
  • Index(es):
    • Date
    • Thread