I'm trying to set a static IP address for a rpi 4, and use a tablet as screen which will connect it through remote Desktop application.
I tried to modify the /etc/dhcpcd.conf
and add those lines:
Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
Inform the DHCP server of our hostname for DDNS.
hostname
Use the hardware address of the interface for the Client ID.
clientid
or
Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
Some non-RFC compliant DHCP servers do not reply with this set.
In this case, comment out duid and enable clientid above.
#duid
Persist interface configuration when dhcpcd exits.
persistent
Rapid commit support.
Safe to enable by default because it requires the equivalent option set
on the server to actually work.
option rapid_commit
A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
Most distributions have NTP support.
#option ntp_servers
A ServerID is required by RFC2131.
require dhcp_server_identifier
Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
Example static IP configuration:
#interface wlan0
#static ip_address=192.168.0.10/24
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
It is possible to fall back to a static IP if DHCP fails:
define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1
fallback to static profile on eth0
#interface eth0
#fallback static_eth0
interface wlan0
static ip_address=192.168.1.36/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
ping 8.8.8.8:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.1.36 icmp_seq=1 Destination Host Unreachable
From 192.168.1.36 icmp_seq=2 Destination Host Unreachable
From 192.168.1.36 icmp_seq=3 Destination Host Unreachable
ping google.com:
PING google.com(par10s38-in-x0e.1e100.net (2a00:1450:4007:805::200e)) 56 data bytes
64 bytes from par10s38-in-x0e.1e100.net (2a00:1450:4007:805::200e): icmp_seq=1 ttl=118 time=14.3 ms
64 bytes from par10s38-in-x0e.1e100.net (2a00:1450:4007:805::200e): icmp_seq=2 ttl=118 time=13.6 ms
64 bytes from par10s38-in-x0e.1e100.net (2a00:1450:4007:805::200e): icmp_seq=3 ttl=118 time=14.3 ms
64 bytes from par10s38-in-x0e.1e100.net (2a00:1450:4007:805::200e): icmp_seq=4 ttl=118 time=13.5 ms
64 bytes from par10s38-in-x0e.1e100.net (2a00:1450:4007:805::200e): icmp_seq=5 ttl=118 time=14.4 ms
ip a && ip r
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether dc:a6:32:94:13:f5 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether dc:a6:32:94:13:f6 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.36/24 brd 192.168.1.255 scope global noprefixroute wlan0
valid_lft forever preferred_lft forever
inet6 2001:861:3884:2ff0:93ae:6353:1925:63fb/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 86245sec preferred_lft 14245sec
inet6 fe80::123d:2751:278:4453/64 scope link
valid_lft forever preferred_lft forever
default via 192.168.1.1 dev wlan0 src 192.168.1.36 metric 303
192.168.1.0/24 dev wlan0 proto dhcp scope link src 192.168.1.36 metric 303
ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether dc:a6:32:94:13:f5 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
link/ether dc:a6:32:94:13:f6 brd ff:ff:ff:ff:ff:ff
Until now, everything is ok, the tablet accesses the rpi4 and I can use it. After the modification, rpi lost the connection to the net and I get unreachable page for every search I do on the net. I found a similar issue on the rpi forum Loose access to internet when I setup static IP but it does not fix the issue. There is a detailed answer How do I set up networking/WiFi/static IP address on Raspbian/Raspberry Pi OS? I followed the steps but I didn't find my mistake or what I did wrong in my config. Any thoughts on how I can fix that?
ping google.com
andping 8.8.8.8
- please edit you post with results of both commands. Can you also add the output ofip link
– Dec 16 '20 at 01:14ip a && ip r
into your Question – Milliways Dec 16 '20 at 02:24ping 192.168.1.1
– asoundmove Dec 18 '20 at 01:01