0

I have been trying to connect my Raspberry Pi to the internet through its built in Wifi, as well as controlling/ accessing the Pi via ssh though a Static IP address via the built in Ethernet port.

When the Ethernet is unplugged, I can access the Pi though SSH and the NTP updates the time correctly.

However when I attach my ethernet cable, the NTP fails to connect, and endlessly cycles through the pools I have given in timesyncd.conf.

sudo nano etc/systemd/timesyncd.conf looks like this:

[Time]
NTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org  ntp.ubuntu.com
FallbackNTP=1.debian.pool.ntp.org ntp.talktalk.net 1.ntp.talktalk.net 2.ntp.talktalk.net
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

sudo nano etc/dhcpcd.conf looks like this:

interface eth0

static ip_address=192.168.4.13/24
static routers=192.168.4.1
static domain_name_servers=192.168.4.1
#static ip6_address=fd51:42f8:caae:d92e::ff/64

ip route show all looks like this:

default via 192.168.4.1 dev eth0 src 192.168.4.13 metric 202
default via 192.168.1.1 dev wlan0 proto dhcp src 192.168.1.235 metric 303
192.168.1.0/24 dev wlan0 proto dhcp scope link src 192.168.1.235 metric 303
192.168.4.0/24 dev eth0 proto dhcp scope link src 192.168.4.13 metric 202

cat /etc/resolv.conf shows this:

# Generated by resolvconf
domain lan
nameserver 192.168.4.1
nameserver 192.168.1.1

I find it interesting when typing timedatectl show-timesync --all, the Server Address is being resolved, without internet access:

LinkNTPServers=
SystemNTPServers=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org ntp.ubuntu.com
FallbackNTPServers=1.debian.pool.ntp.org ntp.talktalk.net 1.ntp.talktalk.net 2.ntp.talktalk.net
ServerName=ntp.ubuntu.com
ServerAddress=91.189.94.4
RootDistanceMaxUSec=5s
PollIntervalMinUSec=32s
PollIntervalMaxUSec=34min 8s
PollIntervalUSec=4min 16s
Frequency=0

If I VNC into the Pi and try access the web browser, the pages do not load.

If I remove the Ethernet cable, I am instantly able to access the internet and the NTP server updates automatically.

If I again re-plug the ethernet in, the connection drops back out.

My home network is on 192.168.1.X range (wifi) and I have set my laptop and the Pi's ethernet port to the 192.168.4.x range arbitrarily to be different from all other devices in the home.

I'm pretty new to all this, apologies if I've given too much/ too little info. Any advice on where to look, or more info I can give would be appreciated.

Thanks for reading!

2
  • You've got two default routes. Your network will never work correctly until you remove one. The default gateway is where the IP stack will send ANY packet that doesn't have a destination within your LAN subnet.
    – Dougie
    Dec 16 '21 at 20:14
  • Yes that was the issue, and declaring 'nogateway' in my 'etc/dhcpcd.conf' file got the system working as I had intended, so yes I was trying to set up an access point apparently! Thanks for the defenition Dougie, it makes perfect sense why it wasn't working now! Very much appreciate both of your time!
    – Slazl
    Dec 20 '21 at 15:50
0

It is unclear what you are trying to achieve, but as others has pointed out having 2 default routes is the cause of your immediate problem.

Again, it is difficult to suggest a "fix" as we don't know what you are trying to achieve. You appear to have set up the Pi as an access point (WHY?) If this is your intention the you should have something like (although we don't know if 192.168.4.1 is on your network).

interface eth0
    static ip_address=192.168.4.1/24
    nogateway

If it was me I would delete the static IP and connect Ethernet to router (or omit it entirely) then you could access the Pi through the router and also access internet.

See How to set up networking/WiFi

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.