Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Keep loosing WAN IP Address - dhclient does not seem to do update

    Scheduled Pinned Locked Moved DHCP and DNS
    199 Posts 27 Posters 112.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sullrich
      last edited by

      That was from 2005.  Since then dhclient was replaced with a version from OpenBSD.

      1 Reply Last reply Reply Quote 0
      • S
        Selective
        last edited by

        well,, the error is the same:
        "short write: wanted 21 got 0 bytes"

        1 Reply Last reply Reply Quote 0
        • S
          sullrich
          last edited by

          @Selective:

          well,, the error is the same:
          "short write: wanted 21 got 0 bytes"

          Yeah, that's very strange.  Just to make sure, you are on the latest testing snapshot?

          1 Reply Last reply Reply Quote 0
          • D
            d13f00l
            last edited by

            @Selective:

            i have the same problem, and i have done this (no warranty!):

            edit /etc/rc.newwanip
            and in the beginning of the file i added:

            if($curwanip == "0.0.0.0") {
                    log_error("Failed to update WAN IP, restarting dhclient.");
                    exec("dhclient rl0");
            }
            –----------------------------------------------------------------------------------
            Replace "rl0" with you WAN interface!
            It would look like this:

            /* WAN IP address has changed */

            $argument = str_replace("\n", "", $argv[1]);

            if($argument <> "") {
            $curwanip = find_interface_ip($argument);
            $interface = convert_real_interface_to_friendly_interface_name($argument);
            if($curwanip == "")
                    $curwanip = get_current_wan_address();
            } else {
                $curwanip = get_current_wan_address();
                $interface = "wan";
            }
            if($curwanip == "0.0.0.0") {
                    log_error("Failed to update WAN IP, restarting dhclient.");
                    exec("dhclient rl0");
            }

            THANKS SO MUCH!

            This works like a charm.  My ISP drops my IP from time to time, it was annoying because pfsense doesn't auto-renew it for whatever reason.  I'm running in vmware.  It works fine now!  I can see it in the system logs as it happens.

            1 Reply Last reply Reply Quote 0
            • S
              Selective
              last edited by

              Nice to hear it worked !! :D

              1 Reply Last reply Reply Quote 0
              • S
                Selective
                last edited by

                @sullrich:

                @Selective:

                well,, the error is the same:
                "short write: wanted 21 got 0 bytes"

                Yeah, that's very strange.  Just to make sure, you are on the latest testing snapshot?

                Yes, im using 2006-12-14 right now, maybe its time to upgrade dhclient to 3.0.5 if its possibly ?? or even replace dhclient.

                1 Reply Last reply Reply Quote 0
                • F
                  fireseller
                  last edited by

                  yeah, definately looks like the same error. What drives me crazy is that the versions before 1.0 of Pfsense worked flawlessly concerning the dhclient Wan IP issue. Was there a version change?

                  Cheers
                  fireseller

                  1 Reply Last reply Reply Quote 0
                  • S
                    sullrich
                    last edited by

                    Everyone having problems please replace /etc/rc.newwanip with http://pfsense.com/cgi-bin/cvsweb.cgi/pfSense/etc/rc.newwanip?rev=1.21.2.23;content-type=text%2Fplain;only_with_tag=RELENG_1

                    Let me know.. Thanks!

                    1 Reply Last reply Reply Quote 0
                    • B
                      Blinkiz
                      last edited by

                      Sorry to say, but I have tested another firewall and all my problems disappeared.
                      The thing about my ISP is changing my IP a lot.. Yea, it disappeared. Clearly it was pfsense. On the new firewall I have had the same WAN IP since the installation ~2 days ago.

                      The weird part about this is that pfsense has been working before without problem. All problems started when I changed my ISP. So.. again, not expert, but I believe ISP have different ways to give IP's and pfsense can't handle them all in a correct manner.
                      On the new firewall I can see in the logs that it comes false dhcp offers from time to time on the WAN. The new firewall just drops this. Maybe pfsense doesn't? Anyway, I have no clue…

                      1 Reply Last reply Reply Quote 0
                      • S
                        Selective
                        last edited by

                        @sullrich:

                        Everyone having problems please replace /etc/rc.newwanip with http://pfsense.com/cgi-bin/cvsweb.cgi/pfSense/etc/rc.newwanip?rev=1.21.2.23;content-type=text%2Fplain;only_with_tag=RELENG_1

                        Let me know.. Thanks!

                        it looks like it could work, BUT ! i got this:

                        Dec 17 15:25:11 dhclient[11983]: exiting.
                        Dec 17 15:25:11 dhclient[11983]: exiting.
                        Dec 17 15:25:11 dhclient[11983]: connection closed
                        Dec 17 15:25:11 dhclient[11983]: connection closed
                        Dec 17 15:25:11 dhclient[11982]: exiting.
                        Dec 17 15:25:11 dhclient[11982]: exiting.
                        Dec 17 15:25:11 dhclient[11982]: wan: not found
                        Dec 17 15:25:11 dhclient[11982]: wan: not found
                        Dec 17 15:25:11 php: : Failed to update WAN IP, restarting dhclient.
                        Dec 17 15:25:11 php: : Informational: rc.newwanip is starting.

                        it seems like the script is using "wan" as a real interface name.
                        maybe it should be like this ? :
                        exec("dhclient {$argument}");

                        1 Reply Last reply Reply Quote 0
                        • N
                          Nextrem
                          last edited by

                          I don't know if this new script fixes the Loose IP Problem. But after replacing the old version with the new one I had problems with my OpenVPN. Always the script tried to re synced the OpenVPN, I received a error:

                          Port [undef] 1194 already bound

                          I use the pfSense-1.0.1-Embedded.img.gz with just changing the /etc/rc.newwanip to the proposed version.

                          1 Reply Last reply Reply Quote 0
                          • S
                            sullrich
                            last edited by

                            Nextrem: not related, known issue, please see the openvpn threads.

                            Everyone else:

                            I have updated rc.newwanip, try this version:

                            http://pfsense.com/cgi-bin/cvsweb.cgi/pfSense/etc/rc.newwanip?rev=1.21.2.24;content-type=text%2Fplain;only_with_tag=RELENG_1

                            1 Reply Last reply Reply Quote 0
                            • F
                              fireseller
                              last edited by

                              Thx sullrich

                              Just replaced and rebooted. Let's hope the best ;)

                              Cheers
                              fireseller

                              1 Reply Last reply Reply Quote 0
                              • S
                                Selective
                                last edited by

                                i think i can confirm that the new script is working !! ;D

                                Dec 18 18:12:34 php: : Informational: DHClient spawned /etc/rc.newwanip and the new ip is wan - 90.224.168.54.
                                Dec 18 18:12:29 login: login on ttyv0 as root
                                Dec 18 18:12:29 php: : Informational: rc.newwanip is starting.
                                Dec 18 18:12:28 check_reload_status: rc.newwanip starting
                                Dec 18 18:12:25 dhclient: /sbin/route add default 90.224.168.1
                                Dec 18 18:12:25 dhclient: New Routers (rl0): 90.224.168.1
                                Dec 18 18:12:25 dhclient: New Broadcast Address (rl0): 90.224.168.255
                                Dec 18 18:12:25 dhclient: New Subnet Mask (rl0): 255.255.255.0
                                Dec 18 18:12:25 dhclient: New IP Address (rl0): 90.224.168.54
                                Dec 18 18:12:23 php: : Failed to update WAN IP, restarting dhclient.
                                Dec 18 18:12:23 php: : Informational: rc.newwanip is starting.
                                Dec 18 18:12:23 check_reload_status: rc.newwanip starting
                                –---------------------------
                                however, i dont think this script will solve the "short write: wanted 21 but got 0 bytes" error, or does it ?

                                1 Reply Last reply Reply Quote 0
                                • S
                                  sullrich
                                  last edited by

                                  It does not solve it, it simply works around the issue for the time being.  Anyone else tested?

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    Selective
                                    last edited by

                                    i know, but i think there is two errors,
                                    first, when it failes to update the wan ip, that have been "solved" with the script.
                                    but the second with "short write" will not be solved by this, i think.

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      Selective
                                      last edited by

                                      i can confirm that the new script (rc.newwanip) is working great !!! ;D :D ;D

                                      1 Reply Last reply Reply Quote 0
                                      • S
                                        sullrich
                                        last edited by

                                        Yay!  Anyone else?

                                        1 Reply Last reply Reply Quote 0
                                        • F
                                          fireseller
                                          last edited by

                                          Sorry but the new script is NOT running great, after 1 day again the connection got lost:
                                          Dec 20 05:59:32 last message repeated 3 times
                                          Dec 20 05:59:12 dhcpd: send_packet: Permission denied
                                          Dec 20 05:52:02 last message repeated 2 times
                                          Dec 20 05:51:51 dhcpd: send_packet: Permission denied
                                          Dec 20 01:52:17 dhclient[268]: exiting.
                                          Dec 20 01:52:17 dhclient[268]: exiting.
                                          Dec 20 01:52:17 dhclient[268]: short write: wanted 21 got 0 bytes
                                          Dec 20 01:52:17 dhclient[268]: short write: wanted 21 got 0 bytes
                                          Dec 20 01:52:17 dhclient[268]: DHCPACK from 10.215.0.1
                                          Dec 20 01:52:17 dhclient[268]: DHCPREQUEST on xl1 to 255.255.255.255 port 67
                                          Dec 20 01:50:24 dhclient[268]: DHCPREQUEST on xl1 to 10.215.0.1 port 67
                                          Dec 20 01:49:37 last message repeated 24 times
                                          Dec 20 01:38:42 last message repeated 14 times
                                          Dec 20 01:29:57 last message repeated 4 times
                                          Dec 20 01:28:08 last message repeated 2 times
                                          Dec 20 01:27:48 dhclient[268]: DHCPREQUEST on xl1 to 10.215.0.1 port 67
                                          Dec 20 01:01:03 php: : phpDynDNS: No Change In My IP Address and/or 25 Days Has Not Past. Not Updating Dynamic DNS Entry.
                                          Dec 20 01:01:03 php: : DynDns: Cached IP: 84.75.14.209
                                          Dec 20 01:01:03 php: : DynDns: Current WAN IP: 84.75.14.209
                                          Dec 20 01:01:03 php: : DynDns: _detectChange() starting.
                                          Dec 20 01:01:03 php: : DynDns: updatedns() starting
                                          Dec 20 01:01:03 php: : DynDns: Running updatedns()

                                          This is starting to be render PFSense unusable for me. Every 30 bucks router can keep the ip from my isp for several months (last setup). Is it not possible to use the dhclient from the pre 1.0 versions???

                                          Sorry for no better news.

                                          1 Reply Last reply Reply Quote 0
                                          • F
                                            fireseller
                                            last edited by

                                            As this problem gives biggest headaches to me, I've decided to use my linux server to run this via cronjob every minute:

                                            wget -q –no-check-certificate --user=XXX --password=XXX --post-data "interface=wan&submit=Renew" http://IPOFPFSENSEGUI/status_interfaces.php -O /dev/null

                                            This works fine for now. Hopefully the real solution to repair the dhclient will soon be there…

                                            Cheers
                                            fireseller

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.