randomly lose connection to pfsense router



  • Hi all,
    I've been trying to figure this problem out for the last week but no luck. I have a pfsense router and a mac connect to it using ethernet port. If I leave the ethernet cable in over night then the next day the mac will lose connection to the router (so I guess it's not really randomly losing connection). Weirdly enough If I disconnect the mac then the next day I will have connection to the router after plugging it back in.

    Pinging the router will not work (getting sendto no route to host error) because I have no connection, and the arp command shows that the 192.168.1.1 entry is either missing or incomplete (which is an indication of no connection if I remember correctly)

    On the router side, it can still ping other hosts so I believe it can still access internet.

    Most of the solutions that came up during my research does not really apply to me. There was one interesting post that suggests the problem can be solved with deleting and readding the default route. This did not work for me and ideally I prefer the mac does not lose connection at all.

    Any help is appreciated



  • uhm to be sure of what happen in that time we would need a packet capture. my 2 cent is that the mac does not renew his lease when it expire
    ...
    maybe try for a day to set a static ip


  • LAYER 8 Global Moderator

    What is the lease time have set? But guessing would have something to do with the dhcp lease.



  • @johnpoz The default lease time and maximum lease time options under Service -> DHCP Server have not been set so I assume pfsense is using initial values. I still see expired leases in the past. Can something like this happen: DHCP is trying to lease 192.168.1.100 to the mac but sees it expired and do nothing? Sorry I'm not too knowledgeable in Networking.



  • it's more like the mac does not accept the new lease



  • @kiokoman thanks for the suggestion. I'm going to try set a static ip for my mac and see how it goes. Is it possible for my mac to request a dhcp lease renew if it can't ping my router?



  • if it is without a valid ip it can't ping your router but it can listen to a dhcp solicit message.
    or you can press this button when internet is not working

    renew-dhcp-lease-mac.jpg

    take in mind that i'm only speculating here because we still don't know what it's happening
    anyway it's worth a try until someone else come in with a better idea


  • LAYER 8 Global Moderator

    well the default is 7200 seconds, but that is only for clients that don't request a specific value... So look on your client what is the lease time..

    But yeah a client could ask for, and get an offer for renewal - but then not actually use the renew, until expire and then not send out a discover..

    As mentioned this is just all speculation - but something that disconnects on a time frame, does make dhcp a possible suspect.

    What does your dhcpd log say on pfsense - is it flooded with renewal requests? As a client gets closer and closer to expire it will ask more and more often.. Until its pretty much screaming hey can I get a renewal..



  • @johnpoz Unfortunately pfsense only shows maximum of 50 logs so after rebooting the router I think the old ones got flushed out. I also found this post regarding dhcp not renewing https://forum.netgate.com/topic/115832/solved-wan-dhcp-not-renewing/3. I can't find the Option modifiers but I assume it got moved to Service -> DHCP server -> Other Options -> Default lease time. Thanks again for the inputs and I'll report back tomorrow to see if problem is resolved.


  • LAYER 8 Global Moderator

    Change your log length, I have mine set to 2000..

    Wan dhcp not renewing would have ZERO to do with your client..

    Your rebooting pfsense? And not this client?



  • @johnpoz I rebooted pfsense. After changing log size I see a lot of DHCPREQUEST on em0 to 255.255.255.255 port 67 but no RENEW message after the request it seems.



  • My gut tells me you have a bad Ethernet cable.



  • After changing some dhcp server options, it seems to fix the problem today. I'll have to do to more tests to be completely sure though.


  • LAYER 8 Global Moderator

    What option(s)?



  • I don't know which one of these are relevant so I'm just gonna list them all

    1. extended range from 192.168.1.100 - 192.168.1.199 to 192.168.1.100 - 192.168.1.254
    2. set default lease time to 86340 and maximum lease time to 86400
    3. enabled DNS resolver
    4. set idle timeout to 1320 minutes on CP
    5. set hard timeout to 1325 minutes, shorter than lease time.
      Again my networking knowledge is limited so I'm not sure which one of those options (or a combination of those) matters, or if any of them matter at all.

    One interesting observation though, yesterday after my mac lost connection, I tried to connect another device to the router but that device also does not have connection. It seems to me that if we are right about our speculation then the dhcp server just stopped working for whatever reason.


  • LAYER 8 Global Moderator

    Why are you running a captive portal on a wired network? Curious..



  • I was assigned to customize a CP for our business, but my boss doesn't want to install a wifi card on the router. I think eventually the device will wirelessly connect to a switch and that switch will be wired to the router.


  • LAYER 8 Global Moderator

    Ah ok - that makes sense ;)

    right about our speculation then the dhcp server just stopped working for whatever reason

    So did it stop, simple enough to see if its running on the router..



  • Currently everything is working right now, I'll have to try to reproduce the error since it's kind of inconsistent, I'll update this post again if anything happens. Thanks again for everyone's inputs, they really helped.



  • @ssattannae said in randomly lose connection to pfsense router:

    I was assigned to customize a CP for our business, but my boss doesn't want to install a wifi card on the router. I think eventually the device will wirelessly connect to a switch and that switch will be wired to the router.

    That's not how it works...

    You add wireless access points around your building or campus, wire those access points into the switch(es), and then the switch(es) is/are wired into pfsense/router.

    Jeff



  • Sorry for the super late update, I was starting to think the problem is fixed since it's been a week but it popped up again this morning. It SEEMS like the dhcp server just decided to stop working. My laptop is sending ARP request who-has 192.168.1.1 but on my pfsense box the lan interface never received the arp request. I'm using tcpdump -i ue0 to check these packets. From what I know since my laptop's arp request is never answered it does not know where 196.168.1.1 is and thus no connection. Is this still related to DHCP or a problem with pfsense ignoring arp for some reason?


  • LAYER 8 Global Moderator

    If your not getting back answer to arp, then there is connectivity issue. No that would have nothing to do with dhcp.

    Not going to ignore arp.. Unless it doesn't have that IP anymore.

    When you say laptop - its wireless? If you are sending arp, and the pfsense doesn't see this arp.. Then no it can never answer.



  • the laptop is connected to the pfsense box via a usb to ethernet adapter. I've tried different cables but no dice. Though I'm curious as to why restarting pfsense would make it work again.

    Edit: I forgot to mention one detail is that dhcp is on LAN interface.


  • LAYER 8 Global Moderator

    @ssattannae said in randomly lose connection to pfsense router:

    box via a usb to ethernet adapter.

    Yeah there is your problem, bet you case of beer ;)



  • Yup, I remembered now I was showing a technician how to install a production version of our pfsense onto a generic build. He resetted to factory default first and changed the interfaces so WAN was on a usb port. At the time I didn't think too much about it but it turns out to be a big head for me. @johnpoz I would so buy you a case of beer if I can.

    Thanks everyone for the inputs, I believe this is now solved.


Log in to reply