In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Logical volume reduction
When reducing, you should be careful not to exceed the space of the file system, otherwise it will damage the file system.
The first step is to unmount (must)
Part II check document integrity (must)
E2fsck-f / dev/vg0/lv0
The third part of the file system reduction, first reduce the file system.
Resize2fs / dev/vg0/lv0 10G (reduced to 10G left)
Step 4 reduction of logical volume groups
Lvreduce-L 10G / dev/vg0/lv0
Lvreduce-r-L 10G / dev/vg0/lv0 can be scaled down with the above file system in one step.
Step 5: mount it back to use
Mount-a
Delete logical volume group member
If the deleted member has useful space, the data must be moved to other members before it can be deleted. Make sure there is enough space in other spaces first. (move the space, not necessarily have the data in it)
Pvmove / dev/sd* remove members' space if there is data on disk, remove the data backup first
Unmount before deletion
Lvmove / dev/vg0/lv0
Logical volume lv0 has been successfully removed
Vgreduce vg0 / dev/sd* removes members of a logical volume group
Remove the member that was queried before
Start removing members with 1 digits
The volume group space is only 7G, and the original space is more than 30g.
Vgremove vg0 delete volume group (unmount before deletion)
Delete the data inside and delete it.
Pvremove / dev/sd* remove physical Volume
Remove the member that was queried before
Continue to delete members of physical volume digit 1
Only physical volume members that have not been deleted are left
Logical volume snapshot
Snapshot (snapshot)
Snapshots can act like backups, but they work differently.
The snapshot itself is a logical volume, and the same group in the logical volume you use is a snapshot logical volume.
When you create a logical snapshot, only a blank space volume is allocated, and when you modify any data in the logical volume, the snapshot logical volume is automatically backed up to the snapshot (only the final result of the modification is retained).
Files that are not modified are only in the logical volume of the original file.
There should be read permissions in the snapshot volume.
In theory, the snapshot logical volume should be the same size as the logical volume.
Lvcreate-n lv0-snapshot-s-p r-L 10G / dev/vg0/lv0 to take a snapshot
-s: indicates that it is a snapshot logical volume
-p r indicates that this is a read-only logical volume
Found that it has been successfully created.
Mkdir / mnt/snapshot
Mount / dev/vg0/lv0-snapshot / mnt/snapshot mount snapshot
Snapshot logical volumes do not require a different format file system format, its default file system format is the same as the source logical volume, and the UUID is the same. Just mount it when you need to use it.
When the snapshot logical volume is not mounted
Delete the file of the source logical volume
Then the snapshot logic volume is found by mounting, and it is found that the snapshot logic volume does not need to take effect in the mount, but can still take effect in the case of no mount. If necessary, you can copy back the deleted file in the snapshot logical volume.
Unmount snapshot
Umount / mnt/snapshot
Lvremove / dev/vg0/lv0 (logical volumes and snapshots can be deleted directly after version 6)
Vgremove vg0 (you can delete snapshots if you delete a logical volume group)
Delete the logical volume group directly, and you can delete both the logical volume and the snapshot logical volume.
Btrfs file system
Technical preview version
Core features:
Multiple physical volumes are supported and consist of multiple underlying physical volumes.
Copy update mechanism on write (Cow)
Transparent compression (like windows hard disk compression, underlying compression and decompression, does not affect the use process, can effectively save space)
Mount-o compress=lzo
Mkfs.btrfs / dev/sd*
Btrfs filesystem show can view members of btrfs
Mount / dev/sd* / mnt/btrfs using mount
Btrfs filesystem resize (+ / -) 5G / mnt/btrfs increases and decreases usage space
Btrfs device add / dev/sde / mnt/btrfs add members
Btrfs balance status / mnt/btrfs balance data, RAID combination will be added automatically
Btrfs filesystem show View members
Btrfs filesystem df / mnt/btrfs View df
Brtfs balance start / mnt/btrfs initiates balancing
Btrfs balance start-dconvert=single / mnt/btrfs
Btrfs subvolume list / mnt/btrfs view subvolumes
Btrfs subvolume create / mnt/btrfs/sub1 create subvolumes
Mount-o subvo1=sub1 / dev/sd* / mnt/sub1 can only mount subvolumes separately.
Mount-o subvoid=265 / dev/sd* / mnt/sub2 can also be mounted using ID
Btrfs subvolume suapshot / mnt/sub1 / mnt/sub1-snapshot make a snapshot of the subvolume sub1
Cp-reflink fstab fstab2 copies files when writing, and generates fstab2 when writing.
Btrfs device delete / dev/sd* / mnt/brtfs Delete members
Btrfs-convert / dev/sd*
-r: can be converted back to ext4
Can be converted from ext4 format disk to btrfs format
Btrfs subvolume delete / mnt/btrfs delete subvolume
Network management
Computers or devices communicate through typed or untyped links through certain communication rules.
* Virtual private network
Because it has to be encrypted through the Internet.
High availability, the more time it takes to use it, the higher the availability.
High reliability, failure time as short as possible.
OSI
Seven-layer model
Application layer application-- > provides network services for processes
Presentation layer presentation-- > data representation, data construction, encryption and decryption
Session layer session-- > establish, manage calls
Transport layer tranport-- > function is related to protocol
Network layer network-- > data grouping, path selection (router decision)
The data link layer data link-- > constitutes a frame, and the frame is a unit.
Physical layer physical-- > binary transport
Encapsulate and unencapsulate data.
Mac physical address
Ip address logical address
Unicast unicast
Broadcast broadcast
Multicast Multicast
Simplex (TV)
Duplex: half-duplex (intercom), full-duplex (telephone)
Lan local area network
Wan wide area network
Mac physical address, usually written in 16-bit base
Generally, the physical address of each network card is unique.
The switch can record the physical address and port of the linked host and make the data directly to the destination port.
Router
Separate broadcast domain
Choose the best path to the destination in the routing table
Maintain and check routing confidence
Link wide area network
Vlan virtual LAN
TCP/IP protocol stack
It contains a lot of agreements.
Four layers are defined
Application layer-> Transport layer-- > internet layer-- > Network access layer (Ethernet)
Ping-f 10.1.0.1 can send a large number of ping packets
Ping-f 10.1.0.1-s 65507
-s specifies the size of the network packet
9.2
The switch is very unable to broadcast.
Because the switch only recognizes the original address of the transmission, it cannot identify the physical address of all 1 or 0 in its physical table, so it will default to an unrecognized address, so the transmitted packet will be discarded from flood.
Echo 1 > / proc/sys/net/ipv4/icmp_echo_ignore_all
Prohibit all ping
ARP address Resolution Protocol
ARP is based on broadcast mechanism (extracting target physical address communication)
Through the broadcast, you only need to know the user's IP, and you can view the physical address of the responding user.
ARP does not include a checking mechanism, so you can impersonate a gateway and collect users' data by reconnecting to a real gateway.
The arp instruction can query the communication records of arp.
Ip neigh has the same effect.
Routed traffic across network segments, because data is transmitted across network segments, the IP of the original address remains the same, and the physical address of the transmission will change.
IP protocol
6 is TCP protocol 17 is UDP protocol
The IP address consists of two parts (32-bit binary)
The IP address source is binary and can be directly communicated with binary ping.
Network ID:
Identify the network
Each network segment is assigned a network ID
Host ID:
Identify a single host
Assigned to each device by the organization
10000000 128
1000000 64
100000 32
10000 16
1000 8
100 4
10 2
1 1
Ip address classification
Class An address 0xxxxxxx.y.y.y
1-127 (127 networks).
Number of hosts in a network segment = 2 ^ host bits-2
2 ^ 24-2 number of hosts with Class An addresses
Class B address 10xxxxxx.xxxxxxxx.y.y
128.0
191.255
128191 (2 ^ 14 networks) 16384
Number of hosts: 2 ^ 16 65536
Class C address: 110xxxxx.x.x.y
192-223 (2 ^ 21 networks)
Number of hosts: 251
Category D 224-239
Class E 240-255
The latter class address is not assigned to the application.
Non-class domain
Bc
Convert obase=2 to binary
Ibase=2 binary output conversion
Convert obase=8 to octal
Let iTunes 210represents binary 110 conversion decimal.
Echo $I
Subnet mask
Defines the number of digits of the network ID and the host ID
Can distinguish between network and host ID
Class An address 255.0.0.0
Class B address 255.255.0.0
Class C address 255.255.255.0
Network ID=IP and Subnet Mask
10.1.252.100
255.255.0.0
10.1.0.0 Network ID
Special address
0.0.0.0
0.0.0.0 is not a true IP address. It represents a collection: all unknown hosts and destination networks.
255.255.255.255
Restrict broadcast addresses. For the local machine, this address refers to all hosts in the local network segment (the same broadcast domain)
127.0.0.1127.255.255.254
The local loopback address is mainly used for testing. A packet with a destination address of "127.0.0.1" should never appear on the transmission media.
224.0.0.0 to 239.255.255.255
The multicast address, 224.0.0.1 refers specifically to all hosts, and 224.0.0.2 refers to all routers. 224.0.0.5 refers to the OSPF router, the address is mostly used for some specific programs and multimedia programs
169.254.x.x
If the Windows host uses DHCP to automatically assign the IP address and cannot obtain the address from the DHCP server, the system assigns such an address to the host.
Subnetting:
A large network is divided into several small networks
Network id borrows bits n from host id, and the number of subnets is 2 ^ n
Subnetting results in loss of boundary IP
Lost ip= (number of subnets-1) * 2
Number of hosts in a network segment = 2 ^ host bits-2
10.100.208.1 Compact 20 minutes and 8 subnets
First of all, let's start with 128, 64, 32, 16, 8, 4, 4, 2, and 1. It is concluded that 208 is the boundary address by 208 "128" 6416.
128 64 32 16 8 4 2 1 | 128 64
17 18 19 20 21 22 23 24 | 25 26
1 can be regarded as 256 | this is the range of the next network segment, otherwise it can be the range of the previous network segment.
It can be concluded from the subnet mask of 20 that it is a network with 16 bits as a network segment.
208-223 a total of 16 network segments are subdivided into 8
208-209 210-211 212-213 214-215 216-217 218-219 220-221 222-223 there are eight subnets
If 10.100.208.1 Compact 20 is to be divided into 4 subnets
208-211 212-215 216-219 220-223 A total of 4 subnets
Route-n routing table
Basic network configuration
System-config-network version 6 Network profile
Stup options can be configured
Ethernet: eth [0meme1pia 2.]
Naming of cat / etc/udev/rules.d/ definition files
Vim / etc/udev/rules.d/70-persistent-net.rules modify configuration information record
You can change the name of the network card.
Cd / etc/sysconfig/network-scripts/ifcfg-eth0
Vim / etc/sysconfig/network-scripts/ifcfg-eth0
You can specify the startup of network card, network IP, and other services as needed.
Format:
Name of DEVICE=eth0 network card
IPADDR=10.1.1.1 IP address
PREFIX=16 subnet mask
GATEWAY=10.1.162.20 network address
DNS1=8.8.8.8 DNS address, up to 3 can be set
Use of ONPARENT=YES aliases
.. bashrc restart configuration service
Service network restart restarts network services
MACADDER modifies the physical address to change H to A
Service NetworkManger status to view the status of automatic recognition service
Service NetworkManger stop pauses automatic recognition of network ports
Service NetworkManger off shuts down the network automatic identification service
Service NetworkManger restart restart configuration service
Chkconfig NetworkManger off shuts down the network automatic recognition service (whether or not to start the next time)
It is recommended that if the network port wants to configure the service, turn off this service, this service is easy to cause errors with other network port services.
Ifconfig eth0 up / down turns on or off the specified network card
Open the network card named eth0
Turn off the network card named eth0
Cat / etc/resolv.conf View DNS
You can see both ifconfig-an active and inactive network cards.
Bonding (multiple network cards are replaced. When the primary network card stops, the standby network card will automatically replace with [ip is the same as mac address])
It is to bind multiple NICs to the same IP address to provide services to achieve high availability or load balancing. Of course, it is impossible to directly set the same IP address to two network cards. Through bonding, a virtual network card provides external connection, and the physical network card is modified to the same MAC address.
Service NetworkManager status checks whether the network automatically recognizes whether it is started to prevent setting errors.
Service NetworkManager stop temporarily shuts down the network automatic identification service.
Chkconfig NetworkManager off
The service will not be started after the next shutdown.
This service of mine is already turned off.
Cd / etc/sysconfig/network-scripts
Vim / etc/sysconfig/network-scripts/ifcfg-bond0 generates a bond0 network card configuration file
Vim / etc/sysconfig/network-scripts/ifcfg-eth0 modifies the eth0 Nic port configuration file
Vim / etc/sysconfig/network-scripts/ifcfg-eth2 modifies the eth2 Nic port configuration file
Vim ifcfg-bond0
DEVICE=bond0
IPADDR=10.1.162.10 host IP address
PREFIX=16
GATEWAY=10.1.10.1 Gateway address
DNS1=8.8.8.8
BONDING_OPTS= "miimon=100 mode=1"
Vim ifcfg-eth0
DEVICE=ech0
SLAVE=yes
MASTER=bond0
Cp ifcfg-ech0 ifcfg-eth2
Vim ifcfg-eth2
DEVICE=ech2
SLAVE=yes
MASTER=bond0
Cat / proc/net/bonding/bond0 can check the status of team members in bond0.
Service network restart restarts network services
It is found that the physical addresses of the network cards are all the same.
In the course of using it, I simulated the sudden shutdown of the network card in use, and the backup network card was used normally on the automatic connection.
Routing tabl
Route-n view
Route add add
Nmcli
Nmtui, the configuration tool used in version 7
1. A company applies for a Class C IP address, but connects six subsidiaries, the largest one.
If the company has 26 computers and each subsidiary is in a network segment, the subnet mask should be set to
128 64 32 16 8 4 2 1 128 64 32
17 18 19 20 21 22 23 24 25 26 27
Suppose the class C address is 192.168.1.0 apprentice 24.
The address is 192.168.1:
0-31 32-63 64-95 96-127 128-159 160-191
1-30 33-62 63-94 95-126
The subnet mask is
/ 27
255.255.255.224
A group company has 12 subsidiaries and each subsidiary has 4 departments.
The superior gives a network segment of 172.16.0.0plus 16, which is assigned to each subsidiary and its department.
128 64 32 16 8 4 2 1 128 64
17 18 19 20 21 22 23 24 25 26
The network segment is 172.16.0.0and16.
Divided into 12 companies, so it can only be divided into 16 subnets
0-15 16-31 32-47 48-63 64-79 80-95 96-111 112-127 128-143 144-159
160-175 176-191
The subnet mask is
/ 20
255.255.240.0
12 companies need 4 subnets each, so at least 48 subnets are needed, so divide 64 subnets
172.16.0-191.:
1-63 64-127 128-191 192-254
The subnet mask is
/ 26
255.255.255.192
A group company assigned an IP address of 192.168.5.0 Universe 24 to subsidiary A.
Now Company A has two-storey office buildings (1st floor and 2nd floor), which are connected to the public network from the router on the first floor.
There are 100 computers connected to the Internet on the first floor and 53 computers on the second floor. If you are the network manager of the company
How do you plan this IP?
128 64 32 16 8 4 2 1 128 64
17 18 19 20 21 22 23 24 25 26
The ip address is 192.168.5.0ax 24.
0-127 128-255
1-126 127-254
Subnet mask:
/ 25
255.255.255.128
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.