Raspberry pi is unable to reach gateway - ip

Recently we brought raspberry pi 3b.Beginning we used to access the internet using an ethernet cable and it used to connect properly but now raspberry pi is not able to reach the gateway itself and it's taking its default IP address i.e 169.xxx.xxx.xx.
what would be the issue?we tried to reinstalling the operating system again the same issue .it worked for one day after that same problem.so please help me to solve the issue.

Finally, I am able to figure it out after trial and error method. I have missed "auto eth0" before the iface statement i.e
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
network 255.255.255.0
gateway xxx.xxx.xxx.xxx
dns-nameservers 8.8.8.8

Assuming that you have a windows computer available, open cmd and run the following command:
ipconfig
note down the values that display. Now on your pi, enter the command
sudo nano /etc/network/interfaces
This will open the network interfaces file. Look for the line similar to 'inet eth0 inet manual' Then remove this line and everything to do with the eth0 interface, since we are going to start over.
in the interfaces file, add the following section:
auto eth0
inet eth0 inet static
address xxx.xxx.xxx.xxx
network 255.255.255.0
gateway xxx.xxx.xxx.xxx
dns-nameservers 8.8.8.8
Replace the x in address with the first 3 groups of the value taken from the windows system. For example, if the ip address on the windows system was 192.168.0.221, enter 192.168.0.xxx
The last group of xxx for address should be something unique to everything else on your network.
'gateway' should be whatever the gateway value in windows was (assuming these machines are on the same network)
[Ctrl]+[x], Save changes
reboot via
sudo reboot
once the system has rebooted
ifconfig eth0
should list the new settings. Test them by pinging the below address (google)
sudo ping 8.8.8.8

Related

Raspberry Pi and Edimax 7811UN incompatibility in ad-hoc mode

