Software & AppsOperating SystemLinux

How To Set Domain Search on Ubuntu 18.04 Without Rebooting

Ubuntu 9

In this article, we will learn how to set the domain search on Ubuntu 18.04 without rebooting. This is a common task for system administrators and developers who need to configure their network settings.

Quick Answer

Yes, it is possible to set the domain search on Ubuntu 18.04 without rebooting. You can use the Network Manager editing GUI, edit the Netplan configuration file, or use the nmcli command-line tool to configure the domain search settings.

What is a Domain Search?

A domain search is a list of domains that the system will search when resolving a hostname. For instance, if you have a domain search set to example.com, and you try to access a server named server1, the system will automatically try to access server1.example.com.

Setting Domain Search Using Network Manager Editor

The first method to set the domain search is by using the Network Manager editing GUI. This is a graphical interface that allows you to edit advanced network settings. Here’s how to do it:

  1. Open a terminal by pressing Ctrl + Alt + T.
  2. Type nm-connection-editor and press Enter. This will open the Network Manager editing GUI.
  3. Select the connection you want to edit and click on the Edit button.
  4. In the IPv4 Settings tab, you will find the Search domains field where you can enter your domain search values.
  5. After making the changes, click on the Save button.

Please note that you will need to disconnect and reconnect the network connection for the updates to apply.

Setting Domain Search Using Netplan Configuration

Ubuntu 18.04 uses Netplan for networking configuration. You can set the domain search by editing the Netplan configuration file. Here’s how to do it:

  1. Open a terminal.
  2. Type sudo nano /etc/netplan/50-cloud-init.yaml and press Enter. This will open the Netplan configuration file in a text editor.
  3. Look for the ethernets section and add the search field with your desired domain search values. It should look like this:
network:
 version: 2
 renderer: networkd
 ethernets:
 enp0s3:
 dhcp4: yes
 dhcp6: yes
 search:
 - example.com
  1. After saving the file, apply the changes by running sudo netplan apply.

Setting Domain Search Using nmcli Command-line Tool

You can also set the domain search through the command line using the nmcli tool. Here’s how to do it:

  1. Open a terminal.
  2. Type nmcli c show and press Enter. This will list the available connections.
  3. Modify the desired connection using the following command:
nmcli c modify "Connection Name" ipv4.dns-search "example.com"

Replace “Connection Name” with the name of your connection and “example.com” with your desired domain search.

  1. Finally, bring down and up the connection using the following command:
nmcli c down "Connection Name" && nmcli c up "Connection Name"

Conclusion

Setting the domain search on Ubuntu 18.04 without rebooting is a straightforward process. You can use the Network Manager editing GUI, edit the Netplan configuration file, or use the nmcli command-line tool. Remember to disconnect and reconnect the network connection or restart the NetworkManager service for the changes to take effect.

What is the purpose of setting the domain search on Ubuntu 18.04?

The purpose of setting the domain search is to allow the system to automatically search for a domain when resolving a hostname, making it easier to access servers within the specified domain.

Do I need to reboot after setting the domain search on Ubuntu 18.04?

No, you do not need to reboot after setting the domain search. However, you will need to disconnect and reconnect the network connection or restart the NetworkManager service for the changes to take effect.

Can I set multiple domain search values?

Yes, you can set multiple domain search values by separating them with a comma or adding them as separate items in a list, depending on the method you are using to set the domain search.

Will setting the domain search affect other network settings?

Setting the domain search should not affect other network settings. It is a specific configuration that determines the order in which the system searches for domains when resolving hostnames.

Can I set the domain search for specific connections only?

Yes, you can set the domain search for specific connections only. The methods mentioned in the article allow you to modify the domain search settings for individual connections.

How can I verify if the domain search is set correctly?

You can verify if the domain search is set correctly by using the nmcli command-line tool and running the command nmcli c show [connection name]. It will display the connection details, including the domain search settings.

Is there a limit to the number of domain search values I can set?

There is no specific limit to the number of domain search values you can set. However, it is recommended to keep the list concise and relevant to your network configuration for optimal performance.

Can I set the domain search using DHCP?

Yes, you can set the domain search using DHCP. If your network uses DHCP to assign IP addresses, you can configure the DHCP server to include the domain search option in the DHCP lease, and the client will automatically receive and use the specified domain search values.

Will changing the domain search affect existing connections?

Changing the domain search should not affect existing connections. However, for the changes to take effect, you will need to disconnect and reconnect the network connection or restart the NetworkManager service.

Can I set the domain search using a wildcard value?

Yes, you can set the domain search using a wildcard value. For example, you can set the domain search as *.example.com, and the system will search for any subdomain under example.com when resolving hostnames.

Leave a Comment

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