Cannot get ip address on raspberry pi - ip

I'm trying to ssh to my raspberry pi so I wanted to get the ip address as mentioned in the following link using
ifconfig
http://learn.adafruit.com/adafruits-raspberry-pi-lesson-6-using-ssh/using-ssh-on-a-mac-or-linux
eth0 Link encap:Ethernet HWaddr b8:27:eb:63:40:b8
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27224 errors:0 dropped:0 overruns:0 frame:0
TX packets:733 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2801074 (2.6 MiB) TX bytes:107019 (104.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 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)
I did not get the list that starts with wlan0
I even tried typing sudo ifconfig wlan0 but I got the following error
wlan0 error fetching interface information: Device not found
I'm connected through a wired cable and yes I'm connected to the internet since I can browse websites and for the moment I do not wanna set up any wireless connection I just want to be able to get my ip so I can login to the pi using the ip address
is there anyway I can get my raspberry pi's ip address

I do not know exactly what was the problem but when I was using the ip I was getting from ifconfig I was not able to ssh to my pi when I typed
ip route
I got another ip so I used that and tried to shh to my pi and it is working now

Use
sudo ifconfig -a
if you want to use ifconfig, but as it is deprecated you should use
sudo hostname --ip-address

It doesn't seem to be connected to the network. Although just to double check, connect to your router (usually 192.168.0.1 - if not ipconfig on your machine, then go to your default gateway), login, go to devices and look for the mac address from your pi (b8:27:eb:63:40:b8) You can check the Local IP address from there... If it is connected to the network properly though

Do you have a wlan-card connected to the device? Is it via USB? Did it install correctly?
Do you have a working network connection at all on the device? Try pinging something, for example
ping 8.8.8.8
and see if you get a response. If not, you are not connected to internet, and need to either install a wireless card via USB or connect a network cable.

For ifconfig to work, you have to be connected to the device. Plugging in ethernet cables does not ensure that your computer has recognized the connection. Here is what you can try-
Go to Network Settings -> Edit Connections
Add a new connection
In IPv4 settings, change Method to "Shared with other computers"
If everything goes well, you will see connected notification. Try doing ifconfig again.
Sometimes, the IP address shown in ifconfig might not work. In that case, just use nmap to search the subnet (the last digit of IP address), and try to login on other IPs.

Try this code :
hostname -I
This should show u the IP address of ur RPi if it is set.
If it isn't set, type
sudo nano cmdline.txt
And in this file append the following in the end
IP=192.168.0.4
This should set the IP and by typing the command, you should be able to see it..

Related

IP routing to virtual network interfaces in guest OS

I'm running VirtualBox 5.0.16 r105871 and have an Ubuntu VM running as a guest. VB has created 2 interfaces Adapter 1 (NAT) and Adapter 2 (Host-Only). This seems to correspond with interfaces eth0 & eth1.
My application Docker, has created a new network subnet within the VM which looks like this:
br-9721ebff63d3 Link encap:Ethernet HWaddr 02:42:8E:12:02:02
inet addr:172.20.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:8eff:fe12:202/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:928 (928.0 B) TX bytes:1124 (1.0 KiB)
So my question is, how do I make this network visible outside of the VM ?
did you tried to ping this ip from outside VM?
it should reply. If it's replying than it's visible outside VM.
For example, I have a computer from LAN with Windows_7 (ip: 10.0.255.10). Inside the LAN I also have a linux server (ip 10.0.255.1, not the DNS, just another computer with DHCP). Inside linux server, I also have VirtualBox with an openSuse machine. Both the network cards from VM, are set to bridged.
After VM starts, I can ping the ip of VM and also transfer files without any other settings.
Try and set the interfaces Adapter 1 (bridged adapter), and if needed set an ip your range.
Turns out the solution was really simple in the end.
sudo route -n add 172.17.0.0/16 "boot2docker ip"

How to cusomize docker0 in Docker for different IP range?

