Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up Linux network

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to set up the Linux network, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Linux query IP

Note:

(1) lo--local loppback (local callback. Windows cannot be connected through this connection. In this case, the network card is not configured with IP,ifconfig and IP can be configured).

(2) if there is only lo but no eth0, you can do the following: double-click the network button in the lower right corner-NetworkAdaptor

Network adaptor

Bridging-the virtual machine IP and the actual machine IP occupy the same address range, which may encroach on the IP address of the LAN, resulting in IP conflicts.

NAT-- network address translation, sharing links (sharing users'IP, but the two are a bit troublesome to connect to each other).

HostOnly-- VPC. Linux considers windows to be host (recommended).

Network cards or IP-- (two virtual network cards, this is for windows, not linux,linux has only one network card) can link multiple networks

Gateway-there is a gateway between two different network segments (this gateway is similar to a server with at least two network cards, one to the internal network and one to the external network)

Note: if you look at the network connection in windows, you will see three network cards, all of which are for windows (because on the windows host). If linux wants to use the network card to access the Internet, you only need to put the virtual network card of linux and any one of the network cards in windows on the same network segment to realize the communication of virtual machines.

Configure the network card

Note: where 192.168.11.1 is an IP address in the VMare of the windows system, thus realizing the association of IP.

Note:

When we arrive at another place, the network address changes, so we need to reconfigure the network card, otherwise there will be a timeout when executing the ping instruction and the packet will be lost.

Problem: ping does not have access to Linux on Windows, showing timeout packet loss all the time

Solution: at this point, you can turn off the vfftpd service, and then start it again, and when the process number PID is displayed, the ping can pass.

Check to see if communication can occur:

Using the ping instruction, if you can ping, it indicates that the setting is successful.

Note: if the other party has a firewall (you can turn off the firewall of linux or open the port instead of closing the firewall of windows), the ping will fail.

There will also be the problem of ping connection and ftp connection.

Detect if the FTP is connected:

Note: there are two situations, one is that the vsftpd service is not enabled, and the other is the firewall (the firewall should be turned off or port 21 should be opened).

Firewalls

Iptable

You can use the following directive to view the status of the firewall: ufw status

The reason why the connection was rejected:

1. Firewalls

Linux operation:

The result of connecting Windows to ftp:

Note: vsftpd is very safe and stable, vs=very secure

Steps

Purchase a vfs account-- deploy the local web page to the remote server-- need: remote operation + data transfer-- tool: SSH (requires the server to open port 22, the client side to install SSH client software, ubuntu desktop default installation, server-side ubuntu-server default installation of SSH server software openssh) + rsync-- login:

The peter here is the user login name of the remote server, which can be omitted if the local one is peter. As follows:

-- Link the server-- now the machine name changes to the server name-- it is troublesome to enter the password every time you log in, and you can remember the password:

Note: the first private key needs to be kept strictly confidential, and the second public key. We need to upload it to the server, specific directory:

You can copy and paste manually, and the system also provides a command:

Just enter and leave the default value-copy:

You do not need to enter a password in the future:

FAQ: if the network is disconnected or ctrl+D is pressed to exit during the operation, it will cause a lot of inconvenience. Recommended software: tmux (powerful terminal manager)-in case of failure, you can return to the original exit position by typing tmux an after the next login.

Rsync:

If you synchronize data remotely and locally, ssh will be able to run through rsync.

Action:

Note: mydir is a local file, happycasts is remote, you can specify a directory after:, and / home.peter is the default when not specified. There can be no / between mydir and happycasrs, otherwise mydir content will be uploaded, and there must be. To sum up, this is equivalent to uploading.

For the download command, it's pretty much the same, but the location of the file is changed in the instruction.

Local files have been modified and synchronized to the server:

Note: content is synchronized here, so there needs to be / after mydir.

In practice, not only to add files, but also to delete them, you should do this:

Note: delete hello locally and add nice. When synchronizing data, the parameter cannot be just-av, so the newly added ones will be added, but those that have already been deleted will not be deleted, so you need to add the-delete parameter. In fact, this is not safe because the backup on the server side is also deleted, as follows:

Note: only report that the information is out of sync. In practice, it is generally necessary to execute a script to check that there is no problem before synchronizing.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report