Network Configuration by netplan
For Example we want to set IPv4 192.168.10.10 on our ubuntu machine, here is a sample of yml file
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: false
dhcp6: false
addresses:
- 192.168.10.10/24
routes:
- to: default
via: 192.168.10.1
nameservers:
addresses: [192.168.10.1]
In the above configuration:
eth0
– is the network interface nameaddresses
– is used to configure IPv4 address on an interface. Make sure to define CIDR. You can add multiple addresses herenameservers
– Set the name servers here. 8.8.8.8 and 8.8.4.4 are Google’s name serversroutes
– This is used to set gateway on your system.
Make sure the IPv4 address belongs to the system network and has the correct gateway Ip address. Once confirmed, save file content and close it.
after editing yml file which should be exist in this path /etc/netplan, should run these 2 commands:
sudo netplan generate
sudo netplan --debug apply
Nginx – Apache
check status of services:
systemctl status apache2
systemctl status nginx