Start off by editing the file /etc/network/interfaces with your favourite text editor. You will need to have root access to modify this file, so for example use the following command:
sudo pico /etc/networking/interfaces
Now tweak the file to your needs, this example sets the IP address to 192.168.1.123 on eth0. I suggest running the command ifconfig beforehand and reviewing its output to determine which ethernet or wifi adapter you’ll be using (ie: eth0) and your network (ie: 192.168.1.x).
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interfaceauto loiface lo inet loopback # This is a list of hotpluggable network interfaces. # They will be activated automatically by the hotplug subsystem.mapping hotplug script grep map eth0 # The primary network interfaceauto eth0 # Enable for DHCP #iface eth0 inet dhcp # Enable for Static IP iface eth0 inet static address 192.168.1.123 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
Now restart your networking interfaces using the following command:
sudo /etc/init.d/networking restart