Network in Ubuntu 18.04 on VirtualBox

NetworkinUbuntu18.04onVirtualBox

Gotodirectory/etc/netplan

Thereisoneexamplefilenamed50-cloud-init.yaml

>cat/etc/netplan/50-cloud-init.yaml

network:

ethernets:

enp0s3:

addresses:[]

dhcp4:true

enp0s8:

dhcp4:no

addresses:[192.168.56.103/24]

gateway4:192.168.56.0

nameservers:

addresses:[8.8.8.8,8.8.4.4]

version:2

Enablethenetwork

>sudonetplanapply

Thenthenetworkiscoolnow.

ifconfig

enp0s3:flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu1500

inet10.0.2.15netmask255.255.255.0broadcast10.0.2.255

inet6fe80::a00:27ff:fe28:fedbprefixlen64scopeid0x20<link>

ether08:00:27:28:fe:dbtxqueuelen1000(Ethernet)

RXpackets2bytes1180(1.1KB)

RXerrors0dropped0overruns0frame0

TXpackets14bytes1618(1.6KB)

TXerrors0dropped0overruns0carrier0collisions0

enp0s8:flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu1500

inet192.168.56.103netmask255.255.255.0broadcast192.168.56.255

inet6fe80::a00:27ff:fea0:f650prefixlen64scopeid0x20<link>

ether08:00:27:a0:f6:50txqueuelen1000(Ethernet)

RXpackets269bytes22943(22.9KB)

RXerrors0dropped0overruns0frame0

TXpackets615bytes58115(58.1KB)

TXerrors0dropped0overruns0carrier0collisions0

lo:flags=73<UP,LOOPBACK,RUNNING>mtu65536

inet127.0.0.1netmask255.0.0.0

inet6::1prefixlen128scopeid0x10<host>

looptxqueuelen1000(LocalLoopback)

RXpackets234bytes15624(15.6KB)

RXerrors0dropped0overruns0frame0

TXpackets234bytes15624(15.6KB)

TXerrors0dropped0overruns0carrier0collisions0

References:

https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-18-04-bionic-beaver-linux

相关推荐