Marco 2016 new Linux+python high-end operation eighth week

Source: Internet
Author: User
Tags switches

1, describe the network bridge, hub, two-layer switch, layer three switch, router functions, usage scenarios and Differences.

(1) bridge: a dual-port two-tier device that can isolate conflict domains, typically used to divide lans, or link lans.

(2) hub: Physical Layer device, multi-port, Unable to isolate conflict domain for connection to Host.

(3) Layer Two Switch: Data link layer devices, multi-port, compared to the bridge, the switch can learn Mac address, according to the MAC address forwarding data, can isolate the conflict domain, used in the routing device and host, access layer and aggregation layer can be used.

(4) three layer Switch: the equivalent is to lead the function of the two layer switch, working on the network layer, there is higher bandwidth, can do core layer use, for medium and large network routing Exchange.

(5) router: Network layer equipment, in each lan, metropolitan area network transfer data between, according to IP address forwarding data, can be isolated broadcast domain, for the core layer.

What are the classifications for 2.IP addresses? The representation of subnet mask and its function

The IP address consists of two parts, one for the network address and the other for the host Address. IP addresses are divided into a,b,c,d,e5 classes. commonly used are classes B and C two.

Class A: The first segment of the Class A IP address has a range of 1~127, the Class A address can be connected to 16387064 hosts, and there are 126 class A addresses on the Internet

Class B: The first paragraph of the number range is 128~191, each Class B address can connect 64516 hosts, the Internet has 16,256 Class B address.
Class C: 192~133, can be connected to 254 host, there are 2,054,512
Class D: 224~239,d-class addresses are used for the transmission of multi-purpose ground information, as alternate
Class E: 240~254. Class E addresses are reserved for experimentation and development of the Internet only.


3. What are the models of computer networks (osi model and TCP/IP model), the functions of each layer and the physical devices involved?

The OSI model has: seven layers: physical layer, data Link layer, Network layer, Transport layer, session layer, presentation layer and application layer;

The physical layer specifies the mechanical, electrical, functional, and process characteristics between activating, maintaining, and closing communication breakpoints,

The physical layer of media includes overhead wire, balanced cable, Optical fiber, wireless channel and so On. Interconnection devices for communications refer to the interconnection devices between the DTE (data Terminal Equipment) and the DCE (data Communications equipment). DTE is the data terminal equipment, also known as physical devices, such as computers, terminals, etc. are Included. The DCE is a data communication device or circuit connection device, such as a modem. The data transfer is usually through dte-dce, then through the Dce-dte path. Interconnection devices are devices that connect DTE and dce, such as various plugs and sockets. All kinds of coarse and fine coaxial cables, t-joints, plugs, receivers, transmitters, repeaters, etc. are all physical layers of media and Connectors.


A data link can be roughly understood as a data channel. The physical layer provides the transmission medium and its connection to the data communication between the terminal Devices. The medium is long-term and the connection has a Lifetime. During the lifetime of the connection, the two ends of the transceiver can be unequal to one or more data Communication. Each communication has to be through the establishment of communication and the removal of communication two Processes. This established data-sending relationship is called a data link. And the data transmitted on the physical media is inevitably affected by a variety of unreliable factors to produce errors, in order to compensate for the physical layer of deficiencies, to provide error-free data transmission, it is necessary to be able to detect errors and error Correction. Data link establishment, demolition, data detection, error correction is the basic task of the data link layer.

The link layer provides the data transfer service for the network layer, which relies on the functions of this layer. The link layer should have the following functions: the establishment, removal and separation of link connections, frame delimitation and frame Synchronization. The data transmission unit of the link layer is the frame, the agreement is different, the frame length and the interface also have the difference, but the frame must be bound in any case, and sequential control refers to the control of the order of the frame;

Error detection and Recovery. There are also link identification, flow control and so On. Error detection Multi-square code check and cyclic code check to detect the data on the channel error, and frame loss, such as serial number Detection. The recovery of all kinds of errors is often done by feedback and re-sending Techniques.

