LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't ping local device, and can't change it's static IP (https://www.linuxquestions.org/questions/linux-newbie-8/cant-ping-local-device-and-cant-change-its-static-ip-4175561155/)

NotionCommotion 12-10-2015 12:16 PM

Can't ping local device, and can't change it's static IP
 
I have a Raspberry Pi, and wrote an iso to it which included the entire operating system. It is running Debian, and as far as I could tell, it doesn't have iptables, and I don't know if it has another firewall. When directly interfacing to the device with a keyboard/monitor, I could ping other devices on my network.

ping 192.168.1.200 >

Code:

PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data.
64 bytes from 192.168.1.200: icmp_req=1 ttl=63 time=289 ms
64 bytes from 192.168.1.200: icmp_req=2 ttl=63 time=1.34 ms
64 bytes from 192.168.1.200: icmp_req=3 ttl=63 time=3.99 ms
64 bytes from 192.168.1.200: icmp_req=4 ttl=63 time=1.36 ms

--- 192.168.1.200 ping statistics ---
4 packets transmitted, 4 received, 0 packet loss, time 3003ms
rtt min/avg/max/mdev = 1.344/74.011/289.344/124.327 ms

But from other devices, I can't ping it. Below are the original settings of the device. Since I can't connect, I can't ssh into it, so I just locally ran the commands and directed them into a file.

service networking restart >>

Code:

Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces ... (warning).
Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b8:27:eb:77:55:11
Sending on  LPF/eth0/b8:27:eb:77:55:11
Sending on  Socket/fallback
DHCPRELEASE on eth0 to 172.27.35.1 port 67
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b8:27:eb:77:55:11
Sending on  LPF/eth0/b8:27:eb:77:55:11
Sending on  Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 172.27.35.1
DHCPACK from 172.27.35.1
bound to 172.27.35.150 -- renewal in 16799 seconds.
done.

ifconfig >>

Code:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:77:55:11 
          inet addr:172.27.35.150  Bcast:172.27.35.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fe77:5511/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:387 errors:0 dropped:0 overruns:0 frame:0
          TX packets:589 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:28133 (27.4 KiB)  TX bytes:51018 (49.8 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:84 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8792 (8.5 KiB)  TX bytes:8792 (8.5 KiB)


/etc/network/interfaces

Code:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

# iface eth0 inet static
#    address  192.168.1.100
#    netmask  255.255.255.0
#    network  192.168.1.0
#    broadcast 192.168.1.255
#    gateway  192.168.1.1

/etc/resolv.conf

Code:

nameserver 172.27.35.1
/etc/hostname

/etc/hosts

Code:

127.0.0.1    localhost
127.0.1.1    cbmsstudio
# 192.168.1.100  cbmsstudio


Next, I tried to change the static ip to 192.168.1.100, but now eth0 doesn't exist. The first time I restarted the network after making the changes, it responded with the following (might be slightly off as I had to take a picture of it and then OCR the picture)
Code:

root@cbrisstudio:-O /etc/init.d/networking restart > aaa 2>&1
[ 2736.091463] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[ 2736.109125] IPu6: ADDRCOMF(METDEV_UP): eth0: link is not ready root
root@cbmsstudio: ~# [2737.542868] IPu6: ADDRCOMF(METDEU_CHAMGE): eth0: link becomes ready
[2737.560216] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, Ipa Ox41E1


/etc/network/interfaces

Code:

auto lo
iface lo inet loopback

#auto eth0
#iface eth0 inet dhcp

iface eth0 inet static
    address  192.168.1.100
    netmask  255.255.255.0
    network  192.168.1.0
    broadcast 192.168.1.255
    gateway  192.168.1.1

/etc/resolv.conf

Code:

#nameserver 172.27.35.1
nameserver 8.8.8.8
nameserver 8.8.4.4

/etc/hosts

Code:

127.0.0.1    localhost
#127.0.1.1    cbmsstudio
192.168.1.100  cbmsstudio

ipconfig >

Code:

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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

When I set /etc/network/interfaces back to using "auto eth0" and "iface eth0 inet dhcp", it automatically goes back to it's original 172.27.35.150 IP. Where might this be set if not in /etc/network/interfaces?

Why am I not be able to ping it using it's original 172.27.35.150? Why is eth0 available?

Thanks

ButterflyMelissa 12-10-2015 12:48 PM

ignoring pings?
 
One idea..(I read the post "diagonally" so sorry if I glossed over one or two details...) is that it ignores pings...or more precisely: does NOT respont to pings...
Try this (as root) on the device

Code:

sysctl -w net.ipv4.icmp_echo_ignore_all=0
net.ipv4.icmp_echo_ignore_all = 0

...this should restore the desire to reply to a ping :)
Melissa

NotionCommotion 12-10-2015 01:01 PM

Thanks Melissa,

Tried both, but the second results in an error (command not found).


If you see the ifconfig, there is no eth0, so I don't think it has anything to do with not pinging.

Ah, let me go back to the original ip and try that command... EDIT. Nope, restored to the original 172.27.35.150 IP, and can't ping it. Where is that IP address defined on debian? I thought it was always on /etc/network/interfaces or /etc/hosts

suicidaleggroll 12-10-2015 01:15 PM

That IP is not defined anywhere on the RPi, it's coming from your DHCP server at 172.27.35.1.

Try getting rid of the network and broadcast lines in your static config, you only need address, netmask, and gateway. Then use "ifdown eth0" and "ifup eth0". You can also put the DNS servers in the interfaces file. This is the interfaces file on one of my RPis running Raspbian:

Code:

$ cat /etc/network/interfaces
auto lo

