Linux Learning-Week 9

1. Summarize IP classifications and the number of IPs that can be allocated for each classification

IP addresses are classified according to the network number and host number, and are divided into three types: A, B, and C, and special addresses D and E.
(1) Type A Type
A: (1.0.0.0-126.0.0.0) (default subnet mask: 255.0.0.0) The first byte is the network number, and the last three bytes are the host number. The front of this type of IP address is "0", so the network number of the address is between 1 and 126. Generally used in large networks.
(2) Type B Type
B: (128.0.0.0-191.255.0.0) (default subnet mask: 255.255.0.0) The first two bytes are the network number, and the last two bytes are the host number. The front of this type of IP address is "10", so the network number of the address is between 128 and 191. Generally used in medium-scale networks.
(3) Type C Type
C: (192.0.0.0-223.255.255.0) (Subnet Mask: 255.255.255.0) The first three bytes are the network number, and the last byte is the host number. The front of this type of IP address is "110", so the network number of the address is between 192 and 223. Generally used in small networks.
(4) Class D Class
D: is a multicast address. The front of this type of IP address is "1110", so the network number of the address is between 224 and 239. Generally used for multicast users.
(5) Class E Class
E: reserved addresses. The front of this type of IP address is "1111", so the network number of the address is between 240 and 255.

Among the three main types of IP addresses, three areas are reserved as private addresses. The address ranges are as follows:
Class A address: 10.0.0.0~10.255.255.255
Class B address: 172.16.0.0~172.31.255.255
Class C address: 192.168.0.0~192.168.255.255

Loopback address: 127.0.0.1. It is also the local address, which is equivalent to localhost or local IP. Generally used for testing. For example: ping 127.0.0.1 to test whether the local TCP/IP is normal.

2. Summarize the IP configuration method (take the 10.0.0.200/24 ​​configuration on eth1 as an example)

(1) The ifconfig command configures IP
ifconfig eth1 10.0.0.200 netmask 255.255.255.0
ifconfig eth1 up
only temporarily modifies the network interface, which takes effect immediately, but not permanently.
(2) The ip command configures IP
ip addr a 10.0.0.200/24 ​​dev eth1
only Temporary modification of the network interface will take effect immediately, but not permanently.
(3) Use the graphical interface to configure the IP
CentOS7 and 8 Use the nmtui command to enter the configuration interface
Linux Learning-Week 9
CentOS6 Use setup to enter the configuration interface
Linux Learning-Week 9
After the network interface is modified, the network interface will not take effect immediately, once it takes effect , It will be effective forever. The solution to make the IP effective is:
#ifdown eth1 && ifup eth1 Disable first, and then enable
#service network restart network service restart
#/etc/init.d/network restart You can also restart the network interface
(4) Use the configuration file for configuration
Create and edit the /etc/sysconfig/network-scripts/ifcfg-eth1 file with the following content:
DEVICE=eth1
NAME=eth2
BOOTPROTO=static
IPADDR=10.0.0.200
PREFIX=24
GATEWAY=10.0.0.254
DNS1=223.6 .6.6
DNS2=180.76.76.76
ONBOOT=yes
(5) Use DHCP for dynamic allocation

3. Use nmcli to achieve bonding

(1) Add bonding interface
nmcli connection add type bond con-name testbond ifname bond0 mode active-backup ipv4.method manual ipv4.addresses 10.0.0.100/24
(2) Add slave interface
nmcli connection add con-name testbond-eth1 ifname eth1 type bond-slave master bond0
nmcli connection add con-name testbond-eth2 ifname eth2 type bond-slave master bond0
(3) To start bonding, you must first start the slave interface
nmcli con up testbond-eth1
nmcli con up testbond-eth2
( 4) Start binding
nmcli con up testbond

Guess you like

Origin blog.51cto.com/14255962/2605444