1

I'm working on Raspberry Pi board with Ubuntu OS but it's not detecting the LAN connection and I am not getting an IP address when I type ifconfig.

I've added below code to /etc/netplan/01-config.yaml:

version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: yes
      addresses: [192.168.0.1/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

And executed the command dhclient etho but still I am not able to get an IP address, how can I solve this issue?

1

assuming eth0 is the name of your network interface and 192.168.0.1 is the ip of your gateway,

if you want your pi on dhcp, try this config:

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: yes
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

if you want a static ip: (lets say 192.168.0.15)

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses: [192.168.0.15/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

after saving, run

sudo netplan apply
  • You should mention in your answer (please don't use a comment) where to do these entries. – Ingo Nov 15 '19 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.