3 IP address from RPI3 eth + wlan +? - raspberry-pi3

I have a raspberry 3 connected by ethernet and wifi to my router.
So I understand I should have 2 IP address referring to it.
But I wrote hostname -I and get 3 different IP addresses:
192.168.1.100, 192.168.1.33 and 192.168.1.35
Where does the third IP come from?
if I disconnect the ethernet cable from the RPI and write again hostname -I I get:
192.168.1.100 and 192.168.1.33
this does not make sense with 'ifconfig' result:
eth0 Link encap:Ethernet HWaddr b8:27:eb:d6:xx:xx
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ba27:ebff:fed6:xxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:23152 errors:0 dropped:6 overruns:0 frame:0
TX packets:51977 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12371346 (11.7 MiB) TX bytes:58608891 (55.8 MiB)
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:416 errors:0 dropped:0 overruns:0 frame:0
TX packets:416 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:47205 (46.0 KiB) TX bytes:47205 (46.0 KiB)
wlan0 Link encap:Ethernet HWaddr b8:27:eb:83:xx:xx
inet addr:192.168.1.33 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::8df4:f4d0:xxxx:115/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:28407 errors:0 dropped:23070 overruns:0 frame:0
TX packets:4040 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7492811 (7.1 MiB) TX bytes:4725779 (4.5 MiB)
update:
As Bugfinger pointed out the use of ip addr show shows which device the address is assigned to:
2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:d6:fb:5a brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet 192.168.1.35/24 brd 192.168.1.255 scope global secondary eth0
valid_lft forever preferred_lft forever
inet6 fe80::ba27:ebff:fed6:fb5a/64 scope link
valid_lft forever preferred_lft forever`
I have 2 different addresses to eth0:
scope global eth0 and scope global secondary eth0

Recent Raspbian versions (since Jessie) are using DHCP Client Daemon (DHCPCD) to configure network devices. So static IP addresses are to be configured in /etc/dhcpcd.conf. If you configured them to be static manually or via /etc/network/interfaces, you end up with one static and one dynamic IP address on the same device. As far as I read about it, it's not clear yet, if that's a bug in DHCPCD or an expected behaviour after mis-configuration.
Anyway, to change that, you have to do as follows.
To see if it is running, check the output of:
sudo service dhcpcd status
If it is not running, start it with:
sudo service dhcpcd start
sudo systemctl enable dhcpcd
If you did already changed /etc/network/interfaces, you need to revert those changes. The original contents of that file (in Jessie) is:
# 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
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Now all interfaces should be configured through DHCP again. If you now want to set a static IP address for eth0, edit /etc/dhcpcd.conf and put in:
interface eth0
static ip_address=192.168.1.100/24
static routers=192.168.1.1 # or whatever your router is
static domain_name_servers=192.168.1.1 # same as router
After saving the file and sudo reboot, your Raspi should reboot with a static eth0 and a dynamic wlan0 and without the extra IP address hanging around.

Related

Docker on Mac... Can't access anything on local network

Running OSX 10.11.6 (for campatibility reasons with some other software that isn't compatible with anything higher, so upgrading OSX isn't a solution) and the highest version of Docker compatible with 10.11.6, which is 17.12.0-ce-mac55 (23011).
Before I continue, I should say I'm not too knowledgeable when it comes to networks, subnets, netmasks, gateways, etc...
From inside any of my containers, I cannot access any hosts on my local network (apart from the host machine). My network config looks like this on the host:
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:50:b6:69:51:f3
inet6 fe80::250:b6ff:fe69:51f3%en4 prefixlen 64 scopeid 0x4
inet 172.25.18.19 netmask 0xfffffe00 broadcast 172.25.19.255
nd6 options=1<PERFORMNUD>
media: autoselect (1000baseT <full-duplex>)
status: active
and like this in a container:
eth0 Link encap:Ethernet HWaddr 02:42:C0:A8:10:04
inet addr:192.168.16.4 Bcast:192.168.31.255 Mask:255.255.240.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1683 (1.6 KiB) TX bytes:2551 (2.4 KiB)
For example, from the host, I can telnet to an HP JetDirect box on 172.25.33.51, but not from any container. Similarly, I can get a response from our Navision server's SOAP server from the host, on 172.20.38.62, but not from any container. Same story with a few other machines on slightly different IPs.
Problem is, I need to write an integration bundle that connects to Navision.
Any ideas how I can get access to hosts on the network?

Virtualbox - can't use internet on terminal

I have a Linux Mint in a virtualbox VM and I'm able to use Internet through browser. However, when I've tried to use the command wget www.google.com, for example, the results is
$ wget www.google.com
--2018-12-03 16:46:10-- http://www.google.com/
Resolving www.google.com (www.google.com)... 2800:3f0:4001:810::2004,
172.217.28.4
Connecting to www.google.com
(www.google.com)|2800:3f0:4001:810::2004|:80...
I've checked the issue No internet in terminal . But, unfortunatelly appears as an specific proxy problem and that's not my case.
My VM network config
I know! Portuguese...
Basicaly, the connection type is set on "Bridge"
And "promiscuous" mode is set as 'Allow everything'.
There is no other adaptor configuration.
Result of command ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:2b:04:c7
inet addr:192.168.0.39 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: 2804:14d:c092:4057:6d41:5685:4959:c973/64 Scope:Global
inet6 addr: 2804:14d:c092:4057::1005/128 Scope:Global
inet6 addr: fe80::da8c:1d0b:592d:5c90/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14289 errors:0 dropped:0 overruns:0 frame:0
TX packets:9307 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15589075 (15.5 MB) TX bytes:938043 (938.0 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:776 errors:0 dropped:0 overruns:0 frame:0
TX packets:776 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:66576 (66.5 KB) TX bytes:66576 (66.5 KB)
Linux Mint network config
Thanks to #darnir, I figured out how to make a 'workaround' to solve this problem! Basicaly, I had to add some 'aliases' for wget and apt-get in my .bashrc file and edit /etc/sysctl.conf
Aliases on ~/.bashrc:
# alias for wget force connection through ipv4
alias wget='wget -4 '
# alias for apt-get force connections through ipv4
apt-get='apt-get -o Acquire::ForceIPv4=true
Editing on /etc/sysctl.conf (Remember this solution is implemented over Linux Mint distro)
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
To restart systcl:
sudo sysctl -p
Or, you can use -w in sysctl command directly. But you'll lost this config as soon as you end the terminal session:
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
sysctl -w net.ipv6.conf.lo.disable_ipv6=1
WARNING this is not a good solution because is not comprehensive to all system. The problem appearently is the algorithms to resolve IPv6 is just too slow to perform properly in VMs( at least in common machines ). If someone has another idea please, post it! :D

Configure Multiple Bridge IPs in Vagrant

I have the following Vagrantfile which defines many (multi-machine) VMs:
Vagrant.configure(2) do |config|
for i in 1..3 do
config.vm.define "vm#{i}" do |c|
c.vm.box = "ubuntu/xenial64"
c.vm.network "public_network", ip: "192.168.0.#{i + 100}"
c.vm.network :forwarded_port, guest: 22, host: rand(2000...4000), id: 'ssh'
end
end
end
After performing vagrant up, each VM has the same eth1 interface:
eth1 Link encap:Ethernet HWaddr 08:00:27:43:e7:4f
inet addr:192.168.0.103 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: 2607:b400:26:0:a00:27ff:fe43:e74f/64 Scope:Global
inet6 addr: fe80::a00:27ff:fe43:e74f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:59 errors:0 dropped:0 overruns:0 frame:0
TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10065 (10.0 KB) TX bytes:3832 (3.8 KB)
I would like each VM to have a separate IP, but each one strangely adopts the IP 192.168.0.103. If I omit the ip specification to public_network, each VM's eth1 IP is different.
How can I configure multiple bridge IPs in a multi-machine Vagrantfile?
I guess its one of ruby caveat (you can read Closures and for loops in Ruby and probably other good resources on the net)
basically replace you for loop
for i in 1..3 do
with equivalent
(1..3).each do |i|

How can I find the host machine network ip address on travis?

Sorry for the naive question but I am new to using travis and read the docs thoroughly but I can't figure out what exactly I need to put in my .travis.yml or use as an IP address.
I have setup my server on local host in travis. For client testing I need the ip address of the local host to test my client app.
Any help is highly appreciated. Thanks :)
This works:
language: generic
addons:
apt:
packages:
- net-tools
script:
- /sbin/ifconfig
That installs the net-tools package, then calls the ifconfig command that package adds.
In the output from that command, you want to look at the information for the eth0 interface:
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:08
inet addr:172.17.0.8 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:acff:fe11:8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1245 errors:0 dropped:0 overruns:0 frame:0
TX packets:1083 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:17000256 (17.0 MB) TX bytes:122513 (122.5 KB)
But it’s better these days to instead use the ip command from the iproute2 package:
dist: trusty
language: generic
addons:
apt:
packages:
- iproute2
script:
- ip a
Sample output:
10: eth0#if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:11:00:05 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.5/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe11:5/64 scope link
valid_lft forever preferred_lft forever

broadcast address not found using cat /etc/hosts in console

i have been trying to install edX ,one of its command line instruction is
cat /etc/hosts
i am getting the response as
cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 precise64
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
broadcast ip is missing ,why is it so?
You don't typically list a broadcast address in /etc/hosts file. Why would you expect to see it there?
What is 'edX' anyway? Got a url for its README file?
Come to think of it, if you really need the broadcast mask for your host, you're
better off using a variant of ifconfig. Here are some examples:
(Solaris 11.x)
enter code here
$ ipadm show-addrprop -p broadcast e1000g0/v4
ADDROBJ PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE
e1000g0/v4 broadcast r- 192.168.1.255 -- 192.168.1.255 --
limoncello:jmcp $ ifconfig e1000g0
e1000g0: flags=100001100943<UP,BROADCAST,RUNNING,PROMISC,MULTICAST,ROUTER,IPv4,PHYSRUNNING> mtu 1500 index 2
inet 192.168.1.20 netmask ffffff00 broadcast 192.168.1.255
Alternatively, on linux (Debian Jessie):
jmcp#debiant:~$ /sbin/ifconfig eth0
eth0 Link encap:Ethernet HWaddr 08:00:27:cd:61:7c
inet addr:192.168.1.249 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fecd:617c/64 Scope:Link
inet6 addr: 2001:44b8:2188:f000:a00:27ff:fecd:617c/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:258 errors:0 dropped:0 overruns:0 frame:0
TX packets:208 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44119 (43.0 KiB) TX bytes:29635 (28.9 KiB)
On the Solaris host, the broadcast addr for the interface I'm interested in is 192.168.1.255; on the Debian vm, it's the same.

Resources