I am using the Raspberry Pi Model 2 B with 1 GB RAM with the EDIMAX nano USB Adapter. At first I was using NOOBS on the Rapsberry Pi and wanted to set up an ad-hoc network between two such Pi's.
I tried configuring one of the RPi with the same configurations as mentioned below:
#etc/network/interfaces for pi-1
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.50.1
netmask 255.255.255.0
wireless-channel 12
wireless-essid pi-adhoc
wireless-mode ad-hoc
#etc/network/interfaces for pi-2
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.50.2
netmask 255.255.255.0
wireless-channel 12
wireless-essid pi-adhoc
wireless-mode ad-hoc
I have set Pi-1 as a DHCP server (using the ISC-DHCP-Server Daemon) so that I can SSH into the Ad-hoc network to the Pi's for ease of accessibility through my Laptop. The DHCP Server configurations are as follows:
ddns-update-style interim;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
option subnet-mask 255.255.255.0;
option domain-name "pi-adhoc";
subnet 192.168.50.0 netmask 255.255.255.0 {
range 192.168.50.3 192.168.50.150;
}
and then run the daemon
pi-1 ~$ sudo service isc-dhcp-server start
I also force the Pi's to join the ad-hoc network by configuring the rc.local files on both of them as follows:
#! /bin/bash
# For Pi-1 /etc/rc.local
adhocNetwork(){
echo "connecting to ad hoc network"
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid pi-adhoc
iwconfig wlan0 channel 12
ifconfig wlan0 192.168.50.1 netmask 255.255.255.0 up
echo "connected to ad hoc network"
}
adhocNetwork
exit 0
#! /bin/bash
# For Pi-2 /etc/rc.local
adhocNetwork(){
echo "connecting to ad hoc network"
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 essid pi-adhoc
iwconfig wlan0 channel 1
ifconfig wlan0 192.168.50.2 netmask 255.255.255.0 up
echo "connected to ad hoc network"
}
adhocNetwork
exit 0
Inferences
When I use my WiFi on my Laptop and connect to the pi-adhoc network created by the Pi's I get an IP address from the DHCP Server from the pool from Pi-1 and can ssh into the Pi-1 and just to check connectivity I can Ping the laptop from RPi to Laptop and vice versa.
When I try to Ping Pi-2 from Pi-1, it is unreachable and vice versa. But I can connect to the Pi-2 from the Laptop and vice versa.
Scenario: PI-1 <---> Laptop and PI-2 <---> Laptop
but NO connectivity from PI-1 <--/--> PI-2
I cannot connect the Pis together.
I also upgraded the NOOBS to Wheezy using the following:
sudo apt-get update
sudo apt-get dist-upgrade
But the Problem still Exists.
Any help would be appreciated. Thanks.
So finally the connectivity issue has been resolved provided if one does not use the Edimax EW7811UN Wireless Dongle. The problem is related to a driver which is not supported for Linux Kernels past 3.9 versions. The driver specifically is called 802nl11 driver.
An alternate solution which solves the connectivity is using WiFi dongles which have the Ralink RTL5370 drivers in them. I am currently using LogiLink WL0145 Wireless N USB Adapter.
A good check for drivers can be done using lsusbcommand when the USB dongle is connected to the RPi. Now with the same configurations I can ping both the Raspberry Pis.
Inference
There has been a driver compatibility issue with the Model B+ for Raspberry Pis when using Edimax Dongles particularly in Ad-Hoc Mode. Hence it is advisable to switch to other WiFi Dongles when using RPis in Ad-Hoc mode particularly ones with Ralink Technology RT5370 Wireless Adapters.
Check with Jessie
There is still no support for Edimax 7811UN for Ad Hoc mode for Jessie and Jessie Lite 8.0
The issue is that for some reason at least in Debian Jessie 4.1.13-v7+. The RTL8192cu driver does not support broadcasting for the Edimax EW7811UN Wireless Dongle in ad-hoc mode.
However, if ssh-ing between Raspberry Pi is all the functionality you need. You may insert a manual arp entry in your ARP table that prevents the need to perform an ARP Broadcast to resolve a MAC Address to IP Address Association.
In the Raspberry Pi with IP address 192.168.50.1 do this:
arp -s 192.168.50.2 [MAC Address of Wireless Dongle on other Raspberry Pi]
In the Raspberry Pi with IP address 192.168.50.2 do this:
arp -s 192.168.50.1 [MAC Address of Wireless Dongle on other Raspberry Pi]
After you have done this, you should be able to ssh into the Raspberry Pis and ping the Raspberry Pis too. But be aware that for any protocol that requires broadcasting, it will not work on the Edimax EW7811UN Wireless Dongle in ad-hoc mode.
Alternatively, if you'd like a Wireless Dongle that works out of the box in ad-hoc mode. I'd highly recommend TP-Link TL-WN722N. I have tried this and it works.

BeagleBoneBlack with debian. IP cannot be set to static

I've set up my BeagleBoneBlack with Debian Jessi. As default config it worked with a dhcp ip: 192.168.1.105
But I need to configure the system to use a static ip. Therefore I did in /etc/network/interfaces:
auto eth0
iface eth0 inet static
address 192.168.1.50
netmask 255.255.255.0
gateway 192.168.1.1
But after a reboot, still the old IP 192.168.1.105 is set. If I do
/etc/init.d/networking
the new IP is set. But after another reboot, the old one is back again.
Which setting will I have to change to?
I'm not using an additional SD card; Just the eMMC.
Thank you!
Daniel
Finally I found the solution.
An Intel Connection Manager was installed by default. I overwrites my definition.
After removing it, it works fine:
apt-get purge connman

openstack instance getting ip and not getting ip

