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

    Set interface(s) IP address from console did not work

    Scheduled Pinned Locked Moved 2.2 Snapshot Feedback and Problems - RETIRED
    8 Posts 2 Posters 8.3k 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.
    • P
      phil.davis
      last edited by

      I reset my APU.1C to factory defaults and assigned interfaces at the console during boot - no problem.
      Then I tried to use option 2) Set interface(s) IP address to set the LAN IP different from 192.168.1.1 (because when I plug in the WAN, this test system is on a home network that is already using 192.168.1.0/24).
      All the questions were asked, the messages looked good, but actually no change happened.
      I rebooted and tried again from the console, in case it was something to do with doing it directly after the first interface assign and boot - same result - all the questions and messages look good but no actual change implemented.
      Here is the console output:

      *** Welcome to pfSense 2.2-BETA-nanobsd (amd64) on pfSense ***
      
       WAN (wan)       -> re1        ->
       LAN (lan)       -> re2        -> v4: 192.168.1.1/24
       OPT1 (opt1)     -> re0        ->
       0) Logout (SSH only)                  9) pfTop
       1) Assign Interfaces                 10) Filter Logs
       2) Set interface(s) IP address       11) Restart webConfigurator
       3) Reset webConfigurator password    12) pfSense Developer Shell
       4) Reset to factory defaults         13) Upgrade from console
       5) Reboot system                     14) Enable Secure Shell (sshd)
       6) Halt system                       15) Restore recent configuration
       7) Ping host                         16) Restart PHP-FPM
       8) Shell
      
      Enter an option: 2
      
      Available interfaces:
      
      1 - WAN (re1 - dhcp, dhcp6)
      2 - LAN (re2 - static)
      3 - OPT1 (re0)
      
      Enter the number of the interface you wish to configure: 2
      
      Enter the new LAN IPv4 address.  Press <enter>for none:
      > 10.52.0.1
      
      Subnet masks are entered as bit counts (as in CIDR notation) in pfSense.
      e.g. 255.255.255.0 = 24
           255.255.0.0   = 16
           255.0.0.0     = 8
      
      Enter the new LAN IPv4 subnet bit count:
      > 24
      
      For a WAN, enter the new LAN IPv4 upstream gateway address.
      For a LAN, press <enter>for none:
      >
      
      Enter the new LAN IPv6 address.  Press <enter>for none:
      >
      
      Do you want to enable the DHCP server on LAN? [y|n]  y
      Enter the start address of the IPv4 client address range: 10.52.0.100
      Enter the end address of the IPv4 client address range: 10.52.0.199
      Disabling DHCPD...Done!
      
      Do you want to revert to HTTP as the webConfigurator protocol? (y/n) n
      
      Please wait while the changes are saved to LAN... Reloading filter...
       DHCPD...
      
      The IPv4 LAN address has been set to 10.52.0.1/24
      You can now access the webConfigurator by opening the following URL in your web browser:
                      https://10.52.0.1/
      
      Press <enter>to continue.
      *** Welcome to pfSense 2.2-BETA-nanobsd (amd64) on pfSense ***
      
       WAN (wan)       -> re1        ->
       LAN (lan)       -> re2        -> v4: 192.168.1.1/24
       OPT1 (opt1)     -> re0        ->
       0) Logout (SSH only)                  9) pfTop
       1) Assign Interfaces                 10) Filter Logs
       2) Set interface(s) IP address       11) Restart webConfigurator
       3) Reset webConfigurator password    12) pfSense Developer Shell
       4) Reset to factory defaults         13) Upgrade from console
       5) Reboot system                     14) Enable Secure Shell (sshd)
       6) Halt system                       15) Restore recent configuration
       7) Ping host                         16) Restart PHP-FPM
       8) Shell
      
      Enter an option: 8
      
      [2.2-BETA][root@pfSense.localdomain]/root: ifconfig
      re0: flags=8843 <up,broadcast,running,simplex,multicast>metric 0 mtu 1500
              options=8209b <rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate>ether 00:0d:b9:33:88:88
              inet6 fe80::20d:b9ff:fe33:8888%re0 prefixlen 64 scopeid 0x1
              nd6 options=21 <performnud,auto_linklocal>media: Ethernet autoselect (none)
              status: no carrier
      re1: flags=8843 <up,broadcast,running,simplex,multicast>metric 0 mtu 1500
              options=8209b <rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate>ether 00:0d:b9:33:88:89
              inet6 fe80::20d:b9ff:fe33:8889%re1 prefixlen 64 scopeid 0x2
              nd6 options=23 <performnud,accept_rtadv,auto_linklocal>media: Ethernet autoselect (none)
              status: no carrier
      re2: flags=8843 <up,broadcast,running,simplex,multicast>metric 0 mtu 1500
              options=8209b <rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate>ether 00:0d:b9:33:88:8a
              inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
              inet6 fe80::1:1%re2 prefixlen 64 scopeid 0x3
              nd6 options=21 <performnud,auto_linklocal>media: Ethernet autoselect (1000baseT <full-duplex>)
              status: active
      pflog0: flags=100 <promisc>metric 0 mtu 33144
      pfsync0: flags=0<> metric 0 mtu 1500
              syncpeer: 224.0.0.240 maxupd: 128 defer: on
              syncok: 1
      lo0: flags=8049 <up,loopback,running,multicast>metric 0 mtu 16384
              options=600003 <rxcsum,txcsum,rxcsum_ipv6,txcsum_ipv6>inet 127.0.0.1 netmask 0xff000000
              inet6 ::1 prefixlen 128
              inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6
              nd6 options=21 <performnud,auto_linklocal>enc0: flags=0<> metric 0 mtu 1536
              nd6 options=21 <performnud,auto_linklocal>[2.2-BETA][root@pfSense.localdomain]/root:</performnud,auto_linklocal></performnud,auto_linklocal></rxcsum,txcsum,rxcsum_ipv6,txcsum_ipv6></up,loopback,running,multicast></promisc></full-duplex></performnud,auto_linklocal></rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate></up,broadcast,running,simplex,multicast></performnud,accept_rtadv,auto_linklocal></rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate></up,broadcast,running,simplex,multicast></performnud,auto_linklocal></rxcsum,txcsum,vlan_mtu,vlan_hwtagging,vlan_hwcsum,wol_magic,linkstate></up,broadcast,running,simplex,multicast></enter></enter></enter></enter> 
      

      I can't believe this does not work from the console. Has anyone else done this from the console recently?

      I used the webGUI and wizard and it all happened fine.

      As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
      If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

      1 Reply Last reply Reply Quote 0
      • P
        phil.davis
        last edited by

        From debugging this, it runs all the code in write_config OK, I can see a new version of /cf/conf/config.xml - the same file is visible by a link through /conf/config.xml but the contents are just the old config.
        It is as if the $config global never gets new values, and so write_config is just re-writing the same settings, and then they get implemented, which of course is a no-op.
        Tried on an Alix running 2.2 also. Same issue, the config is rewritten but the only difference is log entry of the modification reason:

        diff /cf/conf/config.xml  /cf/conf/backup/config-1414943510.xml
        1321,1322c1321,1323
        <               <time>1414995073</time>
        <               
        ---
        >               <time>1414943510</time>
        >               <description>> ]]></description>
        
        

        As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
        If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

        1 Reply Last reply Reply Quote 0
        • P
          phil.davis
          last edited by

          I noticed a couple of little things in etc/rc.initial.setlanip and put them in this pull request:
          https://github.com/pfsense/pfsense/pull/1324
          This just tidies up some code, it does not fix the issue I am seeing! But IMO might as well improve the code as things are spotted.

          As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
          If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

          1 Reply Last reply Reply Quote 0
          • P
            phil.davis
            last edited by

            The problem comes whenever services_dhcpd_configure is called - the global $config gets reset from the actual current config, and any pending changes in the current process are lost.
            It was introduced by commit https://github.com/pfsense/pfsense/commit/86ce2df7fdb04aa15f9fbeda91202c153e9d0cbd
            services_dhcpdv4_configure() now does:

            require_once('pkg-utils.inc')
            

            and pkg-utils.inc does various stuff like:

            if(file_exists("/cf/conf/use_xmlreader"))
            require_once("xmlreader.inc");
            else
            require_once("xmlparse.inc");
            
            

            which seems to cause a reset of the $config variable.

            The top-level code in rc.initial.setlanip really does not need to (and should not) implement any changes along the way - it should collect all the answers from the user, then write_config and then make all the necessary calls to routines to implement the changes on the running system. That will fix it.

            As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
            If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

            1 Reply Last reply Reply Quote 0
            • P
              phil.davis
              last edited by

              And this pull request fixes it:
              https://github.com/pfsense/pfsense/pull/1325

              Superseded by 1329 - see post below.

              As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
              If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

              1 Reply Last reply Reply Quote 0
              • W
                Wordo
                last edited by

                Can confirm this behaviour, cannot assign a static WAN interface via console with the latest pfSense-memstick-2.2-BETA-amd64-20141101-1224.img

                1 Reply Last reply Reply Quote 0
                • P
                  phil.davis
                  last edited by

                  The final version of the fix that was committed yesterday was:
                  https://github.com/pfsense/pfsense/pull/1329
                  That should be in the latest snapshot by now.
                  It certainly was not fixed on 1 Nov.

                  As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                  If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

                  1 Reply Last reply Reply Quote 0
                  • W
                    Wordo
                    last edited by

                    Ok, it's fixed with the newest snapshot  ;D

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