Summary of ubuntu20.04 network configuration

Post a picture first. This article uses the virtual machine built by the virtualbox tool, so other tools are not guaranteed to be of reference value.
insert image description here
enp0s3: here is to configure the Bridged mode, which is used to communicate with the host;
enp0s8: here is to configure the NTP mode, which is used to access the external network; this seems to be automatically configured after the installation. So you only need to add another network card enp0s3 for bridging.

The configuration of enp0s3 is as follows, it is set on the same network segment as the host (if using a wifi network card, use the wifi ip network segment), and the gateway should be consistent with the gateway of the host:

sudo vim /etc/netplan/01-network-manager-all.yamlinsert image description here
sudo netplan apply#Make the configuration take effect
(restarting the network is available: sudo systemctl restart NetworkManager)
Finally, remember to turn off the firewall:sudo systemctl stop ufw && sudo systemctl disable ufw

Guess you like

Origin blog.csdn.net/sinat_36050376/article/details/122377644