-
Notifications
You must be signed in to change notification settings - Fork 38
Networking
NOTE: It is always a good idea to make a backup copy of any system files you are changing.
To make connecting to and working with the robots easy, we give each robot a static IP address.
The best way to go about this is to edit the /etc/network/interfaces
file. Open the file in your editor of choice and add the following:
# set Ethernet static IP address 192.168.0.101
auto eth0
iface eth0 inet static
address 192.168.0.101
netmask 255.255.255.0
network 192.168.0.0
This will set the IP address of the robot to 192.168.0.101
. Each robot should have a unique address, e.g. 192.168.0.102
.
NOTE: It is possible that the Ethernet adapter on your robot has some other name than eth0. If this is the case just replace any reference to eth0 with the correct name.
You can find instructions for setting a static IP on your personal computer (make sure to pick a different IP address than what you set for the robots):
- Windows7
- MacOS
- Ubuntu: You can do the same to your
/etc/network/interfaces
file or the following commands will set a temporary static IP:
sudo /sbin/ifconfig eth0 down
sudo /sbin/ifconfig eth0 up 192.168.0.204
The wireless network interface can be a little more involved and will depend on the type of network you are trying to connect to. This will go over two typical configurations you might encounter.
These examples assume the wireless network interface is named wlan0.
To setup a static IP address for a wireless network without any required password can be done in a similar fashion as the wired interface through the /etc/network/interfaces
file. The following is what we use on our RoboCup wireless router.
# Static Wireless IP with No Password
auto wlan0
iface wlan0 inet static
address 192.168.1.101
netmask 255.255.254.0
network 192.168.1.0
gateway 192.168.1.1
up iwconfig wlan0 essid robocup
In past RoboCup competitions the official fields have used wireless networks with WEP keys. This is one way to configure the robot using a wpa supplicant to connect to the network.
The /etc/network/interfaces
file should contain the following lines:
# Static wireless IP with WPA Supplicant
auto wlan0
iface wlan0 inet manual
up ifconfig wlan0 up
up wpa_supplicant -iwlan0 -Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf -B
up sleep 1 && ifconfig wlan0 192.168.26.101 netmask 255.255.0.0 && route add -net default gw 192.168.254.6
down killall wpa_supplicant
down ifconfig wlan0 down
You will have to change the IP address (192.168.26.101) and default gateway IP (192.168.254.6) depending on the network you are connecting to.
This configuration also requires you to create a new file /etc/wpa_supplicant/wpa_supplicant.conf
with the following contents depending on the type of security used on the network:
WEP Key:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
ssid="NETWORK NAME"
key_mgmt=NONE
wep_key0=hexpasskey
}
WPA Passkey Key:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
ssid="NETWORK NAME"
key_mgmt=WPA-PSK
psk="PASSKEY"
}
For the wep_key0
and psk
fields, you need quotes if the key is a string key and you should leave out the quotes when using a hex key.
The Nao robots come with a special network manager pre-installed called connman. In order for these instructions to work you need to disable this program. If you followed the Nao setup instructions then this should have already been done.
You can make sure by checking to see if the /etc/rc5.d/S15connman
file exists. If it does then you will need to delete it.