From owner-freebsd-questions@freebsd.org Sat Sep 12 17:47:04 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22A99A02845 for ; Sat, 12 Sep 2015 17:47:04 +0000 (UTC) (envelope-from lists@flederma.us) Received: from mout.perfora.net (mout.perfora.net [74.208.4.197]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.perfora.net", Issuer "thawte SSL CA - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E74D2189C for ; Sat, 12 Sep 2015 17:47:03 +0000 (UTC) (envelope-from lists@flederma.us) Received: from neon.local ([73.207.230.118]) by mrelay.perfora.net (mreueus001) with ESMTPSA (Nemesis) id 0LfAKc-1Yqkhi0WXw-00oojb for ; Sat, 12 Sep 2015 19:47:02 +0200 Subject: Re: dhclient(8) sets wrong interface netmask on boot up To: freebsd-questions@freebsd.org References: <55F398CA.7050308@flederma.us> From: Cary X-Enigmail-Draft-Status: N1110 Message-ID: <55F46514.9020702@flederma.us> Date: Sat, 12 Sep 2015 13:47:00 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:fe7++Kk75xQmlYSU3xAH9IrQS2YNgdUEfOe/F3UYKFEomldXhDm 5jZ4nyZ7rFQGMdU27NoGB7go0/3+J8Yrmlqlk2xzIvdts7c0ms1c4D7X0whNu/UDd8MAAEf Gfwu7micseNTkQkfsH9bIqTw2LkZsD0smheNHRTWEZ6w5p3Lwsug+5vPIIMmfn066+LyU8S mh61mXybLnX9IeWVx113g== X-UI-Out-Filterresults: notjunk:1;V01:K0:Bbk20HEMUU8=:uLERo9XrfzmOQVdB2GXdPi bM536s/G7cM7/Y83hXUptNbgowI1VyVVVz3CnG45yEEfDV+jti3anYnsnuYf4VhFG2U+HHEau cd5agWGZV19c4QL/LlsokjsO32vG/PXFLznSVbTfID0Xe83l877B4qiT9D78O5qZr1uP3EZXV uViFQnUaygjMgfpTBnCHeORRk3R0n66uRL3yzrbwoXJVXIt7iFRNKPkJ9//sf0ZsT+PRImxB7 pRg5TEp1X6tU9wlnQ5VnR3Cv6+hkBLQp6NwWGdhOschL7B0um3lidE7W0oh2jdDsBU8vMWIpC jOZYjgNsWo1GWKhuOxMQ5n9yK1MGHwr9ay3xj5d1ZT9k0GWyCMEmvceskEtlV85Nb/6pNDJgJ U9j8CvcwexUP7LLI/FesS1ic7th3qYRpTc/m22/r5BE4QLmq9F2M8qBpIae9zx3djirlW947y P9oSLiuXq3vfkXYXRVpTItQnAW79YrWmbWq8ZnV/vcuk+48dPHlMlVO33ITgUrpHXqxpMMTyU FsF7wMdwRq20ZDe/gMwk/1Xtl6+/3BGlMdnMzd/B0MtWgZ79jsaT/PP1y+6SBv8jNasKQk5ZT ATeImCDjRD12cjS7vqP1l0dzhu1L8IAUIzC+JGnRlfvQjlu9Nd0RGTXOsJ6QMJn7ImGvyqyM+ 06p0xS05pXkOEOQduEAwCPi7f+qXhCFRc4gxTRxs2C0r7z+ps2CaK5YFMGEisCNqeo/CbQjbn mjXV5fXHUQkKES9O X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2015 17:47:04 -0000 On 09/12/2015 10:45, Adam Vande More wrote: > On Fri, Sep 11, 2015 at 10:15 PM, Cary wrote: > >> QUESTION: How do I get dhclient to correctly set the interface netmask >> when the system boots? >> >> Once the system is booted, I cannot SSH into the system until I have >> logged in via the console and restarted dhclient(8) (`service dhclient >> restart em0`). >> >> ACTIONS TAKEN: >> I've installed 10.2-RELEASE[uname] from scratch. >> >> My [/etc/rc.conf] specifies that the em0 interface should have dhclient >> run on it. >> >> Running ifconfig(8) prior (ifconfig-0.out) and post (ifconfig-1.out) >> dhclient, I found that the netmask is set incorrectly after boot: >> >> # ifconfig -a > ifconfig-0.out >> # service dhclient restart em0 >> Stopping dhclient. >> Starting dhclient. >> DHCPREQUEST on em0 to 255.255.255.255 port 67 >> DHCPACK from 192.168.20.1 >> bound to 192.168.20.166 -- renewal in 43200 seconds. >> # ifconfig -a > ifconfig-1.out >> # diff ifconfig-0.out ifconfig-1.out >> 4c4 >> < inet 192.168.20.166 netmask 0xffffffff broadcast 192.168.20.166 >> --- >>> inet 192.168.20.166 netmask 0xffffff00 broadcast 192.168.20.255 >> >> My [/etc/dhclient.conf] file is unchanged from the system default. >> >> The DHCP server is an residential wireless router. All other devices are >> receiving DHCP configurations from the router without issue. >> >> Thank you in advance for any assistance! >> > > Nothing you've given us would lead me to believe this is an issue with > dhclient. Why do you? It simply assigns whatever info it gets from DHCP. > > Thanks, Adam. It is good to know that this configuration should be correct. I believe it is a dhclient issue because it is the only means by which I'm configuring the network, at boot up and once the system is running. The netmask is set incorrectly on boot, and after running dhclient manually it is set correctly. >> [uname] FreeBSD public.fbsd.local 10.2-RELEASE FreeBSD 10.2-RELEASE #0 >> r286666: Wed Aug 12 15:26:37 UTC 2015 >> root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 >> >> [/etc/rc.conf] >> hostname="public.fbsd.local" >> ifconfig_em0="DHCP" >> cloned_interfaces="${cloned_interfaces} lo1" >> > > previous line doesn't make much sense. > That was copied from the FreeBSD handbook section on managing jails (https://www.freebsd.org/doc/handbook/jails-ezjail.html). I didn't think that the jails would mess with the base host network configuration. However, after re-looking at the jail config, I changed the config line in /usr/local/etc/ezjail/www_local from: export jail_www_local_ip="lo1|127.0.1.1,em0|192.168.20.166" to export jail_www_local_ip="lo1|127.0.1.1" After reboot, I was able to SSH into it without trouble. But now the httpd server cannot bind to the em0 interface. I guess I can forward traffic with ipfw or pfctl to get around that issue. LESSON LEARNED: ezjail *will* override the DHCP-assigned configuration of an interface! Thanks for the nudge, Adam. Hopefully my ignorance will help someone else down the line. > >> sshd_enable="YES" >> > > -- Cary Mathews