Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Ubuntu Network Setup: Configure Your Connection Easily

· 5 min read · Home Networking

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Advanced Configuration with Netplan
  7. Wireless Configuration via Terminal
  8. Frequently Asked Questions

Setting up a network on Ubuntu ensures your system can access the internet and connect to other devices on your network. This guide walks you through configuring wired and wireless connections using the built-in tools. You'll learn how to check connection status, modify settings, and troubleshoot common issues.

What You'll Need

  • An Ubuntu system with a working desktop or server
  • A wired Ethernet cable or a wireless network
  • Superuser (sudo) access
  • Basic understanding of IP addressing and DNS for manual configurations
  • Internet access to download updates if needed

Step-by-Step

  1. Open the Network Settings: Go to the system menu (top-right corner) and click the network icon. Select "Settings" or "Network Settings" to open the Network Manager. If you're using a server edition without a GUI, use the terminal and edit the Netplan configuration file in /etc/netplan/.
  2. Choose Your Connection Type: Select either "Wired" or "Wi-Fi" depending on the type of connection you're setting up. The Network Manager typically auto-detects the interface and prompts for configuration.
  3. Connect to a Wired Network: If using an Ethernet cable, plug it into your machine and the router. The system should detect the connection automatically. If not, click "Wired" in the settings, then "Settings", and ensure the "Automatic (DHCP)" option is selected. For static IP setups, switch to the "Manual" option and input the correct IP address, gateway, and DNS server information.
  4. Connect to a Wireless Network: Under the Wi-Fi tab, select your network from the list. Enter the password, if required. Click "Connect" to join the network. If the network is hidden, manually enter the SSID. Make sure the security type (WPA/WPA2) matches the router's settings.
  5. Configure IP Settings: In the network settings, click "IPv4" or "IPv6" tab and choose "Automatic" for most home and office networks. If your network requires a static IP, enter the IP address, subnet mask, gateway, and DNS manually. Validate that the IP address is within the correct range for your network (e.g., 192.168.1.x for most home networks).
  6. Save and Apply Changes: After configuring the settings, click "Apply" or "Save" to ensure the changes take effect. Your system should connect automatically within moments. If using Netplan, apply your changes with sudo netplan apply to activate the new configuration.
  7. Verify the Connection: Click the network icon again and check if the connection is active. Open a browser and try visiting a website to confirm internet access. Use ping google.com in the terminal to test connectivity and DNS resolution.

Common Mistakes

One of the most common mistakes is trying to connect to a Wi-Fi network without entering the correct password. Another is using an incorrect IP configuration when a static IP is required. Users may also forget to restart the network manager or reboot the system after making changes. Forgetting to include the correct DNS servers in a static IP setup can also prevent DNS resolution.

Tips

Always use the built-in Network Manager for Ubuntu to configure connections. For advanced setups, use the nmcli command-line tool. If you're setting up a server without a GUI, use netplan located in /etc/netplan/ and run sudo netplan apply after editing the YAML file. For Wi-Fi on servers, use the nmcli utility or manually edit the netplan configuration file to include Wi-Fi settings.

Troubleshooting

If your network connection is not working after setup, try these steps:

  1. Restart the network manager: Run sudo systemctl restart NetworkManager in the terminal.
  2. Check for physical issues: Ensure Ethernet cables are securely connected and the wireless adapter is enabled. Use ip link to verify the network interface status.
  3. Test with another device: If possible, test the same network with another device to rule out network issues.
  4. Reset network settings: Go to Network Settings and click "Forget" on the problematic connection, then reconnect.
  5. Update your system: Run sudo apt update && sudo apt upgrade to apply the latest updates and fixes.

Advanced Configuration with Netplan

On Ubuntu server or systems without a GUI, netplan is the preferred tool for configuring network interfaces. It uses YAML files in /etc/netplan/. For example, a basic wired setup might look like this:

network:
  version: 2
  ethernets:
    enp0s3:
      dhcp4: true
      optional: true

For a static IP setup, the file would look like:

network:
  version: 2
  ethernets:
    enp0s3:
      addresses:
        - 192.168.1.100/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4

After editing the file, validate it with sudo netplan try before applying with sudo netplan apply.

Wireless Configuration via Terminal

For Wi-Fi configuration on servers or headless systems, use the nmcli tool. To connect to a wireless network, run:

nmcli device wifi connect "MyNetworkSSID" password "MyPassword" ifname wlan0

Replace MyNetworkSSID and MyPassword with your network's name and password, and wlan0 with your wireless interface name. You can list available networks with nmcli device wifi list.

Frequently Asked Questions

How do I check my IP address?

Open a terminal and type ip a or hostname -I to display your current IP address. Alternatively, use ip addr show for detailed interface information.

Can I use Netplan for Wi-Fi?

No, Netplan does not support Wi-Fi configuration. Use Network Manager or nmcli for Wi-Fi setups instead.

How do I set up a static IP?

In Network Settings, go to the IPv4 or IPv6 tab and select "Manual". Enter the IP address, gateway, subnet mask, and DNS server manually. For server setups, edit the netplan YAML file and apply the changes with sudo netplan apply.

Why is my connection dropping frequently?

Weak signal strength, outdated drivers, or incorrect IP configurations are common causes. Check signal strength and update your system drivers if needed. Use iwconfig for wireless interfaces to verify signal strength and connection status.

Can I connect to multiple networks at once?

Ubuntu does not support multiple active network connections simultaneously in most desktop environments. You can only be connected to one network at a time. For advanced routing, consider using ip route or iptables to manage traffic routing.