The most common of the independent link products is the nic, The bridge is also the link product. The data link layer turns the inherently unreliable transmission media into a reliable transmission path to the network Layer. In IEEE802.3 case, the data link layer is divided into two sub-layers, one is the logical link control, The other is the media access control., bridges and Switches.

The generation of network layer is also the result of network Development. In the context of online systems and circuit switching, the functionality of the network layer does not make much sense. When the data terminal is Increasing. There is a relay between the devices connected, there will be a terminal requires not only with the only one but can communicate with multiple terminals, which resulted in the data of any two data terminal equipment linked to the problem, that is, routing or search path. In addition, when a physical channel is established and used by a pair of users, there is often a lot of idle time Wasted. People will naturally want Jeandot to share a link to the user, in order to solve this problem, there are logical channel technology and virtual circuit technology. There are routers and layer three switches involved in the DEVICE.

Transport layer: The data transfer control layer between the end open Systems. The main function is to acknowledge the data between the End-open Systems. At the same time, it is also used to compensate the quality difference of various communication networks, and to restore the transmission errors after the next three layers, and further improve the Reliability. In addition, throughput and quality of service are enhanced through technical measures such as multiplexing, segmentation and composition, connectivity and separation, shunt and Confluence. It is the first end-to-end level that has buffering effect when two computers are communicating with each other through the Network. When the network layer service quality can not meet the requirements, it will improve the service to meet the requirements of the high-level, when the Network layer service quality is good, it only uses very little Work. The transport layer can also be reused, which is to create multiple logical connections on a network Connection. The transport layer is also known as the transport Layer. The transport layer exists only in the end open system, is a layer between the low 3 layer communication subnet system and the high 3 layer, but it is an important layer. This is because it is the last layer of the source-to-destination control of data transfer from low to High.

The service provided by the session layer is for the application to establish and maintain sessions and to synchronize the Sessions. The session layer uses checkpoints to enable communication sessions to resume communication from the checkpoint when communication fails. This ability is extremely important for transmitting large files. The session layer, the presentation layer, and the application layer form the high 3 layers of the open system, providing distributed processing, dialogue management, information representation, checking, and recovery of transmission errors related to the semantic context for the application Process. The main function of the control layer of the conversation unit is to collect and send the data in the correct order according to the principle stipulated in the application process, and conduct various forms of Dialogue. The session layer specifies the procedure for establishing and removing session connections between users of the session service and data transfer Procedures.

Presentation Layer: The control layer of data representation, whose main function is to transform the information provided by the application layer into a form that can be understood together, providing a unified representation of character code, data format, control information format, encryption, etc. One of the functions of the presentation layer is to provide a common language for heterogeneous machine communication so that it can Interoperate. This type of service is needed because different computer architectures use different data representations. For example, IBM hosts use EBCDIC encoding, while most PCs use ASCII Code. In this case, the presentation layer is required to complete the Conversion. From the previous introduction, we can see that the following 5 layers of the session layer complete the End-to-end data transfer, and is reliable, error-free Transmission. But data transmission is only a means, not an end, but ultimately the use of Data. Because the definitions of the data are not exactly the same for various systems, The easiest example is the keyboard--some of the keys on it have different meanings in many Systems. This naturally poses a barrier to the use of data from other Systems. The presentation layer and the application layer are tasked with eliminating this barrier.

