Networking
From GumstixDocsWiki
Contents |
TCP/IP Connections
There are a very large number of ways of connecting your gumstix to a network. To connect to a TCP/IP based network:
- Using an etherstix or any netstix expansion board with a gumstix connex motherboard.
- Gumstix as a USB Ethernet gadget
- Gumstix as a Bluetooth LAN Client
- Gumstix as a Bluetooth Dialup Client, using a bluetooth phone
- Gumstix as a Bluetooth Personal Area Network node
Bridged Network On Linux (DHCP)
The aim is to get bridged networking up immediately after plugging in the USB cable, letting the dhcp server assign an ipaddress to the gumstix. To achieve this it was easier to create a bridge br0 with eth0 connected to the bridge all of the time. When usb0 comes up all that needs to be done is to connect it to the bridge.
You will need the brctl package installed.
If you can setup a fixed-address in /etc/dhcpd.conf on the dhcp server you will always get the same IP on the gumstix.
First add an entry in /etc/hosts for "192.168.21.1 gum1"
And then edit /etc/dhcpd.conf adding host section below
host gum1 {
hardware ethernet 06:00:0b:41:4a:c3;
fixed-address 192.168.21.1;
}
Reload dhcpd
Some manual commands.
ifconfig eth0 0.0.0.0 netmask 0.0.0.0 brctl addbr br0 brctl addif br0 eth0 ifconfig br0 192.168.xx.2
Plug in gumstix
ifconfig usb0 0.0.0.0 netmask 0.0.0.0 brctl addif br0 usb0
On debian to automate this we use /etc/network/interfaces
A note about the ipaddress for usb0. Debian does not like you creating an interface with address 0.0.0.0 so it is necessay to create a dummy address and adjust it in the post-up section. However that said it works with eth0 in this case.
/etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).
# The loopback network interface auto lo iface lo inet loopback
# The primary network interface
auto eth0 iface eth0 inet static address 0.0.0.0 netmask 0.0.0.0
auto br0 iface br0 inet dhcp pre-up brctl addbr br0 pre-up brctl addif br0 eth0 post-down brctl delbr br0
mapping hotplug script grep map usb0 iface usb0 inet static address 192.168.21.2 netmask 255.255.255.0 post-up ifconfig usb0 0.0.0.0 up post-up brctl addif br0 usb0 post-down brctl delif br0 usb0
A couple of tricks are to turn on debugging in /etc/hotplug/hotplug.functions and remove the --quiet flag from /etc/init.d/dhcp.
Run tail -f /var/log/messages to see what is going on.
Windows DHCP server
Run dhcpmgmt.msc to bring up the DHCP management console. Drill down to the reservations on your scope. Right click on reservations and click "New Reservation" Fill in the following information making mofications where applicable.
Reservation Name: gum1 IP address: 192.168.21.1 MAC address: 06:00:0b:41:4a:c3 Description: Reservation for gumstix module.
Power up the gumstix, wait for it to boot, about 20 seconds and then plug in the USB cable.
Bluetooth Personal Area Network
Option 1
I have configured my Gumstix to form a Personal Area Network connection with my laptop (a Windows XP Tablet) as soon as the Gumstix boots. This required two changes on the Gumstix and one on my laptop.
First, identify the MAC address of your host machine's bluetooth device. Then modify the PAND_OPTIONS setting in /etc/default/bluetooth as follows:
PAND_OPTIONS="--role PANU --service PANU --connect 00:03:7A:0F:CF:7D -Q10"
(You'll want to substitute the bluetooth address of your host device)
Second, modify the bnep0 section of /etc/network/interfaces as follows:
auto bnep0 iface bnep0 inet static address 192.168.1.2 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1 broadcast 192.168.1.255
(You may wish to change the 192.168.1 to 192.168.Something to avoid conflicts with your existing network.)
Finally, I configured the tablet's Bluetooth network adaptor to have a static IP address of 192.168.1.1.
After booting the Gumstix, it connects to the tablet and I'm able to SSH into the Gumstix with Putty.exe.
If Windows is asking for a passkey, you can find what your gumstix passkey is by checking the contents of /etc/bluetooth/pin
Mine was 1234
Option 2
This method works on both Windows and Linux.
On the Gumstix
Modify the bnep0 section of /etc/network/interfaces as above:
iface bnep0 inet static address 192.168.xxx.2 netmask 255.255.255.0 network 192.168.xxx.0 gateway 192.168.xxx.1 broadcast 192.168.xxx.255
Modify /etc/default/bluetooth changing only these items from the original:
RFCOMM_ENABLE=false PAND_OPTIONS="--role PANU --service GN --search --persist"
/etc/init.d/S30bluetooth stop /etc/init.d/S30bluetooth start
On your Linux machine
On a Debian system:
Modify the bnep0 section of /etc/network/interfaces ommitting the gateway:
mapping hotplug
script grep
map bnep0
iface bnep0 inet static
address 192.168.xxx.2
netmask 255.255.255.0
#gateway 192.168.xxx.1
network 192.168.xxx.0
broadcast 192.168.xxx.255
Modify /etc/default/[bluetooth|bluez-utils]:
PAND_ENABLED=1 PAND_OPTIONS="--listen --role GN"
/etc/init.d/[bluetooth|bluez-utils] restart
Now plug in your supported USB Bluetooth dongle and wait for your network to come up.
On your Windows machine
Using the BlueSoleil Software that may come with your USB Dongle. Install sofware and reboot. Plug in bluetooth dongle. Set network device to 192.168.xxx.1 Search for gumstix. Go to: My Services -> Properties -> Personal Area Network and turn off DHCP. The gumstix does not like the packet length of the DHCP.
Go to: My Bluetooth -> Security Set the security level to Medium. Set the default passkey to for example [1234]. Restart the BlueSoleil software.
Your gumstix should come up automatically.
