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).
usb0
in stead of an IP Address – WoJo Apr 23 '20 at 11:22raspberrypi.local
- I rarely use anything else? You still haven't said what the IP address is ( post output ofip a
) – Milliways Apr 23 '20 at 11:29raspberrypi.local
for everything that needs an IP Address. Also, the IP Address is:169.254.xxx.xxx
where all thex
change after every reboot. – WoJo Apr 23 '20 at 11:37