ubuntu modify and configure ip address

method one:

ps: This method is invalid on ubuntu 18.04, see method two

1、 Modify the configuration file /etc/network/interfaces
Add the following content:

auto eth0                 #Set to automatically start the eth0 interface
iface eth0 inet static     #Configure static IP
address 192.168.11.88      #IP address
netmask 255.255.255.0     #Subnet mask
gateway 192.168.11.1        #Default gateway

2、 Modify DNS

$ sudo vi /etc/resolve.conf**

Add the following content:

nameserver 127.0.0.1 #Remember to add
nameserver 8.8.8.8 #Local dns server(Use ipconfig/all view local dns, the first dns is the default, there are 2 dns in total)

3、 Restart the network for the configuration to take effect

$ sudo /etc/init.d/networking restart

4、 Check whether the ip configuration is successful

 $ ifconfig

Method Two:

1 Modify the /etc/netplan/50-cloud-init.yaml file, the desktop version is /etc/netplan/01-network-manager-all.yaml

will

network:
 ethernets:
  ens33:
   dhcp4:true
 version:2

change into

network:
 ethernets:
  ens33:
   addresses:[192.168.42.205/24]
   gateway4:192.168.42.255
   dhcp4: yes
 version:2

2 Make the configuration file effective

$ netplan apply

Recommended Posts

ubuntu modify and configure ip address
ubuntu 14.04 configure 3-wire 3IP
Centos7 configure IP address
ubuntu install and configure GitLab
Complete steps to configure IP address in Ubuntu 18.04 LTS
Example of how to modify ip address in Ubuntu20.04
Install and configure MySQL on Ubuntu
Install and configure Docker in Ubuntu
Configure node js and npm under Ubuntu 14.04
Centos7 configuration host name and IP address
Ubuntu configure Tomcat
Ubuntu configure Apache
How to install and configure NATS on Ubuntu 16.04
Install JDK and configure environment variables on Ubuntu 16.04
How to install and configure Gogs on Ubuntu 18.04
How to modify time zone and time in ubuntu
How to install and configure Cyberpanel on Ubuntu 18.04
ubuntu16.0.4 method to set a fixed IP address
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure GitLab on Ubuntu 18.04
How to install and configure Ansible on Ubuntu 18.04
ubuntu20.04 set static ip address (including different versions)
How to install and configure Elasticsearch on Ubuntu 16.04
How to install and configure PostGIS on Ubuntu 14.04
How to install and configure VNC on Ubuntu 18.04
How to install and configure Sphinx on Ubuntu 16.04
How to install and configure OrientDB on Ubuntu 14.04
How to install and configure AppScale on Ubuntu 12.04
How to install and configure PostGIS on Ubuntu 14.04
ubuntu 17.10 set solid IP
Summary: Ubuntu Python2.x and
Embedded Linux development environment to build and configure Ubuntu
Ubuntu introduction and installation
[python] python2 and python3 under ubuntu
Ubuntu configure network commands
How to configure a fixed IP based on Ubuntu 18.04
Ubuntu18.04, Centos7 static IP
How to modify time zone and time in ubuntu system
Ubuntu18.10 configure Java environment
Ubuntu 18.10 configure Nvidia driver
Detailed steps to configure Ubuntu 16.04 and Apache virtual host
ubuntu16.04 set static ip
Ubuntu backup and restore
Install and configure Mono production environment on Ubuntu Server
Ubuntu configure SecureCRT login
Ubuntu 18.04 uses elastic network card to configure multiple external network IP
ubuntu 12.04 configure the kernel crash to automatically restart and dump
Centos: add an IP address
Ubuntu Apache configure https certificate
ubuntu16.04 build vim and pyt
Ubuntu 16.04 compile and install PHP 7.2
ubuntu18.04 compile and install python3.8
ubuntu 18.04 set static ip method
Configure tomcat on ubuntu server
Configure static IP under CentOS 7
Ubuntu16.04 installation and simple configuration
Jmeter (18)_Ubuntu deploy jmeter and ant
Modify shortcut keys under Ubuntu 18.04
Centos6.5 install and configure mongodb
Centos configure multiple virtual IP
Ubuntu deployment and experience Nexus3