Skip to content

Setting Static IP address for Raspberry Pi, by Sayed Maheen Basheer

Helena Barmer edited this page Aug 19, 2019 · 1 revision

Setting Static IP address for Raspberry Pi- Sayed Maheen Basheer


For Federated Learning Using Raspberry Pi- You will be connecting raspberry pi's using ssh; Sometimes it seems the connection with pi's can't be attained through ssh command. This may be due to change in IP address of your raspberry pi's from previous setup. You will probably be changed the hostname for worker once in raspberry pi and wondering why it is not working like before; so we need to setup static IP address for raspberry pi's: Here I will provide the solution to setup static IP address for both wireless and ethernet connections. Sometimes you configure the setup for ethernet only, but if your wifi is open, raspberry pi may connect to wifi and cause identification problem: So follow simple steps provided below->

Step 1: Type:

       sudo nano /etc/dhcpcd.conf , 

     if you need to open other text editor (eg: vim) 
     try: 

       sudo vim /etc/dhcpcd.conf

Step 2: Alter these lines and leave the rest:

   interface eth0                               //for ethernet connection
   static ip_address=10.1.1.30/24               //static ip address for Raspberry Pi
   static routers=10.1.1.1                      //Your Router Ip address
   static domain_name_servers=10.1.1.1            //Your Router Ip address

   interface wlan0                              //for wireless connection
   static ip_address=10.1.1.31/24                //static ip address for Raspberry Pi
   static routers=10.1.1.1                        //Your Router Ip address
   static domain_name_servers=10.1.1.1           //Your Router Ip address

if you can't find these lines to alter; then Append those below

Step 3: Write these lines to file by Ctrl + O ->Press 'Enter' ->then Ctrl + X

Step 4: sudo reboot