6 Replies Latest reply: Jan 29, 2014 9:33 AM by phlrnnr RSS

    Change IP Address Using CLI?

    mike_cc

      I want to change the ip address of my MWG v7 appliance using the CLI - how do I do this? The ifcfg-eth0 script doesn't have the interface information in it, so I'm not sure where the interface is getting it's IP information from. This interface is the web interface.

       

      Thanks,

      Mike

        • 1. Re: Change IP Address Using CLI?
          trishoar

          Hi Mike,

           

          On my server they are in  /etc/sysconfig/network-scripts/ifcfg-eth0

          and changing it there and issuesing a service network reload will work.

          Likewise you can use

          ip a add 0.0.0.0/0 dev eth0

          to add, change and remove them. however I would recomend against doing this as when you reboot MWG will change all the settings back again. I'm sure you can make it persistant if you try, but unless there is an overiding reason why you would want this long term rather than to just suffle things in the backround whilst you do something I'd use the UI.

           

          Tris

          • 2. Re: Change IP Address Using CLI?
            mike_cc

            That works. I was able to get an ip on the system configuring ifcfg-eth0. I then used the UI to enter the network config so it would remain after a reboot.

             

            Mike

            • 3. Re: Change IP Address Using CLI?
              Jon Scholten

              By modifying the system directly you are not allowing the MWG software to write it into its own files.

               

              This may cause issues when attempting to restore a backup or during the upgrade process.

               

              You will want to set the IP in the interface to be certain the changes are set everywhere.

               

              Best,

              Jon

              • 4. Re: Change IP Address Using CLI?
                mike_cc

                Right, that's what I said here "I then used the UI to enter the network config so it would remain after a reboot."

                • 5. Re: Change IP Address Using CLI?
                  Jon Scholten

                  Sorry Mike,

                   

                  derr on my part. I read that wrong....

                   

                  Tris' commands should work, I use ifconfig:

                  # Temporarily configure IP address (will not persist through reboot)

                  ifconfig eth0 <desired IP> netmask 255.255.0.0

                   

                  You may also want to set the default gateway sometimes, to do this you can use the following, this will temporarliy set it as well:

                  ip route add default via <default-gw-ip>

                   

                  Best,

                  Jon

                  • 6. Re: Change IP Address Using CLI?
                    phlrnnr

                    Thanks @Jon_Scholten!  This is very helpful when accidentally breaking the network settings (I changed the IP in the UI, but forgot to change the default GW, so the only way I could reach the appliance was by the console).