Setting a static IP address ensures your computer always uses the same IP, useful for network stability and certain applications. This tutorial will guide you through the process on Windows 7, Ubuntu 14, and OS X 10.
What is a Static IP Address?
A static IP address is a fixed IP address that is assigned to a device on a network. This is in contrast to a dynamic IP address, which is assigned to a device by a DHCP server.
Static IP addresses are often used for servers and other devices that need to be accessible from other devices on the network at all times.
While you are on your way to set the static IP address, ensure you have the required access to do so. In most cases, you will require either an admin or root access to perform such operations.
Let’s now dive into learning the techniques lined up in this tutorial.
Also Read: How to Install MySQL on Ubuntu and Debian OS
How to Set a Static IP on Windows?
There are two ways to set a static IP on Windows.
Using the Control Panel
- Open the Control Panel.
- Click “Network and Internet”.
- Click “Network and Sharing Center”.
- Click “Change adapter settings”.
- Right-click on the network adapter for which you want to set the static IP address and select “Properties”.
- Click the “Internet Protocol Version 4 (TCP/IPv4)” checkbox and then click “Properties”.
- Select the “Use the following IP address” radio button and enter the IP address, subnet mask, gateway address, and DNS server addresses that you want to use.
- Click “OK” to save your changes.
Using the Command Prompt
- Open a command prompt window.
- Type the following command and press Enter:
netsh interface ip show config
This will display a list of all the network adapters on your computer.
- Identify the name of the network adapter for which you want to set the static IP address.
- Type the following command and press Enter, replacing `<network_adapter_name>` with the name of the network adapter that you identified in step 3:
netsh interface ip set address <network_adapter_name> static <ip_address> <subnet_mask> <gateway_address> <dns_server_address>
Replace <ip_address>
, <subnet_mask>
, <gateway_address>
, and <dns_server_address>
with the IP address, subnet mask, gateway address, and DNS server address that you want to use.
- Click “OK” to save your changes.
Must Read: 30 Linux Questions One Should Know for Interview
How to Set a Static IP on Ubuntu
There are two ways to set a static IP on Ubuntu:
Using the Network Manager
- Click the network icon in the top right corner of the screen and select “Edit Connections”.
- Select the network connection for which you want to set the static IP address and click “Edit”.
- Click the “IPv4 Settings” tab.
- Select the “Manual” method.
- Enter the IP address, subnet mask, gateway address, and DNS server addresses that you want to use.
- Click “Save”.
Using the Command Line
- Open a terminal window.
- Type the following command and press Enter:
sudo nano /etc/network/interfaces
This will open the network interfaces configuration file in a text editor.
- Find the section for the network interface for which you want to set the static IP address.
- Make sure that the following lines are uncommented:
iface <network_interface_name> inet static
address <ip_address>
netmask <subnet_mask>
gateway <gateway_address>
Replace <network_interface_name>
, <ip_address>
, <subnet_mask>
, and <gateway_address>
with the name of the network interface, IP address, subnet mask, and gateway address that you want to use.
- Save the file and exit the text editor.
- Restart the networking service by running the following command:
sudo service networking restart
Do you know what is a static method in Python? Check out.
How to Set a Static IP on OS X 10
To set a static IP on OS X 10, follow these steps:
- Open System Preferences.
- Click “Network”.
- Select the network connection for which you want to set the static IP address and click “Advanced”.
- Click the “TCP/IP” tab.
- Select the “Manually” option.
- Enter the IP address, subnet mask, gateway address, and DNS server addresses that you want to use.
- Click “OK” to save your changes.
Conclusion
In this tutorial, we’ve shown you how to set a static IP address on Windows, Ubuntu, and OS X. By following these steps, you can achieve network stability and tailor your device’s connection to your specific needs.
Remember to use a static IP responsibly and ensure it doesn’t conflict with other devices on your network. If you want us to cover a topic of your choice, let us know. Hit the comment box and write your wish. We’ll certainly publish it next.
Happy Learning!