In Ubuntu 17.04 and later, including Ubuntu 21.04, network configuration has been managed using Netplan. You can set the default gateway in Ubuntu 21.04 by configuring Netplan. Here's how you can do it:
First, you need to determine the name of your network interface. You can do this by running the following command:
bash
Copy code
ip a
Look for the interface that you're using for your internet connection (e.g., eth0, enp0s3, or wlan0). Note down the interface name.
Create a .yaml configuration file in the /etc/netplan/ directory. You can use a text editor to create a configuration file. For example, you can use the nano text editor:
bash
Copy code
sudo nano /etc/netplan/99-custom-gateway.yaml
Replace 99-custom-gateway.yaml with a filename of your choice, but make sure it ends with the .yaml extension.
In the configuration file, you need to specify the network configuration. For example, if your interface name is eth0, you can create a configuration file like this:
yaml
Copy code
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
addresses:
- your_ip_address/your_subnet_mask
gateway4: your_gateway_ip
Replace eth0, your_ip_address, your_subnet_mask, and your_gateway_ip with your actual network configuration. If you're using DHCP for address assignment, set dhcp4 to yes.
Save the file and exit the text editor.
Apply the configuration changes by running:
bash
Copy code
sudo netplan apply
Reboot your system to ensure that the changes persist after a restart:
bash
Copy code
sudo reboot
Your default gateway should now be set, and it will persist after a restart. Please be sure to replace the placeholder values in the YAML configuration file with your actual network configuration details.
krogerfeedbacktellthebellmycfavisitdgcustomerfirsthelpmeloginbazoocam