I haven't installed a new image for a while and a few days ago I tried to install 2025-12-04-raspios-trixie-arm64-lite.img.xz image in headless mode with static IP because I am not using DHCP.
I thought it would be quick and easy but then I saw a lot of changes have been introduced to the way the image is configured before the first boot since I installed the last image.
I went through quite a few forum posts regarding setting the static IP address before the first boot and I was surprised I couldn't find a single post describing how exactly that could be done.
The only "answers" I could find were:
"That is not the right way of configuring the image." (Is there the right way in ANY situation?)
"You should not use static IP." (Then why does this option even exist?)
"Use DHCP." (I never use DHCP.)
"Log in via hostname." (Not working on Windows.)
"Connect Pi to the monitor and use a keyboard to..." (That's not a solution.)
"Assing an IP in your router's settings using DHCP reservation." (I don't want or am not allowed to change the router setting, I want to configure a static IP on Raspberry Pi.)
"Edit xy file on ext4 partition." (Complicated on Windows.)
and similar which do not address the problem in question - that's why I decided to post the exact procedure to save others' time they would spend reading discussions in which they will not find the right answer.
So if any of these applies:
a) You don't use DHCP at all.
b) You have DHCP but still want to configure a static IP on your Pi before the first boot.
c) You are just curious about how that could be done.
d) You want to be able to move the Pi between different locations where networks are working in the same subnet but you are not allowed to change router settings)
e) ...
here is the solution:
TLDR explanation:
1. Use Raspberry Pi Imager [Note #1] just ONCE, fill the customisation fields and enable SSH.
2. Insert SD card into the computer and paste this (of course, you have to replace xxx, yyy and zzz with your numbers) into the file named network-config:
3. Save the following files so you can next time just copy them to bootfs partition instead of using Raspberry Pi Imager:And that's it! :-)
More detailed explanation:
This was my first time to install Raspberry Pi Imager. I installed it because I thought there is an option to configure a static IP but there isn't. However, the file user-data which is not present in the image itself but is generated by Raspberry Pi Imager (when using customisation options) is important.
After I saw the cloud-init mechanism for making initial configuration was introduced some time ago, I checked the documentation to see the syntax for specifying a static IP address, gateway and DNS in network-config.
If your router's IP is 192.168.1.1, you want to configure static IP address 192.168.1.180 and your DNS server is 192.168.1.120 (e.g. Pi-Hole) then network-config would be:
If you don't have your DNS server then you can under nameservers: use the same IP address as in gateway4: or you can use 8.8.8.8 or some other DNS server and you can specify more than one DNS server as a list, for example: [8.8.8.8, 8.8.4.4]
Once you have the mentioned files you can keep them and next time you want to configure the new image you can just write the image using ANY image burning tool, copy the files into bootfs partition and, if necessary, edit network-config to change the static IP, gateway and DNS servers.
There are a few things about Raspberry Pi Imager I didn't like:
1. There isn't an option to set the location of the downloaded image and the default location (on Windows) is on c: disk. I prefer downloading images to a mechanical disk and c: disk is usually an SSD.
2. Only the very last downloaded image is stored in cache with the generic name and I like to store the images that I use.
3. Customisation of the local stored image in Raspberry Pi Imager 2.0.6 is not possible without creating .json file by running Python script unless you want to customise the very last image that you used. As soon as you want to use another image it overwrites the very last image and if you want to use it again you have to download it one more time. If you want to burn image x then image y and if you then want to again burn image x and then image y you have to download the same images again and again - and all of that to your SSD because you can't configure the download path.
4. Every time I burned the image using Raspberry Pi Imager the bootfs partition in Windows 10 wasn't visible [Note #1] which wasn't the case when I burned the image using Win32DiskImager. If I burn the image with Win32DiskImager there is E: (bootfs) FAT partition which is accessible and F: (ext4) Linux partition which isn't accessible (say "No" to "Format the partition"). On the other hand - if I burn the very same image to the very same SD card with Raspberry Pi Imager then there is only E: (ext4) Linux partition and the only way to access the bootfs FAT partition is to use Disk Management and assign a drive letter to the FAT partition on the SD card. I tried many times and always started with the SD card formatted with SD Card Formatter [Note #2] but each time I burn the image using Raspberry Pi Imager the bootfs (FAT) partition is not visible and I have to use Disk Management to assign a drive letter to the partition while when I burn the image with Win32DiskImager the bootfs (FAT) partition is visible every time.
Because of that, here is how I burn the image and configure static IP in headless mode:
1. Download the image to the mechanical drive (direct download or via torrent) where I store all images that I use(d).
2. Burn the image using Win32DiskImager so I don't have to use Disk Management [Note #1] to be able to access the bootfs partition.
3. Copy meta-data, network-config and user-data to bootfs partition.
4. Edit network-config if necessary.
Note 2:
If by any chance SD Card Formatter doesn't start use Disk Management to remove all volumes from SD card and create a new simple volume.
I thought it would be quick and easy but then I saw a lot of changes have been introduced to the way the image is configured before the first boot since I installed the last image.
I went through quite a few forum posts regarding setting the static IP address before the first boot and I was surprised I couldn't find a single post describing how exactly that could be done.
The only "answers" I could find were:
"That is not the right way of configuring the image." (Is there the right way in ANY situation?)
"You should not use static IP." (Then why does this option even exist?)
"Use DHCP." (I never use DHCP.)
"Log in via hostname." (Not working on Windows.)
"Connect Pi to the monitor and use a keyboard to..." (That's not a solution.)
"Assing an IP in your router's settings using DHCP reservation." (I don't want or am not allowed to change the router setting, I want to configure a static IP on Raspberry Pi.)
"Edit xy file on ext4 partition." (Complicated on Windows.)
and similar which do not address the problem in question - that's why I decided to post the exact procedure to save others' time they would spend reading discussions in which they will not find the right answer.
So if any of these applies:
a) You don't use DHCP at all.
b) You have DHCP but still want to configure a static IP on your Pi before the first boot.
c) You are just curious about how that could be done.
d) You want to be able to move the Pi between different locations where networks are working in the same subnet but you are not allowed to change router settings)
e) ...
here is the solution:
TLDR explanation:
1. Use Raspberry Pi Imager [Note #1] just ONCE, fill the customisation fields and enable SSH.
2. Insert SD card into the computer and paste this (of course, you have to replace xxx, yyy and zzz with your numbers) into the file named network-config:
Code:
network: version: 2 ethernets: eth0: addresses: [192.168.xxx.yyy/24] gateway4: 192.168.xxx.1 nameservers: addresses: [192.168.xxx.zzz] optional: trueCode:
meta-datanetwork-configuser-dataMore detailed explanation:
This was my first time to install Raspberry Pi Imager. I installed it because I thought there is an option to configure a static IP but there isn't. However, the file user-data which is not present in the image itself but is generated by Raspberry Pi Imager (when using customisation options) is important.
After I saw the cloud-init mechanism for making initial configuration was introduced some time ago, I checked the documentation to see the syntax for specifying a static IP address, gateway and DNS in network-config.
If your router's IP is 192.168.1.1, you want to configure static IP address 192.168.1.180 and your DNS server is 192.168.1.120 (e.g. Pi-Hole) then network-config would be:
Code:
network: version: 2 ethernets: eth0: addresses: [192.168.1.180/24] gateway4: 192.168.1.1 nameservers: addresses: [192.168.1.120] optional: trueOnce you have the mentioned files you can keep them and next time you want to configure the new image you can just write the image using ANY image burning tool, copy the files into bootfs partition and, if necessary, edit network-config to change the static IP, gateway and DNS servers.
There are a few things about Raspberry Pi Imager I didn't like:
1. There isn't an option to set the location of the downloaded image and the default location (on Windows) is on c: disk. I prefer downloading images to a mechanical disk and c: disk is usually an SSD.
2. Only the very last downloaded image is stored in cache with the generic name and I like to store the images that I use.
3. Customisation of the local stored image in Raspberry Pi Imager 2.0.6 is not possible without creating .json file by running Python script unless you want to customise the very last image that you used. As soon as you want to use another image it overwrites the very last image and if you want to use it again you have to download it one more time. If you want to burn image x then image y and if you then want to again burn image x and then image y you have to download the same images again and again - and all of that to your SSD because you can't configure the download path.
4. Every time I burned the image using Raspberry Pi Imager the bootfs partition in Windows 10 wasn't visible [Note #1] which wasn't the case when I burned the image using Win32DiskImager. If I burn the image with Win32DiskImager there is E: (bootfs) FAT partition which is accessible and F: (ext4) Linux partition which isn't accessible (say "No" to "Format the partition"). On the other hand - if I burn the very same image to the very same SD card with Raspberry Pi Imager then there is only E: (ext4) Linux partition and the only way to access the bootfs FAT partition is to use Disk Management and assign a drive letter to the FAT partition on the SD card. I tried many times and always started with the SD card formatted with SD Card Formatter [Note #2] but each time I burn the image using Raspberry Pi Imager the bootfs (FAT) partition is not visible and I have to use Disk Management to assign a drive letter to the partition while when I burn the image with Win32DiskImager the bootfs (FAT) partition is visible every time.
Because of that, here is how I burn the image and configure static IP in headless mode:
1. Download the image to the mechanical drive (direct download or via torrent) where I store all images that I use(d).
2. Burn the image using Win32DiskImager so I don't have to use Disk Management [Note #1] to be able to access the bootfs partition.
3. Copy meta-data, network-config and user-data to bootfs partition.
4. Edit network-config if necessary.
Note 2:
If by any chance SD Card Formatter doesn't start use Disk Management to remove all volumes from SD card and create a new simple volume.
Statistics: Posted by Chupo_cro — Mon Feb 16, 2026 7:12 pm — Replies 3 — Views 80