Network configuration on VirtualBox Ubuntu18.04

lichengbei

2019-12-21

NAT Network:

   

Host-only network:

   

Modify the network configuration file:

root@ubuntu1804:~# vim /etc/netplan/50-cloud-init.yaml

network:

    ethernets:

            enp0s3:

                    dhcp4: yes

                    nameservers:

                            addresses: [223.5.5.5,223.6.6.6]

            enp0s8:

                    addresses:

                            - 172.16.0.10/16

    version: 2

 

Validate the configuration

root@ubuntu1804:~# netplan apply

 

Check to verify network configuration to take effect situation

root@ubuntu1804:~# ifconfig

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

        inet 10.0.2.4  netmask 255.255.255.0  broadcast 10.0.2.255

        inet6 fe80::a00:27ff:fee2:e241  prefixlen 64  scopeid 0x20<link>

        ether 08:00:27:e2:e2:41  txqueuelen 1000  (Ethernet)

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

        inet 172.16.0.10  netmask 255.255.0.0  broadcast 172.16.255.255

        inet6 fe80::a00:27ff:fe4b:bacd  prefixlen 64  scopeid 0x20<link>

        ether 08:00:27:4b:ba:cd  txqueuelen 1000  (Ethernet)

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)

Guess you like

Origin www.cnblogs.com/lichengbei/p/12079068.html