# \[USB-ETH\] Connect GameShell to Linux PC!

**URL:** <https://forum.clockworkpi.com/t/usb-eth-connect-gameshell-to-linux-pc/1643>\
**Category:** Tutorials\
**Tags:** network, usb, ssh, linux, ethernet\
**Created:** [September 11, 2018, 10:09pm UTC](https://forum.clockworkpi.com/t/usb-eth-connect-gameshell-to-linux-pc/1643 "2018-09-11T22:09:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oet](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/oet/32/5786_2.png) [@Oet](https://forum.clockworkpi.com/u/Oet)\
**Post date:** [September 11, 2018, 10:09pm UTC](https://forum.clockworkpi.com/t/usb-eth-connect-gameshell-to-linux-pc/1643/1 "2018-09-11T22:09:00Z")

</div>

I try out a lot of stuff on the GameShell, so I flash the image over and over again.

Setting up the Wi-Fi every time on the GameShell is a pain.  
So, I decided to **ELIMINATE WI-FI ALTOGETHER!** 😃

This tutorial is about fully utilizing your **GNU/Linux PC** , i.e.:

- **USB** : List your GameShell as a USB device on your **GNU/Linux PC**!
- **SSH** : Connect to your GameShell from your **GNU/Linux PC**!
- **Internet** : Provide internet access to your GameShell from your **GNU/Linux PC**!
- **Wired** : Never need Wi-Fi ever!

* * *

Here is what I did step by step:

## USB card:

1. [Optional] Flash a clean [image](https://forum.clockworkpi.com/t/gameshell-os-image-file/355) on your _usb\_device_ (e.g. /dev/sdX).

```auto
sudo dd bs=4M if=clockworkos_v0.1.img of=${usb_device} status=progress oflag=sync

```

1. Replace the file [uImage](https://github.com/clockworkpi/Kernel/raw/master/uImage) on the `boot` partition.

2. Find out the _ip\_of\_your\_router_ connected to the internet.

3. On your `CLOCKWORKPI` partition, append to `/etc/network/interfaces` (using sudo):

```auto
allow-hotplug usb0
auto usb0
iface usb0 inet static
address 10.0.0.2
netmask 255.255.255.0
gateway 10.0.0.1
dns-nameservers ${ip_of_your_router}

```

_This will add the GameShell to a new 10.x.x.x network with a static IP once it is connected!_

1. On your `CLOCKWORKPI` partition, replace line 330 of `/home/cpi/apps/launcher/Menu/GameShell/10_Settings/Update/ __init__.py`:

```auto
             if is_wifi_connected_now():

```

by:

```auto
            if True:

```

_This will enable you to use ‘Update’ from the GameShell menu using USB later on!_

* * *

## GNU/Linux PC:

1. Now turn on your GameShell (with USB card in it) and hook it to your PC.

2. Check if the GameShell shows up as a USB device:

```auto
$ lsusb
Bus 001 Device 007: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget

```

1. Find the _internet\_interface_ and _gameshell\_interface_ (e.g. `eth0` and `enps3s0`):

```auto
$ ip address
1: lo: ...
2: eth0: ...
3: enp03s0: ...

```

1. Create new network rules using your _internet\_interface_ and _gameshell\_interface_:

```auto
sudo iptables -t nat -A POSTROUTING -o ${internet_interface} -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i ${gameshell_interface} -o ${internet_interface} -j ACCEPT

```

1. Assign a static IP address to your _gameshell\_interface_. The ip `10.0.0.1` should match `gateway` of step 4!

```auto
sudo ip link set up dev ${gameshell_interface}
sudo ip addr add 10.0.0.1/24 dev ${gameshell_interface}

```

1. Enable internet forwarding:

```auto
sudo sysctl net.ipv4.ip_forward=1

```

1. Login! The ip `10.0.0.2` should match `address` of step 4!

```auto
ssh cpi@10.0.0.2

```

1. Test if your GameShell has internet:

```auto
ping clockworkpi.com

```

Without **ever** turning Wi-Fi on you should have full access to your GameShell including internet!

* * *

## Notes:

- Tested on Ubuntu and Arch.
- step 9 and 11 will reset after reboot.
- step 10 will reset after unplugging.
- Make sure `/etc/resolv.conf` on the GS has _ip\_of\_your\_router_ for DNS.

Search online how to make those steps permanent (or make a script).

Good luck! 🙂

---

<div class="post-metadata">

**Author:** ![alamar](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/alamar/32/1499_2.png) [@alamar](https://forum.clockworkpi.com/u/alamar)\
**Post date:** [January 23, 2019, 10:32pm UTC](https://forum.clockworkpi.com/t/usb-eth-connect-gameshell-to-linux-pc/1643/2 "2019-01-23T22:32:04Z")

</div>

Many thanks for this posting, i would have been lost without it.  
Managed to establish internet on my Gameshell with it, since no wifi device in my house at all seemed to work with it.  
For the statistics: Ubuntu 18.04 and Gameshell OS 1.23

---

<div class="post-metadata">

**Author:** ![Oet](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/oet/32/5786_2.png) [@Oet](https://forum.clockworkpi.com/u/Oet)\
**Post date:** [January 29, 2019, 12:10am UTC](https://forum.clockworkpi.com/t/usb-eth-connect-gameshell-to-linux-pc/1643/3 "2019-01-29T00:10:56Z")

</div>

The [newer images](https://forum.clockworkpi.com/t/gameshell-os-image-files/355) make it even more easy:

- Step 2 is no longer required!
- In Step 4 and 10 you can use the now predefined range:

```auto
address 192.168.10.1
gateway 192.168.10.2

```

Futhermore, adding `dns-nameservers` wasn’t necessary, but putting your _ip\_of\_your\_router_ in `/etc/resolv.conf` is!
