This brief guide shows you how to configure static IP addresses from the command line or console in both Windows 7 and Ubuntu 12.04 (Precise Pangolin). Both Windows 7 and Ubuntu 12.04 have easy-to-use desktop tools to configure network settings, and most people do use them. However, it’s also possible to accomplish the same goal using the command console in these systems, and this tutorial is going to show you how to do it. Although these systems are different, they are similar in many functions. Almost anything you do in Windows 7 can also be done in Ubuntu 12.04. And if you’re just starting out with Ubuntu, coming from Windows 7, then this tutorial will give you a better understand of how Ubuntu works.
- Configure Static IP Addresses from the command console in both Windows 7 and Ubuntu 12.04
How to Setup a Static IP Address using the Command Prompt in Windows 7
To setup a static IP Address in Windows 7 using the command prompt, go to Start –> All Programs –> Accessories –> and right-click on Command Prompt then select ‘Run as administrator’
Finally, copy and paste the commands below on the screen and press Enter.
netsh interface ip set address name="Local Area Connection" static 192.168.0.2 255.255.255.0 192.168.0.1 1
The first set of numbers represent the IP Address, second is Netmask , third Gateway followed by 1
That’s it! Restart your computer and you’re done.
How to Setup a Static IP Address in Ubuntu 12.04 (Precise Pangolin) from the console
To get setup a static IP address in Ubuntu 12.04, press Ctrl – Alt – T on your keyboard to open terminal. When it opens, run the commands below to open the interfaces file.sudo vi /etc/network/interfaces
Finally, type the lines as shown below into the file and save it.iface eth0 inet staticaddress xxx.xxx.x.xnetmask xxx.xxx.xxx.xgateway xxx.xxx.x.x
To insert characters into the file, press the letter ( i ) . Use the arrow keys to move left to right, up, down. To save your work, press the Esc key, then type :wq and press Enter.
Restart your computer and you’re done.