HOW TO SETUP STATIC IP ADDRESS ON RASPBERRY PI

Configuring Network Settings to setup a static IP address on Raspberry Pi


Connecting to your Raspberry Pi without a HDMI display ?  You’ll need its IP address to connect. There are two main forms, static and dynamic. By default, Raspberry Pi will be configured with a dynamic IP address.

Dynamic IP address can change each time you reboot or restart the services, not ideal if you are running Raspberry Pi headless, so you need to keep checking the IP address and connect.

Static IP address is somewhat permanent, it won’t change. So you know your IP address.

To setup a static IP address,

1. Check your IP

  •  sudo ifconfig

pi@raspberrypi:~$ ifconfig

eth0      Link encap:Ethernet  HWaddr 08:00:27:E5:E0:11

          inet addr:192.168.0.106  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fee5:e011/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:104 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:23642 (23.0 KiB)  TX bytes:10224 (9.9 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:42 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3687 (3.6 KiB)  TX bytes:3687 (3.6 KiB)

2. Edit interfaces

  • sudo nano /etc/network/interfaces
    It'll look something like this.

GNU nano 2.8.5            File: /etc/network/interfaces                       
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
iface usb0 inet dhcp
auto eth0
iface eth0 inet dhcp

     Edit the line that starts with iface eth0 inet.
     For static IP settings, change the line to:
  • iface eth0 inet static
    Add these lines for address, netmask, and gateway.

iface eth0 inet static    
 address 192.168.1.150    
 netmask 255.255.255.0    
 gateway 192.168.1.1

    For static IP ,
    1. The value of the subnet mask must be the same for all devices on the network.
    2. The value of the IP address must be unique for each device on the network.
For example, if the Ethernet port on your host computer has a network mask of 255.255.255.0 and  a static IP address of 192.168.1.2, set:
  •         Set netmask to use the same network mask value, 255.255.255.0.
  •         Set address to an unused IP address, between 192.168.1.3 and 192.168.1.254.
 Save the changes and exit.

Press Ctrl+X. Enter Y to save and press Enter.

Reboot your Pi.






USB TETHERING ON RASPBERRY PI

INSTALL X11VNC ON KALI LINUX RASPBERRY PI

ENABLE AUTOSTART FOR X11VNC

 



 


Comments

Popular posts from this blog

INSTALL TIGHTVNC ON KALI LINUX RASPBERRY PI

ENABLE AUTOSTART FOR X11VNC

INSTALL X11VNC ON KALI LINUX RASPBERRY PI