Hi all, the first thing you should probably consider when setting up a gaming server is how to set a Static IP address for your Raspberry Pi. Let’s get into it.
Step One: SSH into your RP and find the current IP address.
ssh pi@yourpiname
hostname -I
Step Two: Find your router’s gateway IP address.
ip r | grep default
Step Three: Find your router’s DNS IP Address
sudo nano /etc/resolv.conf
Step Four: Add Static IP Settings.
Now you should have all the info you need to make your Static IP. Next, we’ll edit the dhcp.conf file.
sudo nano /etc/dhcpcd.conf
Scroll to the bottom and put in the information you just gathered, along with your preferences.
interface = wlan or eth cable
static ip_address = whatever you want your new IP to be. I recommend something between 192.168.1.2-192.168.1.250
static routers = your gateway IP address
static domain_name_servers = your static DNS address
This is just an example of what you could do, make it to your preferences and make sure it matches the info you collected above.
interface eth0
static ip_address=192.168.1.120/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.254
Make sure to do ctrl+x to save changes, press y for yes and press enter to exit.
Step Five: Reboot the RP to enact changes.
sudo reboot
Step Six: Check your hostname to see the effects have taken place.
hostname -I
You should now see the static IP you set up in your dhcp.conf file. Congrats! You’ve set up a Static IP for Raspberry Pi!