Following upstream gateway change, pfSense on VBox fails to get WAN IP.



  • Hi All,
    I am pretty new to networking. I have a problem that is perplexing to me, and I can't figure out a good solution. I have VirtualBox set up on my computer with a pfSense VM and some desktop OS VMs. The pfSense VM connects to the laptop's wireless NIC through VBox's bridge interface, and the wireless NIC, in turn, connects to whichever router is available, depending on whether I am in the office or at home.

    The problem is whenever I change locations, the WAN for pfSense is not able to get the IP from the new router's DHCP server, even with rebooting. The Web configurator's Status/Interface page shows the IP address of the old router while the text console shows no address in the WAN section. I cannot get a ping response from the current router when this issue occurs (and of course the old since it is not there). pfSense's LAN interface IP address is set up statically and it works fine. The only solution I have found out that works for the WAN is turning off the pfSense VM and changing the MAC address for its bridge interface. Of course, if I change locations, the whole cycle repeats. In the Interfaces/WAN page, I unchecked "Block private networks and loopback addresses" so I don't think that is the problem.

    Below is a rough diagram of my setup. I will list the things I tried that did not work following the diagram. I am also attaching /var/log/system.log snippet following a reboot. It would be great if you could offer me some insights.

          Physical wireless router, the "upstream gateway" for pfSense. 
          Has DHCP server. Its IP address is either 192.168.1.1 (Office) or 192.168.7.1 (Home)
                  |
                  |(WiFi connection)
                  |
              Host laptop WiFi NIC
                  |
                  |(Bridged network)
                  |
              VM1 pfSense.
              Its WAN is set up to get its IP from the upstream gateway's DHCP.
              Its LAN IP is 10.0.0.1
                  |     
            (Connected via 
            VirtualBox's internal network interface)
              |   |   |
             VM2 VM3 VM4
    

    Things I tried that did not work

    • Reboot.
    • Go to the web configurator, release the DHCP lease, and renew.
    • Go to the pfSense console, go to /var/db directory, and move all files that contain references to the routers' 192.168.*.* addresses to another directory so pfSense can't find them.
    • Tried reassigning the interfaces with the same settings again in the console. (Option 2)
    • Tried setting up the WAN interface again in the console. (Option 3)

    Log after reboot
    0_1532974628948_pfsense_system_log_after_reboot.txt



  • When you change locations the WAN connection on the host changes but your VM won't detect a link-down event on its own WAN because no cable has been "pulled out". You can force a renew of the lease by unplugging the virtual cable at VirtualBox's network settings, adapter# and then "cable connected", uncheck, press ok, check, press ok. It may be possible to automate this with VBoxManage but haven't tried myself.



  • Thank you for the tip, but it did not work, unfortunately. I think if this solution works, rebooting would have worked as well since that would definitely trigger a link-down event. I am wondering if the same issue would happen with a real hardware instance of pfSense or the issue is just limited to VirtualBox. Either the VBox virtual NIC has bad data it can't get rid of until I change the MAC address or there is something in pfSense I need to tweak.