DHCP-Default GW and DNS



  • Apologies if this is a repeat. I've searched through the forums and haven't found a resolution in the forums or google.

    SYSTEM:
    2.3.2-RELEASE-p1 (amd64)
    built on Tue Sep 27 12:13:07 CDT 2016
    FreeBSD 10.3-RELEASE-p9

    SETUP:
    External Internet Facing Router @ 192.168.1.1
    VirtualBox configuration with the following
    VirtualBox-PFSense WAN @ 192.168.1.17 on the bridged interface
    VirtualBox-PFSense LAN @ 10.0.0.1/24 on the hostonly interface
    VirtualBox hostonly network, no DHCP, interface bound to 10.0.0.2/32 with a /24 netmask
    VirtualBox hosts added in to the hostonly network.

    DHCP is enabled in PFSense with a lease pool of 10.0.0.100 - 10.0.0.200

    ISSUE:
    When I bring a new host up in Virtualbox on the hostonly network it gets an IP from PFSense but does not correctly configure DNS or the default gateway. New system comes up and I can ping 10.0.0.1. Ping 192.168.1.1 fails. Ping www.google.com fails.

    TROUBLESHOOTING:
    I can manually set the resolv.conf and run 'route add default gw 10.0.0.1' on the host. Ping 192.168.1.1 will work as will ping 8.8.8.8 and ping www.google.com.

    I've tried setting the gateway in PFSense (10.0.0.1) and setting the DNS servers (192.168.1.1, 8.8.8.8). Restarted the service. Restarted the firewall. All with no effect. Logs only show the following:
    Jan 8 03:41:10 dhcpd DHCPDISCOVER from 08:00:27:53:c4:76 via em1
    Jan 8 03:41:11 dhcpd DHCPOFFER on 10.0.0.103 to 08:00:27:53:c4:76 (ubuntu) via em1

    This doesn't appear to be distribution specific on the host side. I've tried Ubuntu, Lubuntu, Kali, and Alpine linux. All have the same behavior. I've also rotated the MAC on the virtual host and deleted out the leases on PFSense to see if it was some odd caching issue. All with no effect.


  • LAYER 8 Global Moderator

    Out of the box pfsense will point to the IP the dhcp server is running on as the gateway.  Same goes for dns if you have the resolver or forwarder enabled.  Resolver is the default.

    Why would you set dns to 192.168.1.1 and 8.8.8.8??



  • Thanks for response. TL/DR: I agree that's the way it's supposed to work, but it isn't, and is why I posted. Everything else was troubleshooting.
    –-
    The initial configuration where none of that is set and PFSense is automatically putting it together is what I had an issue with; it's not working. As clarification, I reset the PFSense to default behavior with DHCP on each new install of the host operating systems.

    192.168.1.1 is the WAN side DHCP and DNS server. 8.8.8.8 is an open DNS server. I set both of those while troubleshooting to see if there was an issue in PFSense getting the gateway and DNS automatically as it puts together the DHCP response. Manually setting those doesn't work either, but I've confirmed that when set manually routing and DNS resolution work as expected. This is why I think it's something to do with the DHCP response from the PFSense firewall.


  • LAYER 8 Global Moderator

    Dude I don't know what you are doing… But I can tell you how it works out of the box...  Without you touching pretty much anything its going to hand out itself for a gateway and dns..  Your saying its handing out dhcp lease and giving you an IP in in the right pool.. But not sending dns or gateway...

    So your either not using pfsense as your dhcp.  Or you messed with the default config..

    So why don't you validate that pfsense actually handed out dhcp.. Takes all of 2 seconds to see exactly what is going on.. On pfsense diag, packet capture - do a capture on your interface dhcp is running on.  Set port 67 so it only grabs dhcp info.

    Then open up that capture in say wireshark.  And you can see exactly the whole process.  So you see here I release on my client.  I then do a renew and it sends out discover pfsense then sends out offer, which client then requests, then dhcp server aks that and says yup thats your lease.

    You can look in the offer and see exactly what was offered for the router and dns..




  • Thanks @johnpoz for the pointer to the packet capture feature. I know what happened now and short answer is yes, there was another DHCP server on the network, and once it was turned off, things work as expected.

    Everything with this was a clean install, including VirtualBox 5.1.12r112440

    Packet capture showed a response from 10.0.0.100 beating in the response from 10.0.0.1 each time. DHCP responses from 10.0.0.100 were indeed missing the DNS and Router options followed by a response from 10.0.0.1 (attached) with all the information as expected.

    Solution:
    Virtualbox seems to not honor turning off the default DHCP server until the entire program is restarted. I verified that the settings were 'DHCP server off', applied, NULL'd out the server settings, applied; only until a full restart of the program did the settings take effect and the 10.0.0.100 server stopped responding. If that's in the VirtualBox documentation I missed it and will double check there before taking the issue to that community.

    Thanks again.

    ![Screen Shot 2017-01-08 at 11.31.26 AM.png](/public/imported_attachments/1/Screen Shot 2017-01-08 at 11.31.26 AM.png)
    ![Screen Shot 2017-01-08 at 11.31.26 AM.png_thumb](/public/imported_attachments/1/Screen Shot 2017-01-08 at 11.31.26 AM.png_thumb)


Log in to reply