Dingux:Tutorials:USB Networking

From DingooWiki

Jump to: navigation, search

[edit] Introduction

czDoom multiplayer using USB Networking

This tutorial will teach you how to set up an internet connection on your Dingoo.

Requirements:

  • Linux PC with USB networking support and internet connection
  • standard USB cable
  • Dingoo with Dingux installed

[edit] Let's get to work

NOTE: All the commands covered in this tutorial have to be run from a root account.

First connect your Dingoo to the USB cable, and boot into Dingux.

If the connection has been detected, Dingux should print the following message:

usb0: high speed config #1: 100 mA, Ethernet Gadget, using CDC Ethernet

On your desktop PC you should now see a new ethernet device:

# ifconfig
usb0      Link encap:Ethernet  HWaddr C6:90:56:CE:CC:89
          inet addr:10.1.0.1  Bcast:10.1.0.255  Mask:255.255.255.0
          inet6 addr: fe80::c490:56ff:fece:cc89/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)

The usb0 device should have the IP address of 10.1.0.1. If it hasn't been set automatically, you can either set it manually:

ifconfig usb0 10.1.0.1 netmask 255.0.0.0

or with dhcp:

dhcpcd usb0

On some PCs you'll have to run this command instead:

dhclient usb0

Your Dingoo can be now accessed on 10.1.0.2.

Now let's set some iptables rules so we can get internet working in Dingux. On your desktop PC type the following commands:

iptables -I INPUT 1 -s 10.1.0.2 -j ACCEPT
iptables -I OUTPUT 1 -s 10.1.0.1 -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE -s 10.0.0.0/8

By default these rules will be removed after a reboot. If you want to save them permanently, type:

/etc/init.d/iptables save

Now in order to enable IP forwarding, on your desktop PC type (NOTE: You need to do it after every reboot):

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

You should now be able to access the internet from dingux. However you won't be able to access the domains. In order to get that to work. we need to set the right DNS servers.

On Dingux, create a file /etc/resolv.conf, and fill it with the following content:

(NOTE: This has to be done on a running Dingux. You won't be able to access the root filesystem by mounting the SD card on your desktop PC)

echo "nameserver [dns_ip]" >> /etc/resolv.conf 

Replace [dns_ip] with your favourite DNS server. If you don't know any, you can always check resolv.conf on your desktop PC to see what DNS servers it uses.

[edit] References

Personal tools