How to configure the network after Ubuntu system is installed?

How to configure the network after Ubuntu system is installed?

The steps to configure the network after installing ubuntu are as follows: 1. Check the network connection and use the ping command to test whether you can access external websites. 2. The desktop version can set IP and DNS through the graphical interface; 3. The server version needs to use the command line to edit the netplan configuration file to achieve static IP configuration. 4. Check for driver, DNS settings, or NetPlan syntax errors when encountering problems.

How to configure the network after Ubuntu system is installed?

After installing the Ubuntu system, configuring the network is the first step in using it. Most of the time, Ubuntu will automatically connect to available networks, but sometimes you may need to manually set up your IP address, DNS, or connect to a wireless network. Here are some common scenarios and operational suggestions to help you quickly configure your network.

How to configure the network after Ubuntu system is installed?


1. Check if there is an internet connection

After the installation is completed, check whether it is connected to the Internet. You can open a terminal (Ctrl + Alt + T) and enter the following command:

How to configure the network after Ubuntu system is installed?

1

ping -c 4 www.baidu.com

Copy after logging in

If you can receive a response packet, it means that the network is already connected, and this step is complete. If there is no response, it may not be connected to Wi-Fi, or the wired connection does not automatically obtain an IP.

  • If it’s the desktop version, click the network icon in the upper right corner to check if you’re connected to a Wi-Fi or wired network.
  • If it is a server version, you need to use the command line operation, which will be mentioned later.

2. Configure the network using the graphical interface (for desktop version)

If you’re using the desktop version of Ubuntu, the graphical interface is the easiest way to do it:

How to configure the network after Ubuntu system is installed?

  • Tap the network icon in the top right corner and select “Settings” or “Network Settings”
  • In “Wiredor Wi-Fi tab, you can turn on/off the network and select different network interfaces
  • To modify your IP address or DNS:
    • Click the gear icon next to the name of the network you are currently connected to
    • Go to the IPv4 tab:
      • If you want the router to automatically assign IPs, select “DHCP”
      • If you need to fix the IP, select Manual, and then fill in the address, gateway, DNS, and other information

This method is suitable for most people, especially those who are new to Linux.


3. Configure the network using the command line (for server version or remote environment)

If you’re using Ubuntu Server, or connecting to a server via SSH, you’ll need to configure your network from the command line.

Check the network interface name:

1

ip a

Copy after logging in

You’ll see interface names like enp0s3, eth0, or wlan0.

Modify the network profile:

Ubuntu is available from 17.10NetplanAs the default network configurationtoolThe configuration file is usually in the /etc/netplan/ directory, such as 01-netcfg.yaml or similar file name.

You can edit it with the following command:

1

sudo nano /etc/netplan/01-netcfg.yaml

Copy after logging in

An example of a basic static IP configuration is as follows:

1

2

3

4

5

6

7

8

9

10

11

12

network:

  version: 2

  ethernets:

    enp0s3:

      dhcp4: no

      addresses:

        - 192.168.1.100/24

      gateway4: 192.168.1.1

      nameservers:

        addresses:

          - 8.8.8.8

          - 8.8.4.4

Copy after logging in

Save the app configuration:

1

sudo netplan apply

Copy after logging in

Note: The YAML format is sensitive to indentation, so be careful with spaces when writing to avoid grammatical errors.


4. Common problems and troubleshooting skills

  • Can’t connect to Wi-Fi?

    • Some wireless cards require additional driver support, especially laptopsComputer。 You can try going to Software & Updates – > Additional Drivers to see if there are any drivers that are not enabled.
  • Correct network configuration but no internet access?

    • To check whether the DNS is set correctly, you can use cat /etc/resolv.conf to check the current DNS.
    • Try switching to a public DNS like Google’s 8.8.8.8 or Cloudflare’s 1.1.1.1.
  • What should I do if I get an error in Netplan?

    • Perform netplan try instead of applying directly, so that errors are automatically rolled back.
    • If you make a mistake and cannot connect to the Internet, you can log in to the local terminal or VPS console to modify it.

Basically, that’s all there is to it. Network configuration is not complex, but it is prone to errors due to formatting, spelling, or permissions. As long as you sort out the key points of interface name, IP segment, gateway and DNS, you can connect to the network smoothly.

That’s all for UbuntuSystem installationHow do I configure the network? For more details, please pay attention to other related articles on the PHP Chinese website!

评论已关闭。