Linux connection sharing

I am confused how this works. When i connect to the pwnagotchi i am using the USB ethernet connection. This is the only way, other than bluetooth, that i can connect to it. When i do so my wireless connection on my laptop drops. How do i share the internet connection with pwnagotchi.

Have you followed the Linux host instructions on the website?

https://pwnagotchi.ai/configuration/#connecting-to-pi0w-with-microusb-cable-on-linux-host

I believe this issue is the reason for the existence of the linux_connection_share.sh script, the purpose should be to bridge the two connections together.

You can clone the pwnagotchi repo via git clone https://github.com/evilsocket/pwnagotchi.git, plug in the pwnagotchi, and then go into the pwnagotchi/scripts folder and run the linux_connection_share.sh script on your host.

Thanks for this. It seems as though I have it working but I cannot ping from pwnagotchi while connected via SSH. I am using ubuntu and I now show 2 connections; one for wifi and one for the USB connection labelled enp0s20u3. This is the value I typed into the linux_connection_share.sh file. I must still be missing something. Thanks in advance for the help.

I fixed my own problem. I needed to update both connections in the .sh file. I am now pinging away.

Hi guys i am a total noob in programming and i am stuck.

  • Pwnagotchi runs via USB in manu mode
  • SSH runs between Host via USB to Pwnagotchi
  • Implementing linux_connection_share.sh doesnt work
    i get this error:

RTNETLINK answers: File exists

what i should change in this script?

#!/usr/bin/env bash

name of the ethernet gadget interface on the host

USB_IFACE=${1:-usb0}
USB_IFACE_IP=10.0.0.1
USB_IFACE_NET=10.0.0.0/24

host interface to use for upstream connection

UPSTREAM_IFACE=${2:-eth0}

ip addr add “$USB_IFACE_IP/24” dev “$USB_IFACE”
ip link set “$USB_IFACE” up

iptables -A FORWARD -o “$UPSTREAM_IFACE” -i “$USB_IFACE” -s “$USB_IFACE_NET” -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o “$UPSTREAM_IFACE” -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward

Thanks for everyone supporting this cool project!

Cheers! :smiley_cat:

After face palming myself, i found a solution her:

Forgot to put an DNS mask on it in “Networksettings” --> “8.8.8.8” added and its works!

:checkered_flag: :man_shrugging:

1 Like