From owner-freebsd-net@freebsd.org Fri Oct 4 18:40:54 2019 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D306135917 for ; Fri, 4 Oct 2019 18:40:54 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46lJbm6vk8z3BmH for ; Fri, 4 Oct 2019 18:40:52 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [80.187.81.48] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1iGSVV-0001Ck-DY for freebsd-net@freebsd.org; Fri, 04 Oct 2019 20:40:49 +0200 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id x94Iei9B002558 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Fri, 4 Oct 2019 20:40:44 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id x94IeiLX002557 for freebsd-net@freebsd.org; Fri, 4 Oct 2019 20:40:44 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Fri, 4 Oct 2019 20:40:44 +0200 From: Matthias Apitz To: freebsd-net@freebsd.org Subject: dhclient gives wrong IP addr when leases file exists Message-ID: <20191004184044.GA2521@c720-r342378> Reply-To: Matthias Apitz Mail-Followup-To: freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 13.0-CURRENT r342378 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.11.1 (2018-12-01) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 80.187.81.48 X-Rspamd-Queue-Id: 46lJbm6vk8z3BmH X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of guru@unixarea.de has no SPF policy when checking 178.254.4.101) smtp.mailfrom=guru@unixarea.de X-Spamd-Result: default: False [-1.73 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[guru@unixarea.de]; HAS_XOIP(0.00)[]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; RECEIVED_SPAMHAUS_PBL(0.00)[48.81.187.80.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; IP_SCORE(-1.04)[ip: (-7.99), ipnet: 178.254.0.0/19(1.51), asn: 42730(1.29), country: DE(-0.01)]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:42730, ipnet:178.254.0.0/19, country:DE]; RCVD_IN_DNSWL_LOW(-0.10)[101.4.254.178.list.dnswl.org : 127.0.5.1]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.988,0]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[unixarea.de]; MIME_TRACE(0.00)[0:+]; R_SPF_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Oct 2019 18:40:54 -0000 When I go from my home network's AP (192.168.178.1) where I have as IP addr 192.168.178.24 to the 'road' and use as AP my mobile it associates fine to the AP of my phone, but does not get a correct IP addr from it via DHCP: # ifconfig wlan0 wlan0: flags=8843 metric 0 mtu 1500 ether 90:48:9a:92:9e:43 inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 ^^^^^^^^^^^^ groups: wlan ssid "Matthiass iPhone" channel 1 (2412 MHz 11g ht/20) bssid c6:0c:f7:42:62:81 regdomain 108 indoor ecm authmode WPA2/802.11i privacy ON deftxkey UNDEF AES-CCM 2:128-bit txpower 20 bmiss 7 scanvalid 60 protmode CTS ampdulimit 64k ampdudensity 4 shortgi wme burst roaming MANUAL media: IEEE 802.11 Wireless Ethernet MCS mode 11ng status: associated nd6 options=2b I kill the dhclient alwaya and launch it by hand to see the problem: why it is bound to the wrong IP addr (of my AP at home): # killall dhclient # dhclient wlan0 DHCPREQUEST on wlan0 to 255.255.255.255 port 67 DHCPACK from 172.20.10.1 bound to 192.168.178.24 -- renewal in 42768 seconds. ^^^^^^^^^^^^^^^^^^^^^^^^^ ????? # ifconfig wlan0 wlan0: flags=8843 metric 0 mtu 1500 ether 90:48:9a:92:9e:43 inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255 ^^^^^^^^^^^^ groups: wlan ssid "Matthiass iPhone" channel 1 (2412 MHz 11g ht/20) bssid c6:0c:f7:42:62:81 regdomain 108 indoor ecm authmode WPA2/802.11i privacy ON deftxkey UNDEF AES-CCM 2:128-bit txpower 20 bmiss 7 scanvalid 60 protmode CTS ampdulimit 64k ampdudensity 4 shortgi wme burst roaming MANUAL media: IEEE 802.11 Wireless Ethernet MCS mode 11ng status: associated nd6 options=2b When I move the file about the leases away, it works fine: # killall dhclient # mv /var/db/dhclient.leases.wlan0 /var/db/dhclient.leases.wlan0.away # dhclient wlan0 DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6 DHCPOFFER from 172.20.10.1 DHCPREQUEST on wlan0 to 255.255.255.255 port 67 DHCPACK from 172.20.10.1 bound to 172.20.10.2 -- renewal in 42768 seconds. # ifconfig wlan0 wlan0: flags=8843 metric 0 mtu 1500 ether 90:48:9a:92:9e:43 inet 172.20.10.2 netmask 0xfffffff0 broadcast 172.20.10.15 ^^^^^^^^^^^^^^^^ groups: wlan ssid "Matthiass iPhone" channel 1 (2412 MHz 11g ht/20) bssid c6:0c:f7:42:62:81 regdomain 108 indoor ecm authmode WPA2/802.11i privacy ON deftxkey UNDEF AES-CCM 2:128-bit txpower 20 bmiss 7 scanvalid 60 protmode CTS ampdulimit 64k ampdudensity 4 shortgi wme burst roaming MANUAL media: IEEE 802.11 Wireless Ethernet MCS mode 11ng status: associated nd6 options=2b Any ideas? matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub 3. Oktober! Wir gratulieren! Der Berliner Fernsehturm wird 50 aus: https://www.jungewelt.de/2019/10-02/index.php