0

Now I'm trying to set up static IP using netplan in ubuntu-server(18.04) on VM VirtualBox. I can access ubuntu-server(in VM) using putty in my local desktop, but ubuntu-server cannot access the internet.

There are my network settings and netplan setting.

VirtualBox Network Settings

Network

Host Network Manager

ubuntu-server Network Settings

Adapter1: NAT

Adapter2: Host-only Adapter

# /etc/netplan
# before

$ ls -al

drwxr-xr-x  2 root root 4096 Dec 24 16:20 .
drwxr-xr-x 94 root root 4096 Dec 24 12:46 ..
-rw-r--r--  1 root root  529 Dec 24 16:20 50-cloud-init.yaml

# /etc/netplan/50-cloud-init.yaml
network:
    ethernets:
        enp0s3:
            dhcp4: true
    version: 2
# /etc/netplan
# after

$ ls -al

drwxr-xr-x  2 root root 4096 Dec 24 16:53 .
drwxr-xr-x 94 root root 4096 Dec 24 12:46 ..
-rw-r--r--  1 root root  529 Dec 24 16:20 01-netcig.yaml
-rw-r--r--  1 root root  383 Dec 24 16:53 50-cloud-init.yaml

# /etc/netplan/50-cloud-init.yaml
network:
    ethernets:
        enp0s3:
            dhcp4: true
    version: 2
# /etc/netplan/01-netcig.yaml
network:
    ethernets:
        enp0s8:
            addresses: [192.168.56.102/24]
            gateway4: 192.168.56.1
            dhcp4: no
            nameservers:
                addresses: [8.8.8.8,8.8.4.4]
    version: 2
$ ifconfig

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:fe4e:ace4  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:4e:ac:e4  txqueuelen 1000  (Ethernet)
        RX packets 2  bytes 1180 (1.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 1328 (1.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.102  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:fe9d:f985  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:9d:f9:85  txqueuelen 1000  (Ethernet)
        RX packets 105  bytes 10500 (10.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 69  bytes 10361 (10.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 80  bytes 5920 (5.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 80  bytes 5920 (5.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I can access ubuntu-server using putty on my local desktop, but my ubuntu-server can't access the internet. I can't send ping www.google.com and I can't command 'apt-get update'.

Please, help me.

What is the problem....

  • 1
    Have you created one or two ethernet interfaces? – heynnema Dec 24 '19 at 17:49
  • Yes, I created two ethernets (enp0s3, enp0s8) – 박현근 Dec 25 '19 at 1:23
  • Which port works, and which one doesn't? Any reason not to use bridge mode, and get addresses in your primary subnet? – heynnema Dec 25 '19 at 1:31
  • port 53, 22 are working. enp0s3 is NAT, enp0s8 is Host-only. I set up both of them. And I attached Network Host Network Manager information image upside. – 박현근 Dec 25 '19 at 1:54
  • Thank you for the info. But it doesn't tell me which interface is working. enp0s3 or enp0s8? – heynnema Dec 25 '19 at 3:57

Your Answer

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

Browse other questions tagged or ask your own question.