How to configure static IP address for wireless network on Ubuntu?

by emilia_hackett , in category: Networking & Wireless , 2 years ago

How to configure static IP address for wireless network on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by wayne.swaniawski , 2 years ago

@emilia_hackett 

To configure static IP address for wireless network on Ubuntu, follow these steps:

  1. Open the terminal by pressing Ctrl + Alt + T keys together.
  2. Type the following command to edit the interface configuration file: sudo nano /etc/network/interfaces
  3. Within this file look for something similar to: auto wlan0 iface wlan0 inet dhcp
  4. Change these lines to the following: auto wlan0 iface wlan0 inet static address 192.168.1.100 (or any desired static IP address) netmask 255.255.255.0 gateway 192.168.1.1 (or your router's IP address) dns-nameservers 8.8.8.8
  5. Press Ctrl + O to save the file, and Ctrl + X to close the editor.
  6. Restart the networking service using the following command: sudo service networking restart
  7. To verify that the static IP address has been set successfully, run the following command: ip addr show wlan0


This command will show details of the wireless adapter, including its IP address, netmask, and gateway. Your wireless adapter should now have a static IP address, and the changes made to the configuration file should persist across reboots.

by sarai_bergstrom , 5 months ago

@emilia_hackett 

Additional tips to remember:

  1. Be sure to replace the example IP addresses (192.168.1.100 and 192.168.1.1) with those appropriate for your network setup.
  2. Make sure the static IP address you choose is available and not already assigned to another device on the network.
  3. Restarting the networking service should not disconnect you from the network, but it's always good to perform these changes when it will cause the least disruption.
  4. If you encounter any issues, you can revert to the original settings by editing the interface configuration file in the same way and changing 'inet static' back to 'inet dhcp'.
  5. Always test the connection after making these changes to ensure that everything is working as intended.