How to Configure Network Settings in Ubuntu

By | 2023-09-01

Managing network settings is a fundamental skill for any system administrator or seasoned Ubuntu user. The Ubuntu operating system offers both graphical and command-line tools to configure your network settings. In this blog post, we’ll guide you through both methods, ensuring you’re equipped to set up your Ubuntu machine on any network.

Using the Graphical Interface (NetworkManager)

For most users, especially those new to Ubuntu, the graphical interface is the easiest way to configure network settings.

Access Network Settings

Click on the network icon in the top-right corner of your screen.

A dropdown menu will appear. Click on ‘Settings’ or ‘Network Settings’, depending on your Ubuntu version.

Wired Connection

If you’re using an Ethernet connection, select ‘Wired’ from the left pane.

You can then toggle the connection on or off, or click on ‘Options’ to access more advanced settings like manual IP configuration, DNS settings, etc.

Wireless Connection

For Wi-Fi connections, click on ‘Wi-Fi’ in the left pane.

You’ll see available networks. Click on your desired network and enter the password if necessary.

For advanced configurations, such as setting a static IP or custom DNS, click on the gear icon next to the connected network.

Using the Command-Line (Netplan)

For advanced users or those running server editions of Ubuntu without a graphical interface, netplan is the go-to tool. It uses YAML configuration files to define and manage network settings.

Locating the Configuration File

The default configuration file is usually located in /etc/netplan/. Navigate to it using cd /etc/netplan/.

List the files using ls. The exact name may vary, but it typically looks like 01-netcfg.yaml or 50-cloud-init.yaml.

Editing the Configuration File

Use a text editor like nano to edit the file, e.g., sudo nano 50-cloud-init.yaml.

Here’s a simple configuration for a static IP on a wired connection:

network:
  version: 2
  renderer: networkd
  ethernets:
   enp3s0:
    dhcp4: no
    addresses:
      - 192.168.1.100/24
    gateway4: 192.168.1.1
    nameservers:
      addresses: [8.8.8.8, 8.8.4.4]

Note: Replace enp3s0 with your network interface name, which you can find using the ip a command.

Applying Changes

After editing and saving the configuration file, apply the changes using the command: sudo netplan apply.

Troubleshooting

If you encounter any issues, you can check your configuration for syntax errors using sudo netplan –debug apply.

Conclusion

Ubuntu offers flexible tools to manage network configurations, catering to both new and experienced users. Whether you’re using the intuitive NetworkManager GUI or the powerful netplan command-line tool, you have the capability to adapt to any networking environment. As with any system changes, ensure you backup configurations and understand the settings you’re adjusting to avoid disruptions.

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.