iface lo inet loopback
iface eth0 inet static
  address 192.168.1.10
  netmask 255.255.255.0
  gateway 192.168.1.1
  dns-nameservers 208.67.222.222 208.67.220.220

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


ButterflyMelissa 12-10-2015 01:22 PM

oookay, what I try after a new set up it ping the machine tru the loopback (127.0.0.1) ansd see if the IP stack is okay...
So, after actually READING the post :P here's what worries me...
per ifconfig on the device...
Quote:

inet addr:172.27.35.150 Bcast:172.27.35.255 Mask:255.255.255.0
Let's see where we stand, you are in a class C network, I assume, where all the IP addresses start with 192.168.1.x, where the x is one between 2 and 255, where 192.168.1.1 is assumed to be the modem/router...
I doubt device 1 (192.168.1.5) could ping device 2 (127.16.1.1)...
let's "sincronise" this first...
Melissa

NotionCommotion 12-10-2015 01:34 PM

Quote:

Originally Posted by suicidaleggroll (Post 5462509)
That IP is not defined anywhere on the RPi, it's coming from your DHCP server at 172.27.35.1.

Try getting rid of the network and broadcast lines in your static config, you only need address, netmask, and gateway. Then use "ifdown eth0" and "ifup eth0". You can also put the DNS servers in the interfaces file. This is the interfaces file on one of my RPis running Raspbian:

Ah, it is coming from DHCP. Guess that makes sense.

Tried your /etc/network/interfaces setup, and like my previous one, eth0 just doesn't exist anymore. I get this "hardware isn't capable of remote wakeup" error when restarting the network (see my edited original post).

NotionCommotion 12-10-2015 01:36 PM

I can ping through it loopback.

Yes, you've identified my network type properly.

I was concerned that device 1 (192.168.1.5) couldn't ping device 2 (127.16.1.1), so tried to change the IP, but that is failing.

ButterflyMelissa 12-10-2015 01:39 PM

Quote:

I can ping through it loopback.
Check one : network stack is alive, good...
Quote:

Yes, you've identified my network type properly.
Hehe :)
Quote:

I was concerned that device 1 (192.168.1.5) couldn't ping device 2 (127.16.1.1), so tried to change the IP, but that is failing.
Correct, these two cannot ping each other, that's why networks have...bridges :)
What IP did you give device 2? I'd go for 192.168.1.6, just to try things...
Melissa

suicidaleggroll 12-10-2015 01:40 PM

Quote:

Originally Posted by NotionCommotion (Post 5462517)
Ah, it is coming from DHCP. Guess that makes sense.

Tried your /etc/network/interfaces setup, and like my previous one, eth0 just doesn't exist anymore. I get this "hardware isn't capable of remote wakeup" error when restarting the network (see my edited original post).

It exists, it's just not configured, and by default ifconfig doesn't display unconfigured devices. Use "ifconfig -a" to show it.

That remote wakeup message is not an error, it's just a harmless notification that you get every time eth0 is brought up.

I see you're redirecting all output of "/etc/init.d/networking restart" to a file, why is that? What are the contents of this file? If the network is not coming back up correctly, step one is to look at the output of this command to see why.

malekmustaq 12-10-2015 01:46 PM

You cannot ping because the interface is bound to a network but the gateway in the route table does not belong to that network. They don't belong to the same network. This commonly occurs when the router is not configured to bridge. You may try launch browser and access your router 192.168.1.1 and from there configure it On as bridge. Or you may try if fixing the interface into the internet gateway may work:

Code:

# route add default gw 172.27.35.1 eth0
(if that is not the gateway ip you may call the provider what is the gateway ip.

Try to ping the gateway and any of your DNS. If it works, then good.

Hope that helps. Goodluck.

m.m.

NotionCommotion 12-10-2015 01:47 PM

Quote:

Originally Posted by suicidaleggroll (Post 5462521)
I see you're redirecting all output of "/etc/init.d/networking restart" to a file, why is that? What are the contents of this file? If the network is not coming back up correctly, step one is to look at the output of this command to see why.

Because the only way I can post anything at LinuxQuestions is redirect it to a file on a USB, and move it to my PC.

NotionCommotion 12-10-2015 01:47 PM

Quote:

Originally Posted by thor_2.0 (Post 5462520)
what ip did you give device 2? I'd go for 192.168.1.6, just to try things...

192.168.1.222

suicidaleggroll 12-10-2015 01:48 PM

Quote:

Originally Posted by NotionCommotion (Post 5462526)
Because the only way I can post anything at LinuxQuestions is redirect it to a file on a USB, and move it to my PC.

Ok, well what's in the file?

Also, did you try "ifdown eth0" "ifup eth0" as I suggested earlier?

ButterflyMelissa 12-10-2015 01:57 PM

Quote:

192.168.1.222
Hmm..okay, on to the netmasks...they have to be the same, as well as the broascast...let's check this...
A good example

Quote:

inet 192.168.1.222 netmask 255.255.255.0 broadcast 192.168.1.255
All neatly INSIDE the network shell...

Melissa
Edit - what is the IP address of your router/modem?

NotionCommotion 12-10-2015 01:58 PM

Quote:

Originally Posted by suicidaleggroll (Post 5462528)
Ok, well what's in the file?

Also, did you try "ifdown eth0" "ifup eth0" as I suggested earlier?

Oh, sorry,

Code:

Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces ... (warning).
Reconfiguring network interfaces...done.

I tried "ifdown eth0", but not sure if I tried "ifup eth0". I should have done so! Now ifconfig shows eth0. Still can't ping from another computer, and now it can't ping out as well.


All times are GMT -5. The time now is 09:39 PM.