How to set a fixed IP based on Ubuntu 16.04

Foreword

This article mainly introduces you to the related content of setting fixed IP on Ubuntu 16.04, and share it for your reference and study. I won't say much below, let's take a look at the detailed introduction.

Methods as below:

First explain that this is done on the vm virtual machine under mac

1. Add virtual network card on vm

Open vm's preferences

Enter ifconfig on the local terminal

You can see that this is the virtual network card just joined

2. Set up the virtual machine network adapter

At this time, the virtual machine is randomly allocated from 192.168.219.3 to 192.168.219.254, but we need to configure it in the system itself if we need a fixed allocation.

3. ubuntu system assigns fixed ip

Enter sudo vim /etc/network/interfaces

Add the following content in it (the original content needs to be cleared)

auto ens33
iface ens33 inet static
address 192.168.219.100
netmask 255.255.255.0
gateway 192.168.219.2
dns-nameservers 192.168.219.2

Let's explain in detail below

auto ens33
iface ens33 inet static
# Assigned fixed ip 192.168.219 is determined based on your virtual network card, which has been allocated in the first step
address 192.168.219.100
# Fixed subnet mask
netmask 255.255.255.0
# The default gateway is x.x.x.2 But the vm under windows can be set by yourself, I did not find it on the mac
gateway 192.168.219.2
# The dns input is the same as the gateway
dns-nameservers 192.168.219.2

Only need to restart the network after completion

sudo /etc/init.d/networking restart

Recommended Posts

How to set a fixed IP based on Ubuntu 16.04
How to configure a fixed IP based on Ubuntu 18.04
How to set static IP on Ubuntu 18.04 Server
ubuntu16.0.4 method to set a fixed IP address
How to set up a DNS server on Ubuntu 18.04
How to set up a Masterless Puppet environment on Ubuntu 14.04
How to set up a firewall with UFW on Ubuntu 14.04
How to set up a production Elasticsearch cluster on Ubuntu 14.04
How to set static IP in ubuntu14.04
How to set PostgreSQL startup on Ubuntu 16.04
How to set up Shiny Server on Ubuntu 14.04
How to set up time synchronization on Ubuntu 18.04
How to start a blog with Hexo on Ubuntu 14.04
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to deploy Django on Ubuntu 14.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to secure Nginx on Ubuntu 14.04
How to install Nginx on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to uninstall software on Ubuntu
How to install Nginx on Ubuntu 16.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go on Ubuntu 18.04
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
Teach you how to build a Git server on Ubuntu