I am new to openstack and I followed the installation guide of icehouse for ubuntu 12.04/14.04
I chose 3 node architecture. Controller, Nova, Neutron.
The 3 nodes are installed in VM's. I used nested KVM. Inside VM's kvm is supported so nova will use virt_type=kvm. In controller I created 2 nics. eth0 is a NAT interface with ip 203.0.113.94 and eth1 a host only interface with ip 10.0.0.11.
In nova there are 3 nics. eth0 NAT - 203.0.113.23, eth1 host only 10.0.0.31 and eth2 another host only 10.0.1.31
In neutron 3 nics. eth0 NAT 203.0.113.234, eth1 host only 10.0.0.21 and eth2 another hosty only 10.0.1.21 (during installation guide in neutron node i created a br-ex (and a port to eth0) which took the settings of eth0 and eth0 settings are:
auto eth0 iface eth0 inet manual up ifconfig $IFACE 0.0.0.0 up
up ip link set $IFACE promisc on
down ip link set $IFACE promisc off
down ifconfig $IFACE down)
Everything seemed fine. I can create networks, routers etc, boot instances but I have this error.
When I launch an instance it takes a fixed ip but when I log in into instance (cirros) can't ping anything. ifconfig with no ip.
I noticed that in demo-net (tenant network) properties under subnet in the ports field it has 3 ports. 172.16.1.1 network:router_interface active 172.16.1.3 network:dhcp active 172.16.1.6 compute:nova down
I searched for solutions over the net but couldn't find anything!
Any help?
Ask me if you want specific logs because I don't know which ones to post!
Thanks anyway!
Looks like you are using Fixed IP to ping..If so please assign floating IP to your instance, and then try to ping..
If you have already assigned floating IP and you are pinging using that IP..please upload log of your instance

Issue setting static ETH0 IP BeagleBone Black Version C Debian Preloaded

Settings in /etc/network/interfaces seems to have no effect on my BeagleBone Black Version C. I want to set my beaglebone black's ethernet IP address to a static IP as I have done with all my other internet-of-things devices running Debian. I edited /etc/network/interfaces as I have before, but I do not see any changes via ifconfig. This is after a restart of networking AND a restart of the beaglebone. I have googled somewhat, and posted to the beaglebone forums after searching them, and I still do not have a solution. I noticed a commented line in interfaces suggesting that the settings are set via an init script, but this is where I get a little lost. I have moderate knowledge of Debian, but I have not peeled back enough layers apparently. I am connecting my beaglebone black via ethernet connector. WIFI is a beast I will tackle later.
I set my router to reserve a specific IP based on MAC ID, but I would like to know what I am missing here.
iface usb0 inet static
address 192.168.0.103
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
iface eth0 inet static
address 192.168.0.102
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
You are missing the auto line
auto eth0
iface eth0 inet static
address 192.168.0.102
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
(Just for diagnosis) - Also remove the gateway line from it
and after you get the connection run this command to add the gateway
root prompt :) #
route add default gateway 192.168.0.1
i was playing around a lot with networking on it so i got the answer. Hope this resolve your issue do post.
Do the configurations in wicd. Run "wicd-client" which opens GUI to make the configuration. Apparently wicd configurations overwrite what you do in /etc/network/interfaces
Another alternative to setting the ipaddress to be static on boot. Even without a ethernet jack plugged in, which was my issue.
Caution: this is hacky, and there probably better streamlined approach
Edit the /opt/scripts/boot/autoconfigure_usb0.sh script
line 92 and 139 set the usb0 default ipaddress
/sbin/ifconfig usb0 ${deb_usb_address} netmask ${deb_usb_netmask} || true
insert the following line after it, in both places
/sbin/ifconfig usb0 ${deb_usb_address} netmask ${deb_usb_netmask} || true
/sbin/ifconfig eth0 192.168.0.123 netmask 255.255.255.0 || true
then it will boot up with that as the static IP address even if you don't have anything plugged it.

Steps to share internet with BeagleBone Black using USB from OS X

