- Open the configuration file in your favorite editor (mine is nano)
sudo nano /etc/network/interfaces
- Comment out the section where dhcp is being used (put the # in front of the line):
#iface eth1 inet dhcp
- Add a section like this example:
iface eth1 inet static
- Close and save the file
- Reload the network service:
sudo /etc/network restart
- Check to make sure you can access other computers/internet by using ping:
- If you don't get a response then you may have set your network information incorrectly. Just go back and repeat this process at step 3.
Wednesday, January 21, 2009
Create a Static IP from the Command Line
Creating a static IP from the command line is a very short task. All you need to edit is one configuration file and restart the networking service. You will need to know the settings for your network to do this. I will show how to set a static IP of 192.168.0.101 on a network with a gateway of 192.168.0.1.