How to create network in Ubuntu 20.04 from ethernet Cable

I have Ubuntu server and I need to connect it to the internet. Its local Ip address is 192.168.0.124. This Server gets the internet from another server using switch ethernet cable. The main server that gives the internet has its private Ip address and has local Ip address 192.168.0.254. Main server gives the internet also to other Gentoo server which has 192.168.0.106 ip iddress. I saw Gentoo server /etc/conf.d/net file and there is written like below.

config_eth0="192.168.0.106/24"
routes_eth0="default via 192.168.0.254"

In second Gentoo server internet is working fine but in Ubuntu server internet is not working. I don't know where to start. Can you please give me some instructions on how to configure it correctly. Which files to change? I connecter ethernet cable correctly, only thing that I should show its internet Ip that comes from 192.168.0.254 server.


I finally resolved an issue. It was related with netplan. I changed configuration file /etc/netplan/ .conf

network: 
   version: 2
   renderer: networkd
   ethernets:
      enp5s0:
        dhcp4: true
        dhcp6: true

Then type netplan apply to apply changes. In some cases enp5s0 can be different for example eth0. It is ethernet name.