Caution

If you are using SSH to access you gateway, keep in mind that any modification in the network interfaces service could stop temporarily or definitively you SSH access. This manipulation is then not a problem if you can access the terminal through USB but can be very risky if the product is already in the cloud.

Edit the configuration file

The network interface configuration parameters are located in the file /etc/network/interfaces which is a text file. You can edit it using Vi or Nano:

# The loopback interface
auto lo
iface lo inet loopback
CODE

Static configuration

For a static configuration, you can edit the eth0 interface section as follow:

# Main wired interface
auto eth0
iface eth0 inet static
  address 
  netmask 
  gateway 
  dns-nameservers 
CODE

The default value after a factory RESET:

# Main wired interface
auto eth0
iface eth0 inet static
  address 192.168.1.50
  netmask 255.255.255.0
  gateway 192.168.1.1
  dns-nameservers 192.168.1.1
CODE

Dynamic configuration (DHCP)

For a dynamic configuration, you can edit the eth0 interface section as follow:

# Main wired interface
auto eth0
iface eth0 inet dhcp
CODE

Applying the modifications

Once the configuration file modified, you need to restart the networking service using the following command:

$ sudo /etc/init.d/networking restart
CODE

The service can be stopped or started as well with the "stop" or "start" argument but be careful with stop which could stop definitely you SSH connection once applied.