1, describe the network bridge, hub, two-layer switch, layer three switch, router functions, usage scenarios and differences.
1) Hub:
Hub is a device that connects multiple Ethernet twisted-pair or fiber-optic assemblies to the same piece of physical media, and the main function is to amplify the received signal to extend the network's transmission distance, working in the OSI (open System Interconnect Reference Model) reference model, the first layer of the "physical layer".
A hub is a multi-port repeater that only handles data transfer between nodes and amplifies the signal, detects conflicts but is not responsible for blocking problems, and all ports are in the same conflict domain. Unlike a two-tier device such as a two-layer switch, unlike a switch, each port separates conflicting domains and does not have the port learning capability of a two-tier switch. Usage scenarios are used in relatively simple local area networks for LAN expansion under switches.
2) Network Bridge:
Bridge (bridge) is an early two-tier network device used to connect different network segments. The two ports of the bridge have a separate switching channel, instead of sharing a backplane bus, which can isolate the conflict domain. The network Bridge performs better than The Hub (hub), and each port on the hub shares the same backplane bus. Later, the bridge is replaced with a switch that has a more multi-port and can also isolate the conflict domain.
The Network Bridge works on the second layer of the OSI model data link layer, which separates the conflicting domains and is used to compare small LAN extensions.
3) two layer switch
The two-layer switch works on the second layer of the OSI model data link layer, and is called a two-layer switch. The development of the two-layer switching technology has been more mature, the two-layer switch is a data link layer device, can identify the MAC address information in the packet, according to the MAC address to forward, and these MAC addresses and corresponding ports recorded in their own internal address table. And the bridge is the difference between supporting more ports, the efficiency of the forwarding is much faster than the bridge, and the three-layer switch is the three-layer switch has the function of routing, working on the three layer network layer.
4) Three layer switch
Layer Three switch is a switch with a partial router function, the most important purpose of the three-layer switch is to speed up the data exchange within the large LAN, the routing function is also for this purpose, can do one route, multiple forwarding. The process of the regularity of packet forwarding is realized by hardware, and the functions such as routing information updating, routing table maintenance, routing calculation and routing determination are implemented by software. Layer three switching technology is two layer switching technology + three-layer forwarding technology.
Layer three switches work in the third layer of the OSI model Network layer, in the same LAN in the interconnection of each subnet and VLAN routing between the LAN, with three-layer switch to replace the router, and only the LAN and the public network interconnection between the network to achieve cross-regional access, only through the professional router. The three-layer switch port is more than the router. However, the three-layer switch has only a fast Ethernet port and a Gigabit Ethernet port, which is not as rich as router interface.
5) Router
Router (Router), is connected to the Internet in each LAN, WAN equipment, it will automatically select and set the route according to the situation of the channel, the best path, in order to send the signal.
Routing works on the third layer of OSI, the network layer. This difference determines that the routing and switch need to use different control information in the process of moving information, so the two ways to realize their functions are different. Routers each interface IP is in a different network segment, the port not only separates the conflict domain, also separates the broadcast domain
2. What are the classification of IP addresses? The representation of subnet mask and its function
Class A
0000 0000-0111 1111:1-127
Network number 126,127 reserved loopback address
Number of hosts per network: 2^24-2
Default Subnet Mask: 255.0.0.0
Private network Address: 10.0.0.0/8
Class B
1000 0000-1011 1111:128-191
Network number: 2^14
Number of hosts per network: 2^16-2
Default Subnet Mask: 255.255.0.0
Private network Address: 172.16.0.0/16-172.31.0.0/16
Class C
1100 0000-1101 1111:192-223
Network number: 2^21
Number of hosts per network: 2^8-2
Default Subnet Mask: 255.255.255.0
Private network Address: 192.168.0.0/24-192.168.255.0/24
For LAN use
Class D: Multicast
1110 0000-1110 1111:224-239
Class E
240-255 (for scientific research)
Subnet Mask: IP address and network address are calculated and computed
Used to indicate which bits of an IP address identify the subnet on which the host resides and which bits identify the host's bitmask. The subnet mask cannot exist alone, it must be used in conjunction with an IP address. The subnet mask has only one function, which is to divide an IP address into two parts: network address and host address.
The length of the subnet mask is 32 bits, or it can be in decimal form. For example, the subnet mask for the binary form: 1111 1111.1111 1111.1111 1111.0000 0000, in decimal form: 255.255.255.0
3. What are the models of computer networks (OSI model and TCP/IP model), the functions of each layer and the physical devices involved?
Layer Seven: Link layer, physical layer, network layer, transport layer, Session layer, presentation layer, application layer
Physical layer: Provides the mechanical, electrical, functional, and procedural characteristics required to establish, maintain, and dismantle physical links, and to transmit non-structural bitstream and fault detection instructions on the physical link.
Physical layer of media including overhead wire, balance cable, optical fiber, wireless channel, etc.
Data Link layer: Provides the function and process of data sending and receiving between network layer entities; Provides data link flow control
Two layer switches, hubs, bridges
Network layer: Control the operation of packet transfer system, routing, congestion Control, network interconnection and other functions, its role is to be specific physical transmission to the high-level transparent.
Routers, layer three switches
Transport Layer: Provides the ability to establish, maintain, and dismantle transport connections, select the network layer to provide the most appropriate services, provide reliable and transparent data transfer between systems, and provide end-to-end error recovery and traffic control.
Session Layer: Provides the ability to establish, maintain, and end session connections between processes, providing management control of interactive sessions, i.e., one-way interaction, two alternate, and two simultaneous session modes.
Presentation layer: Represents the application process negotiation data representation, complete data conversion, formatting and text compression.
Application tier: Provides a variety of user services
TCP/IP model
Four layers: Network interface layer, network layer, Transport layer, application layer
The network interface layer, which includes protocols for collaborating on the transfer of IP data over existing network media. In fact, the TCP/IP standard does not define the functions corresponding to the ISO data link layer and the physical layer. Instead, it defines protocols such as Address Resolution Protocol ARP, which provides the interface between the data structure of the TCP/IP protocol and the actual physical hardware.
Network layer: The network layer solves the problem of communication between computer and computer, which includes three functions:
• Handle packet-sending requests from the transport layer, send packets into the IP datagram, populate the header, select the path, and then send the datagram to the appropriate network interface when the request is received.
• Processing of data messages.
• Processing network Control Message protocol, i.e. processing path, flow control, blocking, etc.
The network layer corresponding to the OSI seven layer model, this layer contains the IP protocol, RIP protocol, responsible for the data packaging, addressing and routing. Also included is the inter-Network Control Message Protocol ICMP, used to provide network diagnostic information.
Transport Layer
The transport layer solves the problem of communication between computer programs and computer programs. The transport layer, which corresponds to the OSI seven-layer reference model, provides two end-to-end communication services. The TCP protocol provides reliable data flow transport service, and the UDP protocol provides unreliable User datagram service.
Application Layer
The application layer and presentation layer corresponding to the OSI seven-layer reference model, the application layer protocol of the Internet includes FINGER/WHOIS/FTP/GOPHER/HTTP/TELNET/SMTP/IRC/NNTP, etc.
4, how to access the Linux host to the TCP/IP network, please describe the detailed steps. (Manually specified mode)
• Physical connection
Turn on Web Services
• Configure IP address, subnet mask, set gateway, DNS service
• Then restart the network service to load the configuration file
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Onboot=yes #开机启动
Bootproto=static/dhcp #设置静态IP或者自动分配
ipaddr=192.168.1.1
netmask=255.255.255.0
gateway=192.168.1.254
Service Network restart
Re-configure DNS domain name resolution:
Vim/etc/resolv.conf
NameServer 8.8.8.8
NameServer 114.114.114.114 Configure up to 3 DNS
5. What are the ways to configure network information for Linux hosts, please describe each process.
First) Use command: ifconfig eth0 192.168.1.1 netmask 255.255.255.0
Temporary effect, failure after shutdown
Second) modify the NIC configuration file: Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Then restart the Network service for permanent
Third) Use the graphical interface setup--network configuration, select the appropriate options,
And then restart the Network service, which is also permanently active
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;
#!/bin/bash
For I in $ (SEQ 1 254)
Do
serverip=172.16.250. $i
Ping-c 1-w 1 $ServerIp &>/dev/null
If [$?-eq 0]; Then
Echo-e "\033[0;32;1m $ServerIp is online. \033[0m "
Else
Echo-e "\033[0;31;1m $ServerIp is offline. \033[0m "
Fi
Done
7, detailed description of each network interface configuration file The meaning of each parameter and its corresponding value;
Device=eth0 #网卡设备名称
HWADDR=00:0C:29:D7:35:CB #网卡物理地址即mac地址
Type=ethernet #接口类型 Ethernet | Bridge bridging
UUID=35FD902F-4A70-46AF-8FC4-EDD586FC06C0 #该设备的唯一标识符
Onboot=yes #系统引导时是否自动激活此设备: yes| No
Nm_controlled=yes #NM: Network manager does this NIC accept NM control
BOOTPROTO=DHCP #激活此设备时是否使用地址配置协议 options: DHCP (auto get) |static (manual configuration) | None (not commonly used) |BOOTP (not commonly used)
ipaddr= Configuring IP Addresses
netmask= Configuring the subnet mask
gateway= Configuring the Gateway
dns1= Configuring the first DNS server
dns2= Configuring a second DNS server
8, how to configure multiple addresses for the network interface, what are the ways?
To configure a network alias:
To configure a network alias:
Ifconfig eth0:1 192.168.1.1
Then create a new eth0:1 configuration file
Device=eth0:1
Bootproto=static
ipaddr=192.168.1.1
netmask=255.255.255.0
gateway=192.168.1.254
Onboot=yes
9. What are the commonly used network management tools, and describe how they are used in an example format?
1) Ping
ping command to test network connectivity between hosts
Common options:
-C: Set the number of responses required to complete
-w:waitsecs stops the execution of the ping program after waitsecs seconds. This option is useful when you are trying to detect a non-unreachable host.
-Q: Static output. Only summary rows are displayed when the program starts and ends.
-S:p acketsize Specifies the amount of bytes to send data
Example:
Ping 192.168.100.1
Ping-w 1-c 1 192.168.100.1
2) Tracepath,traceroute
The Tracepath command is used to track the routed route that is connected to the destination address
The traceroute command is used to track the full path of a packet as it travels over the network
Common options:
-p< Communication port > Set communication port for UDP transport protocol
-w< Timeout seconds > Set the time to wait for the remote host to return
-q<nqueries> sets the number of probe packets per hop. Default is 3
Example:
Traceroute-w 3 baidu.com
Tracepath www.baidu.com
3) Netstat,ss
Netstat command to view network status
The SS command is also used to view the network turn state, when the number of connections is more than netstat command performance, parameter usage and netstat basically consistent
Show Network Connections
netstat [--tcp|-t] [--udp|-u] [-n] [-a]
-T TCP protocol
-U UDP protocol
-W RAW Socket related
-L in Listening state
-A All States
-N to digitally display IP and ports
-E Extended format
-P show PID of related process
Show route Table
netstat [-R] [-N]
-R Display Kernel routing table
-N Number format
Display interface Statistics
netstat [-i|-i] [iface] [-a]
Netstat-i
Netstat-i Iface
Example:
Netstat-ant
Netstat-antlp
Netstat-ntlp
4) Route
The route command is used to manage routing
View: Route-n
Add: Route add
Route add [-net|-host] target [GW] [Dev]
Example:
Route add-host 192.168.100.110 GW 192.168.38.1 Dev eth0
Route add-net 192.168.100.0/24 GW 192.168.38.1 Dev eth0
Default route:
Route add-net 0.0.0.0 netmask 0.0.0.0 GW 192.168.38.1
Route add default GW 192.168.38.1
Delete: Route del
Route del [-net|-host] target [GW] [Dev]
Example:
Route Del-host 192.168.100.110
Route del-net 192.168.100.0 netmask 255.255.255.0
5) Host
The host command is used to do DNS queries. If the command parameter is a domain name, the command outputs the associated IP, and if the command argument is IP, the command outputs the associated domain name
Common options:
-I. Reverse Lookup
-A equals "-v-t", showing all types, details
-V Run-time display verbose processing information
-t< type > specified type, including a, all, MX, NS
-4 queries for IPV4
-6 queries for IPV6
Example:
Host Www.baidu.com
HOST-T NS www.baidu.com
6) Ifconfig
Ifconfig is a tool for viewing, configuring, enabling, or disabling network interfaces
Ifconfig [Interface]
Example:
Ifconfig #查看所有已激活网卡的信息
Ifconfig eth0 #查看eth0网卡信息
Ifconfig eth0 192.168.100.100 #配置eth0接口ip地址
7) IP
IP is a powerful network configuration tool within the IPROUTE2 package
IP link set {dev DEVICE | group Devgroup} [{up |}]
Example:
IP link Show #查看所有接口链接信息
IP link show eth0 #查看eth0接口链接信息
IP link set dev eth0 up #up/down start/close Device
IP addr {add|del|change|replace} ifaddr dev STRING
Example:
IP Addr Show #查看所有接口ip信息
IP addr Show eth0 #查看eth0接口ip信息
IP addr Add 192.168.100.110 dev eth0 #指定eth0添加一个ip地址
IP addr del 192.168.100.110 dev eth0 #指定eth0删除ip地址
This article is from the "11822904" blog, please be sure to keep this source http://11832904.blog.51cto.com/11822904/1954047
Linux Fifth week micro jobs