nike2
Posts: 1
Joined: Tue Apr 02, 2019 1:27 pm

cannot remove static ip address and gateway from raspberrypi2

Tue Apr 02, 2019 1:42 pm

Sir
My Raspberrypi2's ip and gateway cannot be remove from it interface ...all information below....please help to solve.......

i want to remove 192.168.137.48 and set 192.168.0.106 .. my router's configuration has been changed to 192.168.0.1 as gateway address..

ifconfig -a
eth0 Link encap:Ethernet HWaddr b8:27:eb:b7:cb:1c
inet addr:192.168.137.48 Bcast:192.168.137.255 Mask:255.255.255.0
inet6 addr: fe80::ba27:ebff:feb7:cb1c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:101 errors:0 dropped:0 overruns:0 frame:0
TX packets:187 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8366 (8.1 KiB) TX bytes:72437 (70.7 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:65536 Metric:1
RX packets:137 errors:0 dropped:0 overruns:0 frame:0
TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:13070 (12.7 KiB) TX bytes:13070 (12.7 KiB

--------------------------------

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

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

auto lo

iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

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

#auto wlan1
#allow-hotplug wlan1
#iface wlan1 inet manual
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

---------------------------------------------------------
interface eth0
static ip_address=192.168.0.106/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8

hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
static domain_search=

Andyroo

Re: cannot remove static ip address and gateway from raspberrypi2

Tue Apr 02, 2019 4:29 pm

Did you set a static IP address on the Pi or is it getting it from the router?

First place to check is the router and see if it has a MAC address / IP reservation for the Pi.

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: cannot remove static ip address and gateway from raspberrypi2

Tue Apr 02, 2019 4:39 pm

What is in your dhcpcd.conf? The answer to your question is in your post, unless you set a static ip in your router configuation and somehow forgot about it.
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
Two heads are better than one, unless one's a goat head.

Andyroo

Re: cannot remove static ip address and gateway from raspberrypi2

Tue Apr 02, 2019 4:47 pm

default_user8 wrote:
Tue Apr 02, 2019 4:39 pm
What is in your dhcpcd.conf? The answer to your question is in your post, unless you set a static ip in your router configuation and somehow forgot about it.
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
Good point :oops:

PhatFil
Posts: 1705
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: cannot remove static ip address and gateway from raspberrypi2

Tue Apr 02, 2019 5:01 pm

change

Code: Select all

static ip_address=192.168.0.106/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8
to

Code: Select all

#static ip_address=192.168.0.106/24
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8
or just delete it.. Also comment out remaining text below it too (not in my file..???) if needed you can uncomment it back but as its a list of unset options ....

User avatar
DougieLawson
Posts: 40810
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: cannot remove static ip address and gateway from raspberrypi2

Tue Apr 02, 2019 5:35 pm

What's all that junk you've added to /etc/network/interfaces did you fail to read the rubric at the top of that file (which paraphrased says "Don't add stuff to this file.").
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Return to “Troubleshooting”