1

sudo nano /etc/netplan/00-installer-config.yaml after I installed my ubuntu server, I cannot access the internet. I am able to access it from my network. Any idea what would it be? I installed the basic/default settings.

Thanks


pctech@live:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defaul
t qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group de
fault qlen 1000 link/ether 00:50:56:b1:66:36 brd ff:ff:ff:ff:ff:ff
inet 192.168.51.111/22 brd 192.168.51.255 scope global dynamic ens160
valid_lft 604225sec preferred_lft 604225sec
inet6 fe80::250:56ff:feb1:6636/64 scope link
valid_lft forever preferred_lft forever


pctech@live:~$ cat /etc/netplan/*.yaml

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      dhcp4: true
  version: 2

pctech@live:~$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Aug 24 08:42 /etc/resolv.conf -> ../run/systemd/resolv
4
  • 1
    Please edit your question to show the result of the terminal commands: ip addr show and also: cat /etc/netplan/*.yaml and, finally: ls -al /etc/resolv.conf Welcome to Ask Ubuntu.
    – chili555
    Dec 24, 2021 at 18:14
  • ok. just edited my question. thanks
    – tebong
    Dec 24, 2021 at 18:25
  • Do you mean: /etc/resolv.conf -> /run/systemd/resolve/resolv.conf ?
    – chili555
    Dec 24, 2021 at 18:25
  • Hi chili555, yes
    – tebong
    Dec 24, 2021 at 18:26

1 Answer 1

1

Please amend your netplan file. First, find out it's exact name:

ls /etc/netplan

Next, edit the file:

sudo nano /etc/netplan/<what_you_found>.yaml

Amend it to read:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: true

Netplan is very specific about spacing, identation, etc. so proofread carefully twice. Save (Ctrl+o followed by Enter) and exit the text editor nano (Ctrl+x followed by Enter).

Follow with:

sudo netplan generate
sudo netplan apply

Test:

ping -c3 8.8.8.8
ping -c3 www.ubuntu.com

If you get ping returns from both, you're all set.

9
  • I still cannot ping. I tried to paste in the comment how it was spaced but not sure how you spaced it here. i will update the question with a snapshot.
    – tebong
    Dec 24, 2021 at 18:50
  • Your snapshot appears correct. Did you try a reboot? Are there any clues in the message log? sudo dmesg | grep ens
    – chili555
    Dec 24, 2021 at 18:56
  • pctech@live:~$ ls /etc/netplan<br> 00-installer-config.yaml<br> pctech@live:~$ sudo nano /etc/netplan/00-installer-config.yaml<br> pctech@live:~$ sudo netplan generate<br> pctech@live:~$ sudo netplan apply<br> pctech@live:~$ ping -c3 8.8.8.8<br> PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.<br> <br> --- 8.8.8.8 ping statistics ---<br> 3 packets transmitted, 0 received, 100% packet loss, time 2036ms<br>
    – tebong
    Dec 24, 2021 at 18:56
  • ok here it is:<br>pctech@live:~$ sudo dmesg | grep ens [sudo] password for pctech: [ 0.168888] ACPI: Added _OSI(3.0 _SCP Extensions) [ 1.540115] vmxnet3 0000:03:00.0 ens160: renamed from eth0 [ 1.997093] sd 32:0:0:0: [sda] Mode Sense: 61 00 00 00 [ 7.173425] vmxnet3 0000:03:00.0 ens160: intr type 3, mode 0, 3 vectors allocated [ 7.174286] vmxnet3 0000:03:00.0 ens160: NIC Link is Up 10000 Mbps
    – tebong
    Dec 24, 2021 at 18:59
  • I think you failed to mention that this is a virtual machine.
    – chili555
    Dec 24, 2021 at 19:06

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.