I am referring Docker Networking#docker0 for customizing docker0 virtual bridge in Docker.
My ifconfig shows this:
docker0 Link encap:Ethernet HWaddr d6:0d:76:37:ee:04
inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::d40d:76ff:fe37:ee04/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:648 (648.0 B)
eth0 Link encap:Ethernet HWaddr 08:00:27:51:e4:40
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe51:e440/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:947 errors:0 dropped:0 overruns:0 frame:0
TX packets:618 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:86885 (86.8 KB) TX bytes:71855 (71.8 KB)
I want to give range 10.0.2.15/24 to docker0 interface.
Note:
I am assuming that if I customize docker0 with same IP range as that of eth0 then containers should get IPs from same range.(Please correct me if I am assuming wrong).
For this, I tried adding --fixed-cidr=10.0.2.15/24 in /etc/default/docker file. But it is now working.
Any idea how to achieve it?
Also, if I am following wrong way, please guide me how to achieve it in proper way.
Instead of changing the ip-range of your docker0 interface, you should think about what you want to be available to the outside.
If you want certain ports to link to your application and be available from the outside, take a look at the -p flag.
docker run -p IP:host_port:container_port
Take a look at the documentation for network configuration http://docs.docker.com/articles/networking/
This documentation also explains how to change the ip-range of the docker0 interface. However I think thre are other, better and easier ways to achieve what you want.
(Could you explain exactly what you want by the way?)
What you are trying to do is bordering networking suicide... If docker would let you assign your external NIC-IP (eth0) to the internal bridging-interface (docker0) your system would have two interfaces working on the same route but with different networks behind the interface. Try to think about a post-man who is working in a city and some genius gave all the streets the same name and they all started counting the numbers at 1. Could he deliver any mail? ;)
What I assume you want to achieve is, to be able to connect to whatever your docker container is running, from the "outside"-network. In that case simply add
-p port_on_host:port_inside_container
to your
docker run-command and your docker-content becomes available to the outside world via your host-ip (if your firewall is properly set up)
Cheers
D
i think you should delete docker0 bridge and create docker0 bridge by giving subnet of own .
for more pratical view and images visit : https://support.zenoss.com/hc/en-us/articles/203582809-How-to-Change-the-Default-Docker-Subnet

Workstation 9 Error: Connection activation failed: Device not managed by NetworkManager or unavailable

