Linux Network Management

Source: Internet
Author: User

A computer that is not networked is scrap metal, and managing Linux must also know the network, but the web is a particularly big discipline, with principles and norms that can write three of books. Learn Linux before you can not go to test a CCNA and then learn it! If you don't learn, you must have some knowledge of the network . Understand the network management in Linux and understand the basic principles of network operation.

A physical device

early networks have multiple topologies and are now obsolete, as long as they understand their types and their approximate pros and cons. Star topology, the use of intermediate devices for signal relay, central node single point of 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, the total line topology, high demand for the centerline, network topology, especially the cost of resources mainly consumed wire; semi-mesh topology, That is, the network topology used in today's world not only saves the wire but also maximizes the connectivity of the network, of course, this is only a high-level network, the bottom is mostly star-shaped topology.

There are three main physical equipment

Hub Hub: Ahost connected to a hub, in the same conflict domain, also within a broadcast domain, with an internal structure similar to a bus. Conflict domain: All hosts connected to a network cable, at this time in this network can only have a host signal, a number of host signals will cause this with the information on the network cable. A host sends a signal, and all hosts on the network cable will receive it, which is the broadcast.

Switch : The host connected on the switch, not in the same conflict domain, in a broadcast domain. The inside of the switch is very complex, the main function is: When the host sends the data to the switch, the switch will save the data and then forward it to all the hosts first. At this point, multiple hosts can send messages at the same time, resolving the conflict.

Routing Router: Information can be selectively sent to other devices to resolve the broadcast.

Two Network protocols

the network protocol has two specifications, why two? Because there is an international standard OSI Reference Model, this specification in order to put a variety of networks together to design a seven-layer model, but in actual production people found that another four-layer model is not only simple and efficient use of the network, resulting in two specifications.

Comparison of two specifications:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8A/EF/wKioL1g_x1OxzAYSAAA7Z9U-xMI329.png-wh_500x0-wm_3 -wmp_4-s_2613515637.png "title=" Image 006.png "alt=" Wkiol1g_x1oxzaysaaa7z9u-xmi329.png-wh_50 "/>

This is only the four Layer network protocol:

The Internet layer: This layer is very basic, mainly to realize the transformation of electrical information and digital information and host recognition, inter-host recognition is mainly the use of this layer of mac.

Network layer: This layer has the famous IP protocol to implement host communication.

Transport Layer:TCP,UDP. The main thing is to achieve inter-process communication, which is the focus, the real need to communicate is not the host, but the process running on the host. The TCP three-time handshake,seq as a send,ack as a response. Four disconnects because the communication is full-duplex.

Application layer:HTTP Hypertext Transfer Protocol,FTP and so on.

Tools for judging the network:

Ping detects network connectivity, uses ICMP protocol-s to specify the size of the packet-c specifies the number of packets to be sent-w specifies the time to wait-i specifies the ttl= initial value in the result of sending the packet's interface ping-the number of routes passed (l The initial value of Inux is 64,windows) Tracepath can view the route through which the package is routed.
SS Command: Communication of-T TCP protocol-u UDP Protocol Communication-W RAW socket Communication-X UNIX socket communication-n Display as a number of-L listen status-a All states-P display PID-E display extended information

Three Linux network management commands

Network Management in the CENTOS6 and 7 use of the tool is different, the tool used in 7 although the 6 also has but the compatibility and stability is not very good.

1commands for viewing network conditions
Top Dynamic View network status Htop better than top see glances information compare full real-time view Network Tools Dstat Real-time monitoring system total of various conditions, etc.


2 CentOSTemporary Management Network command
Ifconfig IFACE Ip/netmask [up] Assign IP to IFACE, or assign IP to an alias of IFACE so that a network card can have multiple iprouter add [-net|-host] target [netmask Nm] [GW GW] [[Dev] If]

Add route to an IP example:route add default GW 172.16.0.1

Router–n Display routing information above is an ancient Network view Management command, the IP command is now gradually replacing the above two commands.       IP addr Add|change|del|flush IP management Command, use tab completion, can quickly manage |NOTE:IP can have a network card with multiple IPs at the same time and not have the alias IP router ... Routing Management Commands


3 CENTOS6of network Management

NetworkManager can change the configuration file directly, but the NetworkManager in CENTOS6 is not very stable and is usually turned off. As a result, you need to change the configuration file of the network card to make the network permanent after you change it.

The CentOS configuration file is located in the/etc/sysconfig/network-scripts/ directory, beginning with ifcfg- .

Configuration file format

Device name Bootproto gets IP in the way DHCP, static, and so on onboot boot ipaddr IP address prefix| NETMASK mask number of bits or directly specify the Mask gateway DNS1 Specify the DNS server and so on


many of the company's services are important to ensure that the 99.9% online time, when a network card replacement causes the service to hang up will be a big loss. A network card does not meet the requirements, we can use two network cards at the same time to work and more. This requires the use of bongding. the bongding mechanism is implemented using the bongding module within Linux. bonding has a variety of operating modes:1,mode 0 (balance-rr), 2,mode 1 (active-backup); 3,Mode 3 (broadcast).

Import The modprobe of the bonding module bonding

Editing a configuration file /etc/sysconfig/network-scripts/ifcfg-bond0

device=bond0bootproto=nonebonding_opts= "Miimon=100 mode=0"

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

Device=eth0bootproto=nonemaster=bond0slave=yesuserctl=no

making bongding Permanent effective requires changing the configuration file

Vim/etc/modprobe.d/bond.confalias bond0 bondingoptions bond0 miimon=100 mode=0 #使用这一行的时候就不用在bond0的配置文件中使用BONDING_ opts= "Miimon=100 mode=0".


4 CENTOS7of network Management

Centos7 can directly use the NetworkManager Management command nmcli,nmcli command is simple, Combo tab can be complete and IP use a similar. Using the CMCLI configured NIC information, it is best to use the IP command to view. NMCLI can support multiple profiles at the same time, but only one is used. Its configuration file is similar to the 6 's, just can specify multiple IP

IPAddr

IPADDR1

CENTOS7 uses network groups to implement CENTOS6 - like bonding. The command collection using network groups is as follows:

Nmclicon Add type Team con-name TEAM0 ifname team0 config ' {"runner": {"name": "LoadBalance"}} ' ipv4.addresses 192.168.1.10 0/24 ipv4.methodmanual

This is the command to generate the TEAM0 NIC and configure the NIC

Nmcli con add con-name team0-eth1 typeteamslave ifname eth1 Master Team0

Add eth1 to team0

Nmcli con add con-name team0-eth2 typeteamslave ifname eth2 Master Team0

Add eth2 to team0

Nmcli con up team0nmcli con up team0-eth1nmcli con up team0-eth2

Start three network adapters

Teamdctl team0 State view group nmcli Dev dis eth1 stop eth1 test


Summarize

Although the network knowledge is many, but the OPS personnel need contact not many,bonding and the network group basically is realizes by the computer room personnel. Machine Card Once out of the question, only the computer room that a meeting of the personnel to deal with the problem, is the operation of the time. Operation and maintenance mainly to understand the basic principles of the network, the principle of networking network card.

the real need for skilled use is the configuration of the network,IP, mask, gateway, routing. There is the command to view the network situation, the first time to determine the source of the problem.


This article is from "Lao Wang Linux Journey" blog, please be sure to keep this source http://oldking.blog.51cto.com/10402759/1878485

Linux Network Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.