Note: The eighth week of homework, please organize the following topics in the 51cto blog, after completion, please submit the corresponding post link address in the answer bar, the submission format is as follows:
School Number + name + Post link address
eg:1+ Zhang San +http://mageedu.blog.51cto.com/4265610/1794420
Content of this week's job:
1, describe the network bridge, hub, two-layer switch, layer three switch, router functions, usage scenarios and differences.
2. What are the classification of IP addresses? The representation of subnet mask and its function
IPV4 address consists of four segments of three-bit decimal points, 0.0.0.0-255.255.255.255, divided into five categories
Class A:
0 000 0000-0 111 1111:1-127
Network number: 2^7-1,127
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:
00 0000-10 11 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:
0 0000-110 1 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
Class D: Multicast
1110 0000-1110 1111:224-239
Class E:
240-255
The format of the subnet mask: expressed in dotted decimal notation that is the same as the IP address format, such as 255.0.0.0 or after the IP address plus/sign and a 1-32-bit network bit number.
The role of subnet mask: Through the binary of IP address and subnet mask binary and operation, to determine the network address and host number of a device, that is, through the subnet mask to distinguish between the network part and the host part. Once the subnet mask is set, the network address and host address are fixed.
3. What are the models of computer networks (OSI model and TCP/IP model), the functions of each layer and the physical devices involved?
Osi
|
Tcp / ip
|
Function |
Agreement
|
Physical equipment |
Application Layer Application tier |
Application Layer Application tier |
File transfer, email, file service, virtual terminal, etc. |
Tftp,ftp,nfs,wais
|
|
Presentation Layer Presentation Layers |
Data formatting, code conversion, data encryption, etc. |
Telnet,rlogin,snmp,gopher
|
|
Session Layer Session Layer |
To release or establish contact with other contacts |
Smtp,dns
|
|
Transprot Layer Transport Layers |
Transfer Layer Transport layers |
Provides an end-to-end interface |
Tcp,udp
|
Four-layer delivery machine, four-layer router |
Network layer |
Internet Layer Network Layers |
To select a route for a packet |
Ip,icmp,arp,rarp,akp,uucp
|
Routers, layer three switches |
Datalink Layer Data Link layers |
Datalink Layer Data Link layers |
Transmit address frame, error detection function |
Fddi,ethernet,arpanet,pdn,slp,ppp
|
Ethernet switch, NIC |
Physical layer Physical layers |
Physical layer Physical layers |
Transmits data in the form of binary data on the physical media, and provides for electrical performance, etc. |
ieee802.2--802.11
|
Repeater, hub, twisted pair |
4, how to access the Linux host to the TCP/IP network, please describe the detailed steps. (Manually specified mode)
Determine if a Linux host is connected to a TCP/IP network
(a) View network interface information
$ ifconfig #查看活动的网络接口信息
$ ifconfig-a #查看所有的网络接口信息
$ ifconfig eth0 #查看指定的eth0网络接口信息
(b) View Gateway, routing information
$ route-n
(c) Review of network connectivity
$ ping 192.168.239.1
$ nslookup www.163.com
To connect a host to a TCP/IP network using a manual designation
(a) Temporary manual configuration of IPV4 address
$ ifconfig eth0 192.168.239.128/24
(b) Add default gateway route
$ rout Add default GW 192.168.239.1
(c) Add DNS domain name resolution
Edit Config file/etc/resolv.conf, modify add
dns1=192.168.239.1
dns2=192.168.1.1
(d) Modification of host name
$ hostname Test
5. What are the ways to configure network information for Linux hosts, please describe each process.
Mode one: Temporarily configure network information
(a) Configure IPV4 address, subnet mask
$ ifconfig eth0 192.168.239.128/24 up
$ IP addr Add 192.168.239.128/24 dev eth0
$ IP link set up dev eth0
$ nmcli Connection Modify Eht0 192.168.239.128/24 up
(b) Configuring gateways and routes
$ route add-net 192.168.183.0 netmask 255.255.255.0 gw 192.168.239.1 Dev eth0
$ route Add default GW 192.168.239.1 dev eth0
$ IP route add 192.168.183.0/24 via 192.168.239.1 Dev eth0
$ IP route add default via 192.168.239.1 dev eth0
(c) Configuring DNS
DNS server designation, edit/etc/resolv.conf, modify nameserver 192.168.1.1 dns_server_ip2 192.168.239.1
Mode two: Edit the configuration file
To make the configuration effective after a restart, manually edit the configuration file.
(a) Edit the iface configuration file/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
hwaddr=00:0c:29:f9:c1:9e
Bootproto=static
Nm_controlled=no
Onboot=yes
Type=ethernet
UUID: The unique identification of the device;
ipaddr=192.168.239.128
netmask=255.255.255.0
gateway=192.168.239.1
dns1=192.168.1.1
dns2=192.168.239.1
Userctl=no
(b) Edit the routing profile/etc/sysconfig/network-scripts/rout-eth0
192.168.183.0/24 via 192.168.239.1
Default via 192.168.239.1
(c) Edit the DNS configuration file/etc/resolv.conf
dns1=192.168.1.1
dns2=192.168.239.1
(d) Restart the NIC or network service
$ ifconfig eth0 down; Ifconfig eth0 up
$ service Network start
Method Three: Using the graphical network management tool
System-config-network-tui,setup,nmtui
To configure the host name of the current host:
$ hostname Test
Edit configuration file/etc/sysconfig/network, modify Hostname=test
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# script file is Located/root/findonlinefor i in {1..254};d o if $ (ping 172.168.250. $i &>/dev/null ) then Echo-e "\033[32m 172.168.250. $i are online \033[0m" Else Echo-e "\033[31m 172.168.250. $i is offline \033[0m "Fidone
7, detailed description of each network interface configuration file The meaning of each parameter and its corresponding value;
IP, MASK, GW, DNS-related configuration files:/etc/sysconfig/network-scripts/ifcfg-iface
Routing-related configuration files:/etc/sysconfig/network-scripts/route-iface
/etc/sysconfig/network-scripts/ifcfg-iface:
Device: Devices to which this profile applies;
HWADDR: The MAC address of the corresponding device;
Bootproto: The address configuration protocol used when activating this device, commonly used DHCP, static, none, BOOTP;
NM_CONTROLLED:NM is the abbreviation of NetworkManager, whether the NIC accepts NM control, CentOS6 is recommended as "no";
Onboot: Whether this device is activated at system boot time;
Type: interface types; common Ethernet, Bridge;
UUID: The unique identification of the device;
IPADDR: Specify the IP address;
NETMASK: Subnet mask;
Gateway: Default gateways;
DNS1: The first DNS server points to;
DNS2: The second DNS server points to;
Userctl: Whether the ordinary user can control the device;
Peerdns: If the value of Bootproto is "DHCP", whether the DNS server assigned by DHCP server is allowed to point to information directly to the/etc/resolv.conf file;
/etc/sysconfig/network-scripts/route-iface
Two different styles:
(1) TARGET via GW
(2) Define one route per three lines
Address#=target
Netmask#=mask
Gateway#=gw
8, how to configure multiple addresses for the network interface, what are the ways?
Mode one: Use ifconfig temporary configuration $ ifconfig eth0:0 192.168.239.129 netmask 255.255.255.0$ ifconfig eth0:1 192.168.239.130/24
Mode two: Use IP temp config $ ip addr add 192.168.239.129/24 dev eth0$ ip addr add 192.168.239.130/24 dev eth0
Method Three: Use NMCLI configuration $ nmcli Connection Modify eno16777755 +192.168.183.129/24
Mode four: Modify the Iface configuration file ifcfg-eth0:0,ifcfg-eth0:1$ cp/etc/sysconfig/network-scripts/ifcg-eth0/etc/sysconfig/ network-scritps/ifcfg-eth0:0$ cp/etc/sysconfig/network-scripts/ifcg-eth0/etc/sysconfig/network-scritps/ Ifcfg-eth0:1
Mode five: Use tool System-config-network-tui,setup,nmtui
9. What are the commonly used network management tools, and describe how they are used in an example format?
10, Linux system software package management methods (installation, upgrade, uninstall and other operations), and how to manage.
11, how to use the distribution CD as a yum repository, please describe the process.
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;
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;
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;
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;
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;
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;
18, printing 99 multiplication table;
Linux sysadmin (2): Network, RPM package management and some scripts