diibv
Posts: 3
Joined: Fri Feb 14, 2020 11:16 pm

Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Fri Feb 14, 2020 11:41 pm

I've bought a USB to Ethernet adapter to use with my RPi Zero W, but I cannot figure out how to do a proper headless configuration to use it. Previously, I've been successfully using this RPi Zero W for Pi-Hole over WIFI. I am trying to re-configure it to use with this new Ethernet adapter instead of WIFI.

I have tried mounting the SD card on my computer to edit files on the /boot partition:

- cmdline.txt : append "ip=192.168.1.220::192.168.1.1:255.255.255.0:rpi:eth0:off" to the end of the line
- create empty ssh file

After putting the SD card back into the Pi and booting, I was expecting that the Pi would have a static IP address of 192.168.1.220 and a working SSH connection, however it did not work (no ping, no SSH access).

I wonder if the network interface in cmdline.txt should not be "eth0", but something else?

User avatar
B.Goode
Posts: 9563
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Sat Feb 15, 2020 8:37 am

Welcome to the Raspberry Pi forums.


diibv wrote:
Fri Feb 14, 2020 11:41 pm
I've bought a USB to Ethernet adapter to use with my RPi Zero W, but I cannot figure out how to do a proper headless configuration to use it. Previously, I've been successfully using this RPi Zero W for Pi-Hole over WIFI. I am trying to re-configure it to use with this new Ethernet adapter instead of WIFI.

I have tried mounting the SD card on my computer to edit files on the /boot partition:

- cmdline.txt : append "ip=192.168.1.220::192.168.1.1:255.255.255.0:rpi:eth0:off" to the end of the line
- create empty ssh file

After putting the SD card back into the Pi and booting, I was expecting that the Pi would have a static IP address of 192.168.1.220 and a working SSH connection, however it did not work (no ping, no SSH access).

I wonder if the network interface in cmdline.txt should not be "eth0", but something else?


What Operating System are you running on your RPi Zero board?


Is this configuration an alternative to, or in addition to, the previous Pi-Hole setup?

kerry_s
Posts: 244
Joined: Thu Jan 30, 2020 7:14 pm

Re: Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Sat Feb 15, 2020 9:32 am

all you need is a file named "ssh" in /boot and you'll have ssh access.
for the pi-hole go into your pi-hole/admin in your browser, settings-> dns, check "listen on all interfaces", click "save" on the bottom of the page.

i'm now running a pi-hole on a pi zero w as well. i run mine headless on wireless. i use to run the pi-hole on a rpi4 4gb, but now i'm using the rpi4 as a desktop with a gnome-core install.

diibv
Posts: 3
Joined: Fri Feb 14, 2020 11:16 pm

Re: Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Sat Feb 15, 2020 2:09 pm

What Operating System are you running on your RPi Zero board?
Is this configuration an alternative to, or in addition to, the previous Pi-Hole setup?
The installed OS is Raspbian Lite Stretch. My idea was to build upon my previous Pi-Hole setup (do not install from scratch).

I have "ssh" in /boot but this does not help. The device is not recognized by the router.

Could there be some issue with my mini-USB - Ethernet adapter? It is powered by RPi (the power indicator lights up), but there's no activity on the ethernet port (no light).

User avatar
thagrol
Posts: 2375
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Sat Feb 15, 2020 2:23 pm

kerry_s wrote:
Sat Feb 15, 2020 9:32 am
all you need is a file named "ssh" in /boot and you'll have ssh access.
Unlikely as it's not responding to pings.

@diibv:

First, my appologies if some of this seems too basic or to be insulting your intelligence.
  1. Are you using a proper micro USB to USB A female otg cable between the zeroW and the ethernet adapter? Is it in the correct socket?
  2. You do have a network cable plugged into that USB ethernet adapter?
  3. What's on the other end of that cable?
  4. With a fresh unmodified raspbian buster SD card and with a screen, keyboard, and your ethernet dongle connected (you'll need a USB hub) what is the output of

    Code: Select all

    lsusb
    and

    Code: Select all

    ifconfig -a
  5. Rather than using kernel parameters, try setting up the ethernet interface via /etc/dhcpcd.conf for example by adding this to the end of that file:

    Code: Select all

    interface eth0
    static ip_address=192.168.1.220/24
    static routers=192.168.1.1
    domain_name_servers=192.168.1.1
    
  6. As you're assigning a static IP address make sure any remote access/ping attempts use that address rather than the Pi's name. Your DNS server won't know what the mapping is or may have an old one.
  7. Again, with a fresh unmodified raspbian buster SD card does a network scan find the zeroW when the ethernet dongle is connected to it and your network?
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

anode505
Posts: 6
Joined: Sat Sep 13, 2014 1:12 pm

Re: Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Sat Feb 15, 2020 3:04 pm

With the power light on and no activity light, kinda leads me to think the interface isn't up.
Are you sure the adapter is named 'eth0' ? And has been enabled? (ifconfig eth0 up)

Can you go headed to troubleshoot this? (uart console might be an option)
Let your DHCP server give it an address (make a reservation for it to keep it on .220)

Does nmap see it? (use -Pn to not try pings)

kerry_s
Posts: 244
Joined: Thu Jan 30, 2020 7:14 pm

Re: Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Sat Feb 15, 2020 4:13 pm

i agree with everyone else, you need to see if the ethernet adapter is recognized as such. not everything is compatible with linux out of the box.
i was assuming you left the wifi on so you can still ssh in over wifi,
kerry_s wrote: ↑
Fri Feb 14, 2020 11:32 pm
all you need is a file named "ssh" in /boot and you'll have ssh access.
Unlikely as it's not responding to pings.
i figured he would at least leave the wifi on. that should still work regardless of the usb ethernet issue.

diibv
Posts: 3
Joined: Fri Feb 14, 2020 11:16 pm

Re: Headless access configuration for RPi Zero W with a USB to Ethernet adapter

Fri Feb 21, 2020 12:03 am

Thank you very much for all your quick replies, that was really helpful and supportive!

Finally, I've reinstalled the Raspbian from scratch and was able to SSH in using Ethernet by default without a specific configuration steps necessary.

Also, installing and configuring Pi-Hole by using its script, you are able to set the default interface as well (eth/wlan).

I should have been able to access the RPi headlessly via wifi and configure the default interface, as suggested, too.

Return to “Troubleshooting”