DHCP server

From Tekkotsu Wiki

Jump to: navigation, search

To control a robot via a wired Ethernet connection from a laptop, you can either set up a static IP address on the robot and use that address to connect to the robot from the laptop, or you can set up a DHCP server on the laptop and have it dynamically assign an address to the robot.

DHCP Server Under Ubuntu Linux

1. Install the dhcp server package on the laptop:

sudo -s
apt-get install dhcp3-server

2. Edit the file /etc/defaults/dhcp3-server on the laptop to read

INTERFACES="eth0"

3. Now we must tell the laptop what IP address to give to the robot. Edit the file /etc/dhcp3/dhcpd.conf on the laptop and add the following at the end:

subnet 192.168.1.0 netmask 255.255.255.0 {
  host my-robot {
     hardware ethernet 01:23:45:67:89:ab;
     fixed-address 192.168.1.123;
  }
}

4. The laptop needs an IP address of its own, so we will assign it a static IP address. Edit the file /etc/network/interfaces on the laptop and add the following at the end:

iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0

5. To make sure the robot is configured to activate its wired Ethernet port and acquire an IP address from the laptop via DHCP, add the following lines to /etc/network/interfaces on the robot:

auto eth0
iface eth0 inet dhcp

Whenever you want to activate the DHCP server, do this on the laptop:

sudo ifup eth0
sudo service dhcp3-server start

Once the robot is connected to the laptop, you can check whether it has acquired an IP address by typing the following in a shell on the robot:

ifconfig eth0

To connect to the robot from the laptop using ssh or ControllerGUI, use the IP address you assigned, e.g., 192.168.1.123 in the example above.

DHCP Server on a Mac

Coming soon.