Static IP address

From Tekkotsu Wiki

Jump to: navigation, search

You can force your robot to use a static IP address rather than obtain one dynamically from a DHCP server. Dynamic IP addresses are better because they allow the robot to run on whatever network it finds, but in circumstances where a DHCP server is not available or is not cooperating (e.g., you take your robot to another location and the local network refuses to assign you an IP address, or you're trying to control the robot from someone's laptop and they are unable to set up a DHCP server), use a static address.

We assume the robot is running Ubuntu Linux, or a variant such as Easy Peasy.

Edit the file /etc/network/interfaces:

gedit /etc/network/interfaces

Modify the entry for eth0, or add a new entry if there is none, as follows:

auto eth0
iface eth0 inet static
address    the IP address you've chosen for the robot

To put this change into effect, do:

sudo ifdown eth0         if this fails, ignore it
sudo ifup eth0

If you want to go back to using a dynamic IP address, replace the above lines in /etc/network/interfaces with the following:

auto eth0
iface eth0 inet dhcp