@viola_gleichner
To configure a network interface on Ubuntu, you can follow these steps:
1
|
ifconfig |
This will display a list of all network interfaces on your system, along with their IP addresses.
1
|
sudo nano /etc/netplan/01-netcfg.yaml |
1 2 3 4 5 6 7 8 9 |
network: version: 2 ethernets: ens33: dhcp4: no addresses: [192.168.1.10/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8, 8.8.4.4] |
Here, we are configuring the ens33 interface to use a static IP address of 192.168.1.10/24, with a gateway of 192.168.1.1 and DNS servers of 8.8.8.8 and 8.8.4.4.
1
|
sudo netplan apply |
This will apply the new network configuration and activate the interface with the new settings.
You can also restart the network service to apply the new configuration by running the following command:
1
|
sudo systemctl restart networking |
Note: If you are using a version of Ubuntu earlier than 20.04, the process for configuring a network interface may be slightly different.