X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: References: Date: Sun, 27 Jun 2010 17:53:00 -0600 Message-ID: Subject: Re: DHCP and resolv.conf From: Steven Collins To: cygwin AT cygwin DOT com Content-Type: multipart/mixed; boundary=e0cb4e8875cb43338e048a0bb461 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --e0cb4e8875cb43338e048a0bb461 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I really thought I'd posted this before, but can't find it with Google. I run the attached script, which is mostly a gawk program, from my .bashrc and .profile on my laptop. This ensures that my resolv.conf gets configured correctly for the current network connection each time I start a new interactive shell. This is really more frequently than it probably needs to be, but it gets the job done for me and I've never really noticed a significant delay from it. Steven On Sun, Jun 27, 2010 at 01:49, Alex Leigh <> wrote: > > It's not possible to do it with a Windows service that updates > resolv.conf whenever a new DHCP lease is obtained, or, if that's not > possible, a cronjob that periodically polls for new nameservers > obtained from DHCP? I don't know enough about Windows to know if > there's an API for accessing the required information. > > Alex > > On Sun, Jun 27, 2010 at 3:27 AM, Huang Bambo <> wrote: > > It's not possible. > > DHCP is handled by Windows, not by cygwin. > > > > 2010/6/27 Alex Leigh <> > >> > >> Hi, > >> > >> Apologies if this has been asked before, but is it possible to have > >> /etc/resolv.conf in Cygwin to be automatically updated with > >> nameservers obtained using DHCP from Windows networking? Thanks. > >> > >> Alex > >> > >> -- > >> Problem reports: =A0 =A0 =A0 http://cygwin.com/problems.html > >> FAQ: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://cygwin.com/faq/ > >> Documentation: =A0 =A0 =A0 =A0 http://cygwin.com/docs.html > >> Unsubscribe info: =A0 =A0 =A0http://cygwin.com/ml/#unsubscribe-simple > >> > > > > -- > > Problem reports: =A0 =A0 =A0 http://cygwin.com/problems.html > > FAQ: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://cygwin.com/faq/ > > Documentation: =A0 =A0 =A0 =A0 http://cygwin.com/docs.html > > Unsubscribe info: =A0 =A0 =A0http://cygwin.com/ml/#unsubscribe-simple > > > > > > -- > Problem reports: =A0 =A0 =A0 http://cygwin.com/problems.html > FAQ: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://cygwin.com/faq/ > Documentation: =A0 =A0 =A0 =A0 http://cygwin.com/docs.html > Unsubscribe info: =A0 =A0 =A0http://cygwin.com/ml/#unsubscribe-simple > --e0cb4e8875cb43338e048a0bb461 Content-Type: application/octet-stream; name="resolv.conf.rc" Content-Disposition: attachment; filename="resolv.conf.rc" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gayjamqh0 IyEJL2Jpbi9iYXNoCmlwY29uZmlnIC9hbGwgfCBnYXdrICcKCiAgQkVHSU4g ewogICAgIyBJbml0aWFsaXplIHN0YXRlIHZhcmlhYmxlcy4KICAgIGFkZFN1 ZmZpeGVzPTA7CiAgICBzZWFyY2hMaXN0PSIiOwogICAgYWRkU2VydmVycz0w CiAgfTsKCiAgewogICAgIyBTdHJpcCB1bmRlc2lyZWQgY2FycmlhZ2UgcmV0 dXJucyBmcm9tIERPUyBzdHlsZSBjb21tYW5kIG91dHB1dC4KICAgIHN1Yigi XHgwRCIsIiIpOwogIH07CgogIC86LyB7CiAgICAjIFN0b3AgYWNjdW11bGF0 aW9ucyB3aGVuIHdlIGVuY291bnRlciBhIG5ldyBsaW5lIGhlYWRlci4KICAg ICMgTm8gbGluZXMgd2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UyBTdWZmaXggU2VhcmNoIExpc3QvIHsKICAgICMgU3Rh cnQgYWNjdW11bGF0aW5nIHNlYXJjaExpc3QgZW50cmllcyBmb3IgbGF0ZXIg dXNlLgogICAgYWRkU3VmZml4ZXM9MTsKICAgICMgQ29udmVydCB0aGUgY3Vy cmVudCBsaW5lIGludG8gdGhlIHNhbWUgZm9ybSBhcyBhbnkgc3Vic2VxdWVu dCBlbnRyaWVzLgogICAgc3ViKCJbXjpdKzogIiwiIik7CiAgfTsKCiAgewog ICAgIyBJZiB3ZSBhcmUgYWNjdW11bGF0aW5nIHNlYXJjaExpc3QgZW50cmll cyB0aGUgY3VycmVudCBsaW5lIGNvbnRhaW5zIGEKICAgICMgc3VmZml4LCBh cHBlbmQgaXQgdG8gdGhlIGxpc3QuCiAgICBpZiAoYWRkU3VmZml4ZXMpIHsK ICAgICAgc2VhcmNoTGlzdD0oc2VhcmNoTGlzdCAiICIgJDEpOwogICAgfQog IH07CgogIEVORCB7CiAgICAjIEZpbmFsIGNsZWFuIHVwLiBJZiB3ZSBhY2N1 bXVsYXRlZCBhIG5vbi1lbXB0eSBzZWFyY2hMaXN0IGNvbmZpZ3VyZSBhCiAg ICAjICJzZWFyY2giIHJlY29yZCB3aXRoIHRoZSBjb250ZW50cyBvZiB0aGUg bGlzdC4KICAgIGlmIChzZWFyY2hMaXN0KSB7CiAgICAgIHByaW50ICJzZWFy Y2ggIiBzZWFyY2hMaXN0OwogICAgfQogIH0KCicgPi9ldGMvcmVzb2x2LmNv bmYK --e0cb4e8875cb43338e048a0bb461 Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --e0cb4e8875cb43338e048a0bb461--