Already tried:
Connect the BBB with USB to iMac
Share internet with the board from System Preferences->Sharing
ssh to the board and then try to udhcp -i usb0
This is what it says:
udhcpc (v1.20.2) started
Gets stuck and I get and error: Write failed: Broken pipe
ssh exits
Any clues?
After some try-and-erroring, here's what worked for me:
1. Watch this video: http://www.youtube.com/watch?v=Cf9hnscbSK8
2. If your BBB was shipped after November 2013, instead of screen /dev/tty.usb*B 115200 use screen /dev/tty.usb* 115200 and actually you need to go to the /dev directory and check which of the tty.usbXXX is available for your BBB and screen it. In my case it was tty.usb131 for example
3. You continue the steps just like in the video until opkg update which would be the thing you need to do over the internet
And that it's all about it.
Your SSH session is getting stuck because you're connected to usb0 and the udhcpc command changed the IP address for it! At this point there's nothing listening on the other end of your ssh session, so your local computer's ssh client eventually fails with the broken pipe error and exits.
An obvious workaround is to connect via tty.usbserial instead of ssh to the IP address. You'd think the usb port's assigned IP shouldn't be changing though. Read on to understand what's happening.
Most people using a BBB for the first time attach them directly to their Internet connected computer using the supplied USB cable. It's exactly what the BBBs designers intended for you to do, and they've done a fantastic job with the BBBs startup web page.
That host computer shares it connection differently though depending on whether it's Windows, OS X or Linux, and how you do it varies depending on the version of the OS you're running.
Derek Molloy (Exploring BeagleBone) and Jason Kridner (Youtube OS X Beaglebone video) provide some fairly detailed instructions to use host based Internet sharing with your BBB. The Linux and Windows instructions are still good, but they need to update the OS X info for Yosemite - Apple switched their NAT and firewall software to pf from ipfw and natd. If you try running udhcpc like Jason did in his vid it doesn't work the same way as his did.
So back to your BBB SSH problem with OS X Yosemite. Here's how to see what's going on: Connect to the BBB using a serial/FTDI cable, then check the ip config of usb0 for the beaglebone.
beaglebone:~# ifconfig -a usb0
usb0 Link encap:Ethernet HWaddr 0e:be:ff:00:ff:00 inet addr:192.168.7.2
Bcast:192.168.7.3 Mask:255.255.255.252
confirm you can ping the host that's sharing it's Internet connection
beaglebone:~# ping 192.168.7.1
PING 192.168.7.1 (192.168.7.1) 56(84) bytes of data.
64 bytes from 192.168.7.1: icmp_req=1 ttl=64 time=0.681 ms
64 bytes from 192.168.7.1: icmp_req=2 ttl=64 time=0.533 ms
^C
try reaching an Internet IP (google dns)
beaglebone:~# ping 8.8.8.8
connect: Network is unreachable
check routes and confirm there's no default route out, which is why the ping above failed (a USB connected BBB has a 192.168.7.0/30 network setup by default, so it can only reach 192.168.7.0, .1, .2 and .3 addresses).
beaglebone:~# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.7.0 0.0.0.0 255.255.255.252 U 0 0 0 usb0
so if you run udhcpc it will add the missing route for you. you could also just add the route directly, but you need to setup dns as well, and with OS X Internet sharing it won't work without also changing the BBB's IP address - see links at end of this post)
beaglebone:~# udhcpc -i usb0
udhcpc (v1.20.2) started
Sending discover...
Sending discover...
and here is where udhcpc changes the IP instead of just re-using 192.168.7.2. The new IP is compatible with the IP range used by OS X Internet Sharing, so that may be why the DHCP server is returning it.
Sending select for 192.168.2.34...
Lease of 192.168.2.34 obtained, lease time 85536
udhcpc then throws an error because there's no default route to delete
/etc/udhcpc/default.script: Resetting default routes
SIOCDELRT: No such process
udhcpc then adds the default route - note carefully it's an OS X Internet Sharing 192.168.2 address, not the original 192.168.7.
/etc/udhcpc/default.script: Adding DNS 192.168.2.1
everything worked, so you can see the new route and successfully ping an external IP now
beaglebone:~# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 usb0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
beaglebone:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=53 time=4.08 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=53 time=3.59 ms
^C
There are a couple of blog posts that show how to set this up permanently:
Sharing OS X Internet Connection over USB to BeagleBone Black
and
Changing usb0 IP address on the BeagleBone Black

Resources