0

I recently bought a Raspberry Pi 2B and was setting it up. I was told to make the IP static by changing the line

iface eth0 inet dhcp

However, the IP config file did not contain the word dhcp anywhere. It looked something like this

 # Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
 Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

Then I changed it to this:

 # Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet static
 address 192.168.1.121
 network 192.168.1.0
 netmask 255.255.255.0
 broadcast 192.168.1.255
 gateway 192.168.2.1

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
 Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

I tried to change manual to static, but nothing worked. Can someone please tell me what to do?

WIR3D
  • 101
  • 2

1 Answers1

1

For a static ip configuration, change the line

iface eth0 inet manual

in /etc/network/interfaces to

iface eth0 inet static
address 192.168.0.97   
netmask 255.255.255.0  
gateway 192.168.0.1

For a dynamic ip configuration, use dhcp to automatically assign a ip adress to your raspberry pi and change the line to

iface eth0 inet dhcp
Fr3ak1n0ut
  • 11
  • 2