Application layer: the highest layer of the OSI reference model. Its function is to realize the exchange of information between the application process (such as user program, terminal operator, etc.). At the same time, it also has a series of service functions needed for business processing. The application tier typically includes common application service elements (case) and application-specific service elements (sase>. The case provides the most basic service in the application process, providing the application process with the ability to communicate with the application processes that are necessary, but independent of the app Process. Sase is essentially a mapping of various application processes in the application layer, each sase for a specific class of applications, such as file transfer, access and Management (ftam), virtual Terminal (VT), Message processing system (MHS), Electronic data Interchange (EDI), and directory Query. The application layer provides services to applications that are grouped into groups of attributes that they provide to the application and are called service Elements. Some can be used in conjunction with a variety of applications, while others are used for a smaller class of applications. The application layer is the highest level of the open system and is directly serving the application Process. Its role is to achieve a number of system application process to communicate with each other, complete a series of services required for business Processing.

The TCP/IP models are: physical layer, Data Link layer, Network layer, Transport layer and application Layer.

4, How to access the Linux host to the TCP/IP network, please describe the detailed steps. (manually specified Mode)

Here's what I do with Linux7: the versions are slightly different:

The configuration information for directly editing the NIC is as Follows:

# Vi/etc/sysconfig/network-scripts/ifcfg-eth0

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/88/54/wKioL1fwkk2A4Uw8AAAq6WbIGyk952.png "title=" 1.png " alt= "wkiol1fwkk2a4uw8aaaq6wbigyk952.png"/>

Re-read config file: #/etc/init.d/network restart or # service network restart


5. What are the ways to configure network information for Linux hosts, please describe each process.

(1) Modify the network card configuration file under the/etc/sysconfig/network-srcipts/directory, and restart the Network service to take effect after the modification is Completed.

(2) use the command to modify, such as Ifconfig eth0 192.168.1.1/24 up, But the configuration is lost after Reboot. You can also use commands such as Ip\nmcli.


6, Write a script, Use the ping command to detect the online status of all hosts between 172.16.250.1-172.16.250.254;

The online host uses green display;

The Non-online master uses red display;

#vi Testip in The/tmp directory

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/88/58/wKiom1fwmY3yVfV8AAAcmmaPIKw916.png "style=" float: none; "title=" 3.png "alt=" wkiom1fwmy3yvfv8aaacmmapikw916.png "/>

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/88/58/wKiom1fwmiGiho-YAAAEwynuktc070.png "title=" 5.png " alt= "wkiom1fwmigiho-yaaaewynuktc070.png"/>

Then use: #bash-x testip.sh


7, detailed description of each network interface configuration file The meaning of each parameter and its corresponding value;

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/88/54/wKioL1fwm4fisCEqAABhM0o8cYA816.png "style=" float: none; "title=" 6.png "alt=" wkiol1fwm4fisceqaabhm0o8cya816.png "/>

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/88/58/wKiom1fwm4jgyVQsAABCgK1Zoi8870.png "style=" float: none; "title=" 7.png "alt=" wkiom1fwm4jgyvqsaabcgk1zoi8870.png "/>


8, How to configure multiple addresses for the network interface, what are the ways?

Ifconfig eth1:1 192.168.1.100/24 up configuration is complete, ifconfig displays

But in Centos7 to Use:

IP addr Add 192.168.1.101/24 dev eth1 after configuration ifconfig not display, need to use IP addr Show


9. What are the commonly used network management tools, and describe how they are used in an example format?

Ifconfig command:

Ifconfig show IP addresses for all network cards

Ifconfig eth1 Displays the IP address of the specified network card, here eth1

Ifconfig eth1 down/up Turn off or enable the specified nic, here eth1

Ifconfig eth1:1 ip_address/mask up/down Configure the IP address of the sub-interface and turn it on or off

IP command

Commonly used IP subcommands have {link | addr | route}

IP link

Show {up|down} View status belongs to an up or down interface

Set {up|down|arp on|arp off |mtu|mac_address| ...} Set layer two properties for an interface

IP addr

Add {dev|local|broadcast|.} adds an IP address. For example IP addr add Dev eth1:2 local 192.168.1.102/24

Delete removes the IP address of the Interface. IP addr Delete dev eth1 192.168.1.103/24

Show view IP address of the interface

IP route

IP route add adds a Route. For example IP route add 192.168.1.0/24 via 172.16.1.1 Dev eth0 add route to 192.168.1.0/24, next hop is 172.16.1.1;ip route add default 172.16.1.1 Add a default route

Delete to remove the Route. For example, IP route Delete 192.168.1.0/24

Show View routing table


10, Linux system software package management methods (installation, upgrade, Uninstall and other operations), and how to Manage.

Rpm-i installing the specified RPM package

RPM-E uninstalling the specified program

Rpm–test Test Installation

Rpm–nodeps Ignore dependencies

rpm–replacepkgs re-installation

Rpm–nosignature: not checking the legitimacy of the source

Rpm–upgrage Install an older package, upgrade if no legacy package exists, Install

Rpm–freshen: Upgrade If an old package is installed, do not perform upgrade if not saved

Rpm-q{l | c} Displays whether the specified program installs \ Installs the generated files \ configuration file

Yum Install specified program

Yum Remove uninstall the specified program

Yum Update upgrade specified program

Yum Groupinstall Installation Group Package

Yum groupupdate Upgrade Group program

Yum Groupremove Uninstall Group program

Yum Info View information for a specified program


11, How to use the distribution CD as a Yum repository, please describe the PROCESS.

To mount to a directory first, such as Mount/dev/cdrom1/mnt

Edit or create a file that ends with repo in the/etc/yum.repos.d/directory.

Vim/etc/yum.repos.d/localadd.repos

[cdrm]

NAME=CDRM Name

Baseurl=file:///mnt/path

Cost=1 Cost

Gpgcheck=0 does not check

Enabled=1 Open


12. Write a script to complete the following functions

(1) Suppose that a directory (/etc/rc.d/rc3.d/) has a number of files with the beginning of K and s;

(2) Displays the file name of all files that begin with K and appends a stop string to it;

(3) Displays the file name of all files beginning with S and appends a start string to it;

(4) the respective numbers of documents that begin with the beginning of S and K respectively;

Create A: VI find.sh as shown in The/tmp directory:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/88/55/wKioL1fwpKCRLp8HAAAfJ60lQBo534.png "title=" 8.png " alt= "wkiol1fwpkcrlp8haaafj60lqbo534.png"/>


13. Write a script to complete the following functions

(1) the script can accept the user name as the parameter;

(2) Calculate the sum of the IDs of these users;

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/88/55/wKioL1fwpknB5V4XAAAQXCGDh3s264.png "title=" 9.png " alt= "wkiol1fwpknb5v4xaaaqxcgdh3s264.png"/>


14. Write a script

(1) Pass some catalogs to this script;

(2) Display the content type of all level files or subdirectories of each directory individually;

(3) How many directories are in the statistics, and how many file content types are displayed altogether;

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/88/58/wKiom1fwptzDNx5FAAAWjgqArP4881.png "title=" 10.png "alt=" Wkiom1fwptzdnx5faaawjgqarp4881.png "/>


15. Write a script

Pass a parameter to the script from the command line, the parameter is the user name

If the User's ID number is greater than or equal to 500, the user is displayed as a normal user;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/88/55/wKioL1fwp07g09doAAATv7ktq3s149.png "title=" 12.png "alt=" Wkiol1fwp07g09doaaatv7ktq3s149.png "/>


16. Write a script

(1) Add 10 user user1-user10; password and user name;

(2) add when the user does not exist, or skip when existing;

(3) finally shows how many users have been added this time;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/88/58/wKiom1fwp9bA2VkKAAAOCfKAXKM144.png "title=" 13.png "alt=" Wkiom1fwp9ba2vkkaaaocfkaxkm144.png "/>


17, Write a script, ping command to test the 172.16.250.20-172.16.250.100 within the host online, will be displayed online;

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/88/58/wKiom1fwqjDj2QFqAAAOfuaBcRE477.png "title=" 14.png "alt=" Wkiom1fwqjdj2qfqaaaofuabcre477.png "/>


18, Printing 99 multiplication table;

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/88/55/wKioL1fwqt2hjl-gAAALXEVu3Co738.png "title=" 15.png "alt=" Wkiol1fwqt2hjl-gaaalxevu3co738.png "/>

























This article is from the "11822904" blog, please be sure to keep this source http://11832904.blog.51cto.com/11822904/1858383

Marco 2016 new Linux+python high-end operation eighth week

Related Article

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.