Configuring to Emulate Ethernet Over USB RPi Zero W


1.Configuring to Emulate Ethernet Over USB

Our long term goal will be to use SSH over USB. This means that we have to configure Raspbian to treat the USB port like an ethernet port. Mount the micro SD card in a computer (not Pi Zero) and open it with Finder, or Windows Explorer, or whatever it is that you use.
The first thing that you want to do is open a file at the root of the mounted drive called config.txt. In this file you want to add the following line at the very bottom:
dtoverlay=dwc2
The above line will set us up for the next file that we alter. The next file we alter is cmdline.txt, but it is a bit different. Parameters in this file are not delimited by new lines or commas, they are delimited by space characters. In this file we want to add the following:
modules-load=dwc2,g_ether
The above parameter should be added after the rootwait parameter. Yes the above parameter is a single parameter, meaning don’t add a bunch of space characters to it. More information on networking over USB on Linux can be found here.

Credit: https://www.thepolyglotdeveloper.com/2016/06/connect-raspberry-pi-zero-usb-cable-ssh/ 

and 

https://www.youtube.com/watch?v=5FjvZ1SR7DM 
2.Install Putty 
3. Install Download Bonjour Print Services for Windows v2.0.2 
https://support.apple.com/kb/DL999?locale=th_TH

Use Putty login with 

pi@raspberrypi.local port 22 

As an added bonus, I also show you how to setup and activate WiFi on the Raspberry Pi Zero W from the command line inside SSH over USB.
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
  ssid="NETWORK"
  psk="PASSWORD"
}

sudo wpa_cli reconfigure
ifconfig wlan0

Comments