Startup USB network on Nokia 770
Host Side
Kernel options
Compile kernel with correct options
Device DriversUSB supportUSB Network Adapters Multi-purpose USB Networking Framework Simple USB Network Links (CDC Ethernet subset)[*] Embedded ARM Linux links (iPaq, ...)USB Gadget Support<*> Support for USB Gadgets<*> USB Gadget Drivers (Ethernet Gadget (with CDC Ethernet support))
NetworkingNetworking support (NET [=y])Networking optionsNetwork packet filtering (replaces ipchains) (NETFILTER [=y])IP: Netfilter Configuration<*> Connection tracking (required for masq/NAT)
OBS : Feel free to add more options as I,ve done.;)
USB Hotplug
Install hotplug (Be carefull)
apt-get install hotplug
Load modules
modprobe usbnetmodprobe cdc_ether
Configure USB interface
Add to file /etc/network/interfaces
iface usb0 inet static address 192.168.2.14 netmask 255.255.255.0 broadcast 192.168.2.255
Target side(nokia770)
Activate USB network on device
Create connection on device
http://maemo.org/maemowiki/HowToSetUpUsbNetworkingDebian
Host side
Activate USB network on host
ifup usb0
Now,connection is OK. You can test using comand ping.
(devive <-> host)
NAT
Install iptables to create a NAT.
apt-get install iptables
Create and add to file /etc/init.d/iptables
#!/bin/bash
iniciar(){#modprobe iptable_natecho 1 > /proc/sys/net/ipv4/ip_forwardiptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEiptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:1536 -j TCPMSS --clamp-mss-to-pmtu}
parar(){iptables -F -t nat}
case "$1" in"start")iniciar;;"stop")parar;;*)echo "Use os parĂ¢metros start ou stop"esac
This is going to be our script to start NAT. So,turn it executable and execute :
chmod +x /etc/init.d/iptables /etc/init.d/iptables start
And now , the device is connected to network (device <-> host <-> network)
Nokia770:~# ifconfiglo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
usb0 Link encap:Ethernet HWaddr BA:C3:E8:40:38:1F inet addr:192.168.2.15 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:241 errors:0 dropped:0 overruns:0 frame:0 TX packets:249 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:24380 (23.8 KiB) TX bytes:82482 (80.5 KiB)Nokia770:~#Now you can ping.
Some links used to made this small howto :
http://www.falkotimme.com/howtos/debian_kernel2.6_compile/
http://embedded.seattle.intel-research.net/wiki/index.php?title=Setting_up_USBnet
http://www.falkotimme.com/howtos/debian_kernel2.6_compile/
