0

I'm using a CAT6 cable to connect my RPi 2 to D-Link ADSL Modem. But I can't!

Here are what I've already tested:

When the system is up, I run:

ping google.com

it says:

ping: unknown host google.com

Then I type:

ping 192.168.1.1

it says:

connect: Network is unreachable

Then I type:

route

or

route -n

it says:

Kernel IP routing table
Destination    Gateway    Genmask    Flags Metric Ref    Use Iface

Then I type:

ifconfig

it says:

#

actually it doesn't say anything!!


And here is the content of /etc/network/interfaces :

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

# iface eth0 inet static
# address 192.168.1.88
# netmask 255.255.255.0
# gateway 192.168.1.1
# network 192.168.1.0

I also uncommented the last lines of this file, so it looked like this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

iface eth0 inet static
address 192.168.1.88
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0

Then I rebooted the system; but it didn't work!


I tested the LAN cable on my laptop; it works fine.


By the way, I'm using RPi 2, which has Minibian installed on it. Minibian is a minimal version of Raspbian.


So, what should I do to connect to the internet?



Update 1

Here are some other tests:

I type:

lspci | grep Ethernet

it says:

-bash: lspci: command not found

I type:

ping 127.0.0.1

it says:

connect: Network is unreachable

In /etc/network/interfaces , I commented the iface eth0 inet dhcp , and uncommented the others. But it didn't change anything.


I type:

ifconfig -a

it says:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:7f:c1:5f
          BROADCAST MULTICAST  MTU:1500  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:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          LOOPBACK 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)


Update 2

Here are some additional tests:

I type:

ifconfig lo up
ifconfig eth0 up

and then I type:

ifconfig

it says:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:7f:c1:5f
          inet6 addr: fe80::ba27:ebff:fe7f:c15f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:556 (556.0 B)

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)

Then I type:

ping 127.0.0.1

and it worked! it sent and received several packages. However, ping 192.168.1.1 or other pings still don't work.



Update 3

More tests:

I type:

ifconfig eth0

it says:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:7f:c1:5f
          inet6 addr: fe80::ba27:ebff:fe7f:c15f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:623 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:48742 (47.5 KiB)  TX bytes:556 (556.0 B)
8
  • Any RX/TX lights on the Pi? (Indicating that it sees the Ethernet cable as active?) Also if you uncomment the eth0 inet static, you must comment out the eth0 inet dhcp.
    – Butters
    Dec 3, 2015 at 16:53
  • Thanks @Butters for your comment. Yes, the LEDs are blinking on the RPi LAN port.
    – Omid1989
    Dec 3, 2015 at 16:58
  • 1
    try lspci | grep Ethernet to see if the system recognizes your Ethernet card. Also have you tried Rasbian that was compiled for the Pi2? Personally, I cant think of a reason to have a 'more cutdown' distro of Linux, just run it without a GUI.
    – Butters
    Dec 3, 2015 at 17:08
  • I have tested Raspbian before. The boot time is the main reason I installed Minibian. It boots in max. 15 seconds. I'll try your suggestion.
    – Omid1989
    Dec 3, 2015 at 17:17
  • 1
    the fact that ifconfig shows nothing at all is very odd, you'd at least have lo ... does ping 127.0.0.1 work? It's like no networking modules are installed. try ifconfig -a - that should show even disabled interfaces Dec 3, 2015 at 23:18

2 Answers 2

1

try setting your network/interfaces file to

auto lo

iface lo inet loopback

auto eth0
iface eth0 inet dhcp

after you edit the file, if you're running jessie, you may need to run

sudo systemctl daemon-reload

edit:

ifconfig lo up
ifconfig eth0 up
ifconfig

they should show without the -a now

note: this wont fix the problem, I just want to see if the interfaces come up (and stay up) when you force them to be up

Something else is bringing them down - output of dmesg command bay be useful to see what's happening during boot

after update 3:

change /etc/network/interfaces to

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static
address 192.168.1.88
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0

Assuming your router is 192.168.1.1

16
  • Thanks @JaromandaX for your answer. I edited the /etc/network/interfaces to what you said. But it didn't work. I rebooted the system. It didn't work again. I typed systemctl daemon-reload , but it said bash: command not found !!
    – Omid1989
    Dec 5, 2015 at 8:29
  • so you're not running jessie Dec 5, 2015 at 8:30
  • 1
    I've added something to the answer Dec 5, 2015 at 8:35
  • 1
    There's still the problem of what is bringing the network DOWN in the first place - that's unusual behaviour - though, minibian may be doing that deliberately!! Dec 5, 2015 at 9:06
  • 1
    ` After reboot, I have to type` - definitely something is forcing network down on boot Dec 5, 2015 at 9:39
0

Well, it seems that the networking service had to be enabled manually!

So I did:

/etc/init.d/networking start

And voila! It worked :D

1
  • 1
    Glad you got it going. You should be able to run the command update-rc.d networking enable to make it auto start on boot.
    – Butters
    Dec 7, 2015 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.