How to set static IP in ubuntu14.04

first step:

Configure a static IP address:

Open the /etc/network/interfaces file, the content is

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

The above means that DHCP is used to allocate IP by default. If you want to specify a static IP, you need to modify the following

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static*******Defined as static IP

address 192.168.2.29*******IP address to be set
netmask 255.255.255.0*******Subnet mask
gateway 192.168.2.1*******Gateway (routing address)

Then save this file

The second step:

Manually set up DNS server

Open the file /etc/resolv.conf and set the content as follows

nameserver 192.168.2.1******Gateway (same as above)

third step:

Note: After restarting Ubuntu, I found that the Internet cannot be accessed. The problem appears in /etc/resolv.conf. After restarting, the dns configured in this file is automatically modified to the default value. So you need to permanently modify the DNS. The method is

Open the file /etc/resolvconf/resolv.conf.d/base and write the following content:

nameserver 192.168.2.1
nameserver 202.106.0.20

the fourth step:

Restart the network service to make it effective, the command is:

/etc/init.d/networking restart

(My personal experience is: restarting this service is invalid, or restarting the system is awesome)

Recommended Posts

How to set static IP in ubuntu14.04
How to set static IP on Ubuntu 18.04 Server
Explain how to set static IP on ubuntu14.04
ubuntu16.04 set static ip
ubuntu 18.04 set static ip method
Example of how to modify ip address in Ubuntu20.04
How to set a fixed IP based on Ubuntu 16.04
How to install Helm in Ubuntu
How to use hanlp in ubuntu
How to install mysql in Ubuntu 14.04
How to install mysql in Ubuntu 14.04
How to add swap partition in Ubuntu
How to set up Gogs on Ubuntu 14.04
How to add users to Sudoers in Ubuntu
How to delete redundant kernels in Ubuntu
How to delete redundant kernels in Ubuntu
How to install ROS Noetic in Ubuntu20.04
How to set up R on Ubuntu 14.04
How to set PostgreSQL startup on Ubuntu 16.04
How to modify software source in Ubuntu 7.10
Set static IP for CentOS in VMware
How to open root account in Ubuntu20.04
How to hide applications in Ubuntu Dash?
ubuntu 17.10 set solid IP
How to upgrade to Ubuntu 20.04
Ubuntu18.04, Centos7 static IP
How to upgrade to Ubuntu 20.04
How to set up Shiny Server on Ubuntu 14.04
Summary of CentOS method to set static IP
How to modify time zone and time in ubuntu
How to configure TensorFlow use environment in Ubuntu
ubuntu16.0.4 method to set a fixed IP address
How to install python in ubuntu server environment
How to use dpkg command in Ubuntu system
ubuntu20.04 set static ip address (including different versions)
[Quick Start with Ubuntu] Two, Ubuntu set static IP
How to set code auto prompt in python
How to set up time synchronization on Ubuntu 18.04
How to configure /var/log/messages in Ubuntu system log
How to install Hadoop in standalone mode on Ubuntu 18.04
How to set up a DNS server on Ubuntu 18.04
How to set up Ghost one-click app for Ubuntu 16.04
How to view detailed network routing table in Ubuntu
How to use Putty to log in to ubuntu installed in VirtualBox
Complete steps to configure IP address in Ubuntu 18.04 LTS
How to modify time zone and time in ubuntu system
How to create a Python virtual environment in Ubuntu 14.04
Many attempts to set up soft routing in ubuntu
Set static IP under Centos
How to upgrade to Ubuntu 16.04 LTS
How to control the ubuntu system in win10 through ssh
How to set up Java Home on Ubuntu and Raspbian
How to set up a Masterless Puppet environment on Ubuntu 14.04
How to set or modify the time zone on Ubuntu 20.04
How to set up a firewall with UFW on Ubuntu 14.04
How to set up vsftpd for anonymous downloads on Ubuntu 16.04
Detailed steps to automatically set the line number in ubuntu16.04
How to install memcache and start it in ubuntu environment
How to set or modify the time zone on Ubuntu 20.04
How to set up a production Elasticsearch cluster on Ubuntu 14.04
How to set up an Apache virtual host on Ubuntu 16.04