I have tried to get an answer to this from the people at vmware, but have not received any support.
This is a continuation of the problem I had in this post restoring a CentOS 6 Vitual Machine...
https://communities.vmware.com/thread/459939
As I indicated the Guest OS is up and running after I copied over 015.vdk and did the command line linux check disk. My issue is now the NAT no longer works and I cannot access the outside world from my Guest OS. This may have something to do with the fact that I am not running it from the original Guest OS, but instead am running it from a new Instance tied to the old virtual disk.
When I run ifconfig and ifup eth3 I get the following output:
[root#localhost ~]# ifconfig
eth3 Link encap:Ethernet HWaddr 00:0C:29:F2:F0:F4
UP 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)
Interrupt:19 Base address:0x2024
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:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
[root#localhost ~]# ifup eth3
Error: Connection activation failed: Device not managed by NetworkManager or unavailable
I have removed all network connection on my Host OS (Windows 7) that were related to the VMWare in hopes it would recreate these connections, but there are now no connections on the HOST related to VMWear. I have confirmed that the VM has a NAT network adapter set up in the Guest OS's settings. Any input would be appreciated.
Thank You
this issue occur because of two reasons:
1#: Your Network Adapter setting issue to check it first remove all your network adapter from device manager and scan to add again, and dont assign static ip set it to obtain auto. repair Network settings and see if these gets ip address. if no IP than is most probably with Vmware Workstation NAT settings.
2#: go to Vmware Workstation--> Edit--> Virtual Network Editor, here you can see different networks which you already created. Remove all Networks here and if you are advance user just delete the NAT network which you are using for your VM.
Now Click on Add Network... Select Any Network Name like VMnet01 or etc than click ok. Now Select Settings which are mentioned below VMnet Information. select NAT than click Connect to host virtual network adapter and than use any Network Setting for your DHCP like 192.168.150.0 and Click Ok. now you have created a New NAT Network.
Now Right Click your Installed VM, go to settings--> Select your Network Adapter, click on Custom:Specific Virtual Network. click ok and start you VM Machine and You are Good to go.

Filtering ethernet packets (ICMP, Bonjour) on a TAP interface on OSX

I'm writing a little tunneling app with layer 2 interfaces (TAP) as endpoints. In the course of testing this on OSX, I noticed I was getting all sorts of traffic I didn't expect on the tunnel, both when the tunnel was running on a single OSX machine, and when I tunneled between OSX and a Linux box. I'd like to filter this traffic out, and I'm wondering what the best way to do this is.
The tunnel looks like this (note both endpoints can be on the same machine):
tap0 -> tunnel app -> UDP tunnel -> tunnel app -> tap1
The notable traffic is Bonjour packets on destination port 5353 and ICMP/IGMP. Multicast is enabled on the TAP interface. I'd like to block this sort of traffic. My thoughts on doing this:
Turn off multicast on the interface (doesn't work on OSX, see below)
Use ebtables
Parse the packets coming off the interface inside the tunnel app and ignore them there
Is there a better/easier way to do this?
I tried turning off multicast on the OSX interface (let's call it tap0) but I get an error.
$ ifconfig tap0 -multicast
ifconfig: -multicast: bad value
EDIT: After a bit more hunting around, it appears UNIX and BSD ifconfig have different options. Is there another way to block multicast/ICMP traffic on a given interface in OSX/BSD?
here's the ifconfig output...
OSX (with osxtuntap):
$ ifconfig tap1
tap1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 92:d9:e6:65:5a:8c
inet 10.0.0.2 netmask 0xffffff00 broadcast 10.0.0.255
open (pid 17121)
Linux:
$ ifconfig tunX
tunX Link encap:Ethernet HWaddr 4a:29:02:e6:b0:b9
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::4829:2ff:fee6:b0b9/64 Scope:Link
UP BROADCAST RUNNING 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:500
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
One possibility is to use the built-in ipfw firewall in OSX. From the terminal, we could allow only tcp traffic on a virtual network interface called tap1:
sudo ipfw add 9000 allow tcp from any to any via tap1 # allow tcp
sudo ipfw add 9001 deny ip from any to any via tap1 # block all other incoming and outboung traffic
And we can also delete the rules if we don't need them:
sudo ipfw del 9000 9001
Alternatively, it is possible to just parse the ethernet frame and convert it from ascii into hex or decimal, and then decide what to do with it there. You can very easily detect TCP/UDP packets with the below (protocol=6 for tcp, and 17 for udp).
from binascii import hexlify
...
# given some ethernet frame string data
protocol = int(hexlify(frame[23:24]), 16)
src_port = int(hexlify(frame[34:36]), 16)
dst_port = int(hexlify(frame[36:38]), 16)
For arp packets, this won't work- the packet structure is a bit different.

Using SSH to connect to virtual box guest machine using IPv6 address

I am using windows, and I'm also running an ubuntu server on virtual box. I've SSH'd into the guest machine countless times in the recent past when the guest machine was connected to a network using IPv4 addresses. This worked back when I was at home and at work. Right now, I'm connected to the university network. Here's the result from ifconfig when executed in my VM.
eth0 Link encap:Ethernet HWaddr 08:00:27:ae:e4:a0
inet6 addr: fe80::a00:27ff:feae:e4a0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:65404 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7588239 (7.5 MB) TX bytes:10610 (10.6 KB)
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:16436 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1296 (1.2 KB) TX bytes:1296 (1.2 KB)
I did some research, and found this post on SO.
IPv6 link-local address format
So I ran netsh interface ipv6 show address on my host machine and this is my vbox network info
Interface 208: VirtualBox Host-Only Network
Addr Type DAD State Valid Life Pref. Life Address
--------- ----------- ---------- ---------- ------------------------
Other Preferred infinite infinite fe80::f8cd:e410:b1b1:c081%208
I then tried pinging the address, and it was successful. I then tried to SSH into the server, using the following command
ssh -6 fe80::f8cd:e410:b1b1:c081%208
And I got this error
"no address associated with name"
I don't understand why I'm getting this error - I've ssh'd into machines by specifying their ipv4 addresses before, and I've never gotten this error before. Could anyone tell me what I might be doing wrong?
Thanks for the help!
Try specifying the interface to the ssh client. however ssh does not have a switch for that, you have to use this syntax:
ipv6%eth1
fe80::f8cd:e410:b1b1:c081%eth0

Resources