I am trying to give my pi zero a static IP. The pi zero is connected via a single USB connection into my PC. The reason why I want this is because I want to create a server-client program (Server runs on PC & Client runs on Pi). To connect to my Pi via my PC I need an IP Address. I have found my IP Address on my Pi but it changes after every reboot (So does my MAC Address). I hope this isn't off topic. Thanks

EDIT: As requested I will now explain what I have done: I have flashed a fresh image of Rasbian Lite on my Pi zero. Afterwards I changed the config.txt to add this line to the bottem of the file: dtoverlay=dwc2. Then I modified the the cmdline.txt file to add this line after rootwait: modules-load=dwc2,g_ether. I then created a file named ssh to enable ssh connections to my Pi. I then inserted the SD Card into my pi and connected an USB cable from the USB Port (the closest one to the board) into my PC. I am now able to connect to my pi using pi@raspberrypi.local or raspberrypi.local as IP Address. I am also able to connect to my pi by using the IP Address found by typing ifconfig into the command line. My question is: How do I make the IP I find by typing ifconfig a static IP Address which doesn't change after every reboot (Which it does now).

  • It is possible to assign a Static IP Address (although IMO unnecessary), but if you want any detailed answer you need to explain what you have done - at the moment this is vague, and you have provided no detail. – Milliways Apr 23 at 11:13
  • @Milliways I have added more information on what I have done and what my goal is. I hope this clears it up. Also, I checked out the link you mentioned, but that won't work because when I check the gateway address it is usb0 in stead of an IP Address – WoJo Apr 23 at 11:22
  • It seems, based on the additional information that everything is working so I don't see the problem. What is wrong with raspberrypi.local - I rarely use anything else? You still haven't said what the IP address is ( post output of ip a ) – Milliways Apr 23 at 11:29
  • @Milliways the thing is I'm not completely sure I can use raspberrypi.local for everything that needs an IP Address. Also, the IP Address is: 169.254.xxx.xxx where all the x change after every reboot. – WoJo Apr 23 at 11:37
  • 1
    Does this answer your question? How do I set up networking/WiFi/static IP address? Why it does not work for you? What exactly is the instruction that fails? – Ingo Apr 24 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.