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

Linux network management

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Computers that are not networked are scrap metal, and Linux management must also understand the network, but the network is a particularly large subject, and the principles and specifications can be written in three books. You can't always test CCNA before learning Linux! If you don't learn, you must have a certain understanding of the network, understand the network management in linux, and understand the basic principles of network operation.

A physical device

Early networks had a variety of topologies that are now obsolete, but it is good to know their types and their general advantages and disadvantages. Star topology, the use of intermediate equipment for signal relay, the central node single point failure on the global impact is obvious; ring topology, the use of token ring, the damage of each device has a particularly large impact on the global; bus topology, the requirements for the center line are relatively high; mesh topology, especially consuming resources and mainly consuming wires; Semi-mesh topology, that is, the network topology used in today's world, not only saves wires but also guarantees the connectivity of the network to the greatest extent. Of course, this is only a high-level network, and most of the bottom layers are star topology.

There are three main types of physical equipment

Hub: A host connected to a hub, both in the same collision domain and in a broadcast domain, with an internal structure similar to a bus. Conflict domain: All hosts are connected to a network cable. At this time, only one host can send signals on this network cable. Multiple hosts sending signals together will cause information on this network cable. A host sends out a signal, all hosts on this network cable will receive it, this is broadcast.

Switch: hosts connected to a switch, not in the same collision domain, but in a broadcast domain. The switch is very complex inside, mainly because the function is: when the host sends data to the switch, the switch will save the data first and then forward it to all hosts. At this time, multiple hosts can send information at the same time, resolving the conflict.

Routing router: It can selectively send information to other devices and solve the broadcast.

second network protocol

There are two protocols for networking, why two? Because there is an international specification osi reference model, this specification designs a seven-layer model to integrate multiple networks together, but in practice it has been found that another four-layer model is not only simple but also efficient to use networks, resulting in two specifications.

Comparison of two specifications:

Here are just four layers of network protocols:

Internet layer: this layer is very basic, mainly to achieve electrical information and digital information conversion and host identification, host identification is mainly to use this layer of mac.

Network layer: this layer has the famous ip protocol for host communication.

Transport layer: tcp, udp. The main thing is to achieve inter-process communication, which is the key point. What really needs communication is not the host, but the process running on the host. TCP three-way handshake, seq as send, ack as response. Four disconnects because communication is full duplex.

Application layer: http hypertext transfer protocol, ftp, etc.

Tools to judge networks:

ping detects network connectivity using the icmp protocol -s Specify the size of the package -c Specifies the number of packets sent -w Specify the time to wait -I Specifies the interface on which the packet is sent ttl= initial value-number of routes traversed (linux initial value is 64, windows is 128) Tracepath allows you to view the route that packets travel. SS command: -t TCP protocol communication -u Udp protocol communication -w Raw socket communication -x unix socket communication -n Display in numerical form -l Listen to the state. -a all status -p Display pid -e Display extended information

Three Linux network management commands

The tools used for network management in centos6 and 7 are different. Although the tools used in centos 7 are also available in centos6, compatibility and stability are not very good.

1 network status view command top dynamic view network status htop better than top glances information comparison full real-time view network tools dstat real-time monitoring system status totals and so on

2 centos temporary management network command ifconfig IFACE IP/netmask [up] specifies ip for IFACE, or ip for an alias of IFACE, so that a network card can have multiple iprouters add [-net|-host] target [netmask Nm][gw Gw] [[dev] If]

Add a route to an ip Example: route add default gw 172.16.0.1

router -n Display routing information These are the old network view management commands, and the ip command is gradually replacing them. ip addr add|change|del|flush ip management command, use tab completion, you can quickly manage| Note: ip allows a network card to have multiple ip at the same time and not have an alias ip router. route management command

3 centos6 network management

NetworkManager can change the configuration file directly, but NetworkManager in centos6 is not very stable and is generally turned off. Therefore, after changing the network, you need to change the configuration file of the network card if you want to make the network permanent.

Centos configuration files are located in the/etc/sysconfig/network-scripts/directory and begin with ifcfg-.

configuration file format

DEVICE Equipment Name BOOTPROTO The way to get ip dhcp, static, etc. ONBOOT Start IPADDR at power-on IP address PREFIX| NETMASK Number of mask bits or directly specify mask GATEWAY Specify Gateway DNS1 Specify dns server, etc.

A lot of company's service is very important must guarantee 99.9% online time, at this time a network card replacement causes the service to hang up will be a big loss. One network card is not enough, so we can use two network cards to work at the same time or more. This requires the use of bongding. The bongding mechanism is implemented using the bongding module in linux. Bonding has several modes: 1, Mode 0 (balance-rr);2, Mode 1 (active-backup);3, Mode 3 (broadcast).

modprobe bonding of imported bonding module

Edit configuration file/etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0BOOTPROTO=noneBONDING_OPTS= "miimon=100 mode=0"

Edit the configuration file of the secondary NIC/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0BOOTPROTO=noneMASTER=bond0SLAVE=yesUSERCTL=no

Making bongding permanent requires changing the profile

vim /etc/modprobe.d/bond.confalias bond0 bondingoptions bond0 miimon=100 mode=0 #Use this line instead of BONDING_OPTS= "miimon=100 mode=0" in the bond0 configuration file.

4 Centos7 Network Management

In centos7, you can directly use NetworkManager's management command nmcl. The nmcl command is very simple. The combo tab can be completed similar to the use of ip. Use cmcli configuration network card information, the best use ip command to view. Nmcl can support multiple profiles, but only one can be used. Its configuration file is similar to the entry of 6, except that multiple ip can be specified

IPADDR

IPADDR1

Centos 7 uses netgroups for bonding similar to centos6. The command set for using netgroups is as follows:

nmclicon add type team con-name team0 ifname team0 config '{"runner":{"name":"loadbalance"}}' ipv4.addresses 192.168.1.100/24 ipv4.methodmanual

This command is to generate team0 network card and configure the network card

nmcli con add con-name team0-eth2 typeteamslave ifname eth2 master team0

Add eth2 to team0

nmcli con add con-name team0-eth3 typeteamslave ifname eth3 master team0

Add eth3 to team0

nmcli con up team0nmcli con up team0-eth2nmcli con up team0-eth3

Start three network cards

teamdctl team0 state View Group Status nmcli dev dis eth2 Stop eth2 test

summary

Although there is a lot of network knowledge, the operation and maintenance personnel do not need to contact much. Bonding and network group are basically implemented by the computer room personnel. Once the machine network card has a problem, only after the personnel in the computer room have dealt with the problem for a while, it is time for operation and maintenance. Operation and maintenance mainly needs to understand the basic principles of the network and understand the principle of network card networking.

What you really need to be proficient with is network configuration, ip, masks, gateways, and routing. There was also the command to check the network situation and determine the source of the problem at the first time.

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

Network Security

Wechat

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

12
Report