2

I have a Raspberry Pi 3 Model B (with Raspbian Stretch Lite installed) connected to my laptop by Ethernet using a static IP address (network: 192.168.128.0). I can access it through ssh without any problems. Both Raspi and Laptop are connected to my home WiFi network (192.168.1.0). I was able to do apt-get update && apt-get upgrade and get a response when pinging sites offering an IPv6 address (google.com, www.fefe.de), but not so for IPv4 addresses (such as github.com, which is resolved as 192.30.253.112).

Why can't I communicate with IPv4 sites?

Here's what ifconfig says:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.128.66  netmask 255.255.255.0  broadcast 192.168.128.255
    inet6 fe80::ba27:ebff:fe5e:11a4  prefixlen 64  scopeid 0x20<link>
    ether b8:27:eb:5e:11:a4  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 284  bytes 23167 (22.6 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1  (Local Loopback)
    RX packets 163  bytes 16590 (16.2 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 163  bytes 16590 (16.2 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.1.109  netmask 255.255.255.0  broadcast 192.168.1.255
    inet6 fe80::ba27:ebff:fe0b:44f1  prefixlen 64  scopeid 0x20<link>
    inet6 2a02:1205:506b:20d0:ba27:ebff:fe0b:44f1  prefixlen 64  scopeid 0x0<global>
    ether b8:27:eb:0b:44:f1  txqueuelen 1000  (Ethernet)
    RX packets 2862  bytes 287666 (280.9 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 1783  bytes 322848 (315.2 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

And here what iwconfig says:

eth0      no wireless extensions.

lo        no wireless extensions.

wlan0     IEEE 802.11  ESSID:"bucher"
      Mode:Managed  Frequency:2.437 GHz  Access Point: D0:05:2A:1B:ED:78
      Bit Rate=65 Mb/s   Tx-Power=31 dBm
      Retry short limit:7   RTS thr:off   Fragment thr:off
      Power Management:on
      Link Quality=43/70  Signal level=-67 dBm
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:0  Invalid misc:0   Missed beacon:0

And finally my /etc/network/interfaces file:

source-directory /etc/network/interfaces.d

auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 192.168.128.66
        netmask 255.255.255.0
        gateway 192.168.128.1

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Edit /etc/resolv.conf:

domain home
nameserver 192.168.1.1
1

You have provided incomplete information (specifically about routing) but you are using 2 different subnets (exactly why is unclear).

The end result is that ipv4 is unable to reach a DNS server, and ipv6 is being used instead.

You need to set your system up to use ONE network.

It is also unclear why you are trying to assign a static IP when you seem to have a perfectly adequate network which is assigning addresses, and presumably setting the DNS server address (which /etc/resolv.conf would show).

How do I set up networking/WiFi/Static IP explains how to setup networking, although this only deals with normal networks, not complex multi-subnet configurations.

  • The problem is that I have to use the Raspi in different wireless networks, one is 10.X.X.X, that one here is 192.168.X.X, so I have a statically configured Ethernet network for the connectivity between Laptop and Raspi. I have shown my /etc/resolv.conf above now, thanks for pointing out. Why can't I have two networks when each device has two network devices? – Patrick Bucher Oct 29 '17 at 11:16
  • Why I need two networks? When I connect my Raspi to the school network I don't know how to reach it. The IP changes, ping by hostname fails. And even when I shut eth0 down, I still can't reach IPv4 sites. – Patrick Bucher Oct 29 '17 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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