• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Change Static IPs

    Scheduled Pinned Locked Moved
    General
    4
    19
    2.2k
    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.
    • T
      Turcotter
      last edited by

      Hello I was wondering if there was an efficient way to use FOG to change the IP address of a computer after imaging. I stumbled across these two posts in my research and neither seemed to really have an answer.

      https://forums.fogproject.org/topic/2204/add-ip-address-changer-snap-in-scripts-included/6

      https://forums.fogproject.org/topic/3387/changing-the-static-ip-of-a-client

      One requires the use of the now outdated IP field and the other would require creating 600+ different snapins. Is there any way of doing this while using the fog hostname as the constant variable?

      Thanks in advance!

      george1421G 1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        Why not set dhcp server to hand out reserved addresses? That, to me, would seem the easiest.

        That or make your snapin lookup the name of the physical machine, based on that give the appropriate IP address. (All ips stores in a single script based on the machine name. .e.g. foghostname1 => 192.168.1.1, foghostname2=> 192.68.1.2, etc…)

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        T 1 Reply Last reply Reply Quote 1
        • Wayne WorkmanW
          Wayne Workman
          last edited by Wayne Workman

          Agree with Tom. This is why DHCP was created - to address machines for you. If you want machines to always have the same IP address, use DHCP reservations.

          Trying to create a snapin that sets IPs for you is basically like trying to recreate DHCP but in a really bad and likely to fail way.

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
          Daily Clean Installation Results:
          https://fogtesting.fogproject.us/
          FOG Reporting:
          https://fog-external-reporting-results.fogproject.us/

          T 1 Reply Last reply Reply Quote 0
          • george1421G
            george1421 Moderator @Turcotter
            last edited by

            @turcotter Someone who is doing something similar, where you might get an idea or two don’t follow the title, the action is the same none the less: https://forums.fogproject.org/topic/11474/problem-to-mapping-network-drive-using-snapin-with-batch-file

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

            T 1 Reply Last reply Reply Quote 0
            • T
              Turcotter @Tom Elliott
              last edited by

              @tom-elliott The problem with that is that we have sort of a special use case. We use our laptops as mobile kiosks for tradeshows and conventions and are unable to use a separate DHCP server per many convention centers and venues guidelines. Also for several security conferences the kiosks cannot be physically connected to the internet so DHCP just isn’t an option. The script idea was going to be my last resort since it will get pretty long and unwieldy after 600 or so laptops are added.

              Tom ElliottT Wayne WorkmanW 2 Replies Last reply Reply Quote 0
              • T
                Turcotter @Wayne Workman
                last edited by

                @wayne-workman Thanks for the input I replied to Tom to explain why DHCP is not an option I was just wondering if there was a more automated way of doing this. Any ideas?

                1 Reply Last reply Reply Quote 0
                • T
                  Turcotter @george1421
                  last edited by

                  @george1421 Thanks for the link this is very familiar to the first link i provided in my first link. This seems almost perfect I just get confused setting up the .CSV. I know I can put it somewhere on the server to share it to the clients but do I not put headers in the .CSV. Do you have an example of a .CSV setup? Thanks again!

                  george1421G 1 Reply Last reply Reply Quote 0
                  • Tom ElliottT
                    Tom Elliott @Turcotter
                    last edited by

                    @turcotter if you follow the first article, they just created a csv of all the hosts and assigned the ip as another field. All the snapin does is look at that csv after getting the hostname.

                    So I’m not seeing how you would need 600 separate scripts.

                    If you’re willing to take the time to apply a “proper” ip through fog, why aren’t you willing to make a csv file containing the information? To me the csv is faster and simple. Doing through the GUI could be done, but you’d need to do edit each host individually. While it could be done through fog, functionally speaking fog does not have a feature such as requested. Yours and the other posting from 2013 you found are the only two cases I’ve seen needing this functionality. The snapin csv setting still sounds the easiesy method, even if fog did have this functionality.

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    T 1 Reply Last reply Reply Quote 0
                    • Wayne WorkmanW
                      Wayne Workman @Turcotter
                      last edited by Wayne Workman

                      @turcotter said in Change Static IPs:

                      Also for several security conferences the kiosks cannot be physically connected to the internet

                      If it’s a traveling laptop without internet access, how is the laptop going to get a snapin from FOG? If you plan on having a intranet at the conferences (offline network) that includes a FOG Server, why not have FOG do DHCP for you?

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                      Daily Clean Installation Results:
                      https://fogtesting.fogproject.us/
                      FOG Reporting:
                      https://fog-external-reporting-results.fogproject.us/

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        Turcotter @Tom Elliott
                        last edited by

                        @tom-elliott I agree that the CSV file would be ideal and the fastest method however I was unsure how to setup the file and was trying to find an example to better understand. Should I just leave all headers blank and just list column A=Hostname Column B = IP Column C= Sunbet and so on? Thanks for your help again.

                        Tom ElliottT 1 Reply Last reply Reply Quote 0
                        • Tom ElliottT
                          Tom Elliott @Turcotter
                          last edited by

                          @turcotter I think, if you make a csv and the snapin uses power shell, having headers would make you life a lot easier. Ultimately the csv could be something like:

                          hostname,ip
                          Foghostname1,192.168.1.1
                          Foghostname2,192.168.1.2
                          

                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                          1 Reply Last reply Reply Quote 1
                          • T
                            Turcotter @Wayne Workman
                            last edited by

                            @wayne-workman I don’t want to get too off topic but all imaging and management is done in our office and then they are shipped to these conferences and are on their own LAN.

                            Wayne WorkmanW 1 Reply Last reply Reply Quote 1
                            • george1421G
                              george1421 Moderator @Turcotter
                              last edited by george1421

                              @turcotter TBH, I did not look at the first script. I just did take a peek and this should work for you. I just got rid of the intents.

                              @Echo Off
                               
                              Set csv=\\Server\Share\pcsetup\ipchanger\ComputerList.csv
                              for /f “skip=1 delims=, tokens=1-7” %%a in (%csv%) do (
                               if /I “%computername%”=="%%a" (
                               
                               netsh int ipv4 set address “Local Area Connection” static %%b %%c %%d
                               netsh int ipv4 set dnsserver “Local Area Connection” static %%e
                               netsh int ipv4 add dnsserver “Local Area Connection” %%f
                               netsh int ipv4 add dnsserver “Local Area Connection” %%g
                               
                               )
                              )
                              REM Pause
                              Echo On
                              

                              Now for the csv file. It looks like it takes on this form from the script

                              computer_name, ip_addr, subnet_mask, gateway,dns_server1, dns_server2, dns_server3
                              computer1, 192.168.1.20,255.255.255.0,192.168.1.1,192.168.1.50,192.168.1.52,192.168.1.55
                              

                              No need for headers unless a human needs to read it. The script will look for a line that matches the current computer name in the .csv file and then set the parameters accordingly.

                              Just be aware you will have the same issue as the OP of the thread I linked, the snapin runs as the SYSTEM user, which is a local admin user that has no domain rights. You will need to map a drive to the remove CSV file, or just include it with the snapin then not need to worry about connecting to an external share.

                              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                              T 1 Reply Last reply Reply Quote 0
                              • Wayne WorkmanW
                                Wayne Workman @Turcotter
                                last edited by Wayne Workman

                                @turcotter said in Change Static IPs:

                                they are shipped to these conferences and are on their own LAN.

                                You could send a small desktop/raspberry pi with them to serve as a DHCP server. If you’re sending the switch, you could send a managed switch that does DHCP. If it’s not your LAN, you could request that the LAN have DHCP available. Just ideas.

                                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                                Daily Clean Installation Results:
                                https://fogtesting.fogproject.us/
                                FOG Reporting:
                                https://fog-external-reporting-results.fogproject.us/

                                1 Reply Last reply Reply Quote 0
                                • T
                                  Turcotter @george1421
                                  last edited by

                                  @george1421 Thanks for the reply I took what you said and did some test to try and get it to run and I thought I had solved it but it still doesnt change the IP. It was always my understanding that the SYSTEM had higher access than a normal admin account. I saw in the post you linked me that I could specify the user within the batch file? It runs fine when I just run it as admin without launching as a snapin. Any advice?

                                  george1421G 2 Replies Last reply Reply Quote 0
                                  • george1421G
                                    george1421 Moderator @Turcotter
                                    last edited by

                                    @turcotter The issue in the link is that SYSTEM does have local admin rights, but it can’t reach outside of the box to pickup the csv file. If you connect to the remote share as a domain user then you can access the central csv file.

                                    The other method is to deliver the csv file with the batch file.

                                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                    1 Reply Last reply Reply Quote 0
                                    • george1421G
                                      george1421 Moderator @Turcotter
                                      last edited by george1421

                                      @turcotter So if you were to take my script and change it this way.

                                      net use w: \\Server\Share /user:domain\user password
                                      Set csv=w:\pcsetup\ipchanger\ComputerList.csv
                                      if not exist %csv% echo "Unable to access csv file" >c:\windows\temp\ipset_error.txt
                                      
                                      for /f “skip=1 delims=, tokens=1-7” %%a in (%csv%) do (
                                      

                                      and then at the end remove the mapping to the w: drive

                                      net use w: /delete
                                      

                                      Warning: I did not test or debug this but just wrote off the top of my head. But the idea is that if the script can’t reach the csv file it will create a flag file ip_set_error in c:\windows\temp directory.

                                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                      T 1 Reply Last reply Reply Quote 0
                                      • T
                                        Turcotter @george1421
                                        last edited by

                                        @george1421 Alright thanks for your help but I have to take a few steps back i guess I am trying to just run a simple batch file to confirm that at least my snapin configuration is correct and even that isn’t wokring properly. I am trying to run this batch file:

                                        ECHO BATCH > C:\Users\REG\Desktop\BATCH_LOG.txt

                                        and even this isn’t working and is just failing at “MIddleware:: Authentication Waiting for authentication timeout to pass”

                                        Thanks for your help again I know this is starting to drag on. Is there any in depth literature on this sort of thing I can’t really seem to find any.

                                        george1421G 1 Reply Last reply Reply Quote 0
                                        • george1421G
                                          george1421 Moderator @Turcotter
                                          last edited by

                                          @turcotter Here is 3 different ways you could do this with powershell and a fog snapin. Reply #2 is interesting since it embeds the csv file right into the powershell script.

                                          We can only offer ideas based on how the snapin system works since we have not / do not assign static IP addresses this way to hosts. I’m not saying its wrong, only we don’t have the experience doing this.

                                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                                          1 Reply Last reply Reply Quote 0
                                          • 1 / 1
                                          • First post
                                            Last post

                                          153

                                          Online

                                          12.0k

                                          Users

                                          17.3k

                                          Topics

                                          155.2k

                                          Posts
                                          Copyright © 2012-2024 FOG Project