Ubuntu configuration static ip networking summary

statement

The main reason is to check your own blog when you connect to the Internet in the future, and then just do it. There is no need to search for information randomly. Some information is wrong, but it will mess up your Ubuntu environment.

Network Configuration

Virtual network editor

Insert picture description here

Change settings

Insert picture description here

Add a network, add a Vment0, and set it to bridge mode, and set the bridge connection to automatic

Insert picture description here

Set the network adapter to bridged state

Insert picture description here
Insert picture description here

System file configuration

Open the command window (right-click the stand-alone desktop and select Open Terminal or Ctrl+Alt+T), and enter ifconfig

Insert picture description here
There are two words here, lo stands for 127.0.0.1, which is localhost, don't mess with this, this is the loopback address, which refers to the local machine, and is generally used for testing. The loopback address (127.xxx) is the loopback address of the machine, that is, the IP address inside the host's IP stack

sudo vi /etc/network/interfaces, edit the file

Here, it involves the vi command to configure the file, let me briefly explain the vi command :

vi instruction

Basically vi can be divided into three states, namely command mode (command mode), insert mode (Insert mode) and bottom line mode (last line mode)

Command mode

How to enter command mode

Just inside, in command mode, when switching to the insertion mode and the line mode , press 「ESC」the key return to command mode

Insert mode

Only in insert mode, you can only do text input , press the 「ESC」key to return to the command line mode

How to enter insert mode

  1. Press "i" to switch to the insert mode "insert mode", press "i" to enter the insert mode to start inputting the file from the current position of the cursor ;
  2. After pressing "a" to enter the insert mode, the text will be input from the position next to the current cursor position ;
  3. After pressing "o" to enter the insert mode, a new line is inserted, and text is entered from the beginning of the line .

Press ↑↓←→ by mistake in insert mode

I don't know if you have such a situation, I do it anyway, and become more and more miscellaneous with one click, laughing to death. . . In this case, you only need to enter the command mode , then press ↑↓←→ to move to the miscellaneous line, and press ddto delete an entire line.

Bottom row mode

Save the file or exit vi, you can also set the editing environment, such as searching for strings, listing line numbers, etc. In this case, I usually just use it for file preservation . . . .
Insert picture description here

How to enter bottom row mode

In the insert mode, can not enter line mode, need to press 「ESC」key to return to command-line mode , and then press enter line mode, and then to wq(save and exit vi)

ip gateway subnet mask DNS server address

ip has two requirements

  1. On the same network segment as the physical host
  2. At this time, the ip configuration is empty

The gateway only needs to change the last digit of ip to 1, and the subnet mask 255.255.255.0and DNS server address are the same as the gateway, or you can directly create a general one (8.8.8.8 and 233.5.5.5)

Restart network service

  1. sudo /etc/init.d/networking force-reload ==> Reload the network configuration file
  2. sudo /etc/init.d/networking restart

Heavy 启 Ubuntu

Then you can ping www.baidu.commyself

important point

The physical machine ip thing is still looking for a popular one. I don’t understand what the school network means. This is ipv4 10.139.92.152:? ? ? ? ? ? ?
Blind guess is the intranet IP. Operators such as mobile telecom often distribute their own intranet IP to users, especially in places with high density such as schools, because the IP address pool is not enough.
Insert picture description here
I configure these on Ubuntu. Inside, the result cannot be connected. . . Pissed off
Insert picture description here

Then I used my mobile phone hotspot, connected to the computer, re-assigned one to the physical machine ip, and finally got an IP that looked normal
Insert picture description here
Insert picture description here
and ping www.baidu.com
Insert picture description here
very normal

to sum up

I believe this blog will soon come in and re-read it, laughing to death. . . . . . . Come on

Guess you like

Origin blog.csdn.net/CSNN2019/article/details/115178970