How do I configure a network card to automatically obtain an IP address in Linux?

In a Linux system, you can configure network management tools (such as NetworkManager or ifconfig) to set the network card to automatically obtain an IP address. Here are two common methods:

Option 1: Utilize NetworkManager

  1. Open the terminal.
  2. Please open the NetworkManager.conf file using the nano text editor in sudo mode in the /etc/NetworkManager directory.
  3. [ifupdown]
    control is enabled
  4. Save and close the file.
  5. Restart the NetworkManager service using sudo systemctl.

Option 2: Utilizing the ifconfig command.

  1. Open the terminal.
  2. Show all network interfaces.
  3. Find the network interface that needs to be set up for automatically obtaining an IP address (usually starting with “eth” or “wlan”), and remember the name of that interface.
  4. Run the command “sudo dhclient

Both methods will allow the network card to automatically obtain an IP address. If you are using a desktop environment, you will typically use NetworkManager; if you are using a headless server, you can use the ifconfig command.

Leave a Reply 0

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


广告
Closing in 10 seconds
bannerAds