IP address: is a way of addressing the host on the Internet, also known as an Internetwork protocol address. Common IP address, divided into IPv4 and IPv6 two major categories;
Routing: Routers can connect network devices that are not the same network segment, enabling them to establish communication;
IP Address Classification
Class A: (the first eight bits are the network address: fixed)
0 000 0000-0 111 1111:1-127
Number of networks: 126, 127
Number of hosts per network: 2^24-2
Default Subnet Mask: 255.0.0.0
Public network address: 1.0.0.0-9.255.255.255; 11.0.0.0-126.255.255.255
Private network Address: 10.0.0.0-10.255.255.255
Class B: (the first 16 bits are the network address: fixed)
10 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
Public network address: 128.0.0.0-172.15.255.255; 172.32.0.0-191.255.255.255
Private network Address: 172.16.0.0-172.31.255.255
Class C: ()
110 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
Public network address: 192.0.0.0-192.167.255.255; 192.169.0.0-233.255.255.255
Private network Address: 192.168.0.0-192.168.255.255
Class D: Multicast
1110 0000-1110 1111:224-239
Class E:
240-255
Special Address:
0.0.0.0:
0.0.0.0 is not an IP address in the real sense. It represents a collection: All the unclear hosts and destination networks;
255.255.255.255:
Restrict broadcast addresses. For this machine, this address refers to all hosts within the network segment (the same broadcast domain);
127.0.0.1 ~127.255.255.254
A native loopback address that is used primarily for testing. Packets with the destination address "127.0.0.1" should never appear on the transmission medium;
224.0.0.0 to 239.255.255.255
multicast address, 224.0.0.1 refers specifically to all hosts, 224.0.0.2 specifically all routers; 224.0.0.5 means OSPF routers, and addresses are used for a number of specific programs and multimedia programs;
169.254.x.x
If the Windows host uses DHCP to automatically assign an IP address and cannot obtain an address from the DHCP server, the system assigns such an address to the host;
CIDR (Non-class inter-domain routing):
CIDR is defined by a subnet mask;
The subnet mask defines the number of bits of the network ID and the number of bits of the host ID;
The subnet mask is also a 32 bit binary number;
The subnet mask is used to represent the number of bits of the network ID, with 0 indicating the number of bits of the host ID;
Subnet Mask (mask)
Common calculation formula for IP address:
Equation 1:
Number of hosts in a network segment =2^ host bits-2
Number of host ID bits =32-network ID bits
Equation 2:
Network ID=IP and subnet masks
Equation 3:
Dividing subnets:
A large net is divided into several small nets
Network ID to host ID borrow N, subnet number 2^n
(Dividing subnet is only divided the borrowed bit)
Equation 4:
Loss ip= (number of subnets 2^n-1)
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/DD/wKiom1fNdtzCkfIsAAB3Tn-tYm0310.png-wh_500x0-wm_3 -wmp_4-s_1866725461.png "title=" subnet mask. PNG "alt=" Wkiom1fndtzckfisaab3tn-tym0310.png-wh_50 "/>
Classification and management of routing
Routing: cross-network communication;
Routing classifications:
Host routing
Network routing
Default route
Routing Management Commands:
The route command is a network command that displays and modifies entries in the local IP routing table;
View: Route-n
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/DD/wKiom1fNd9uhwk0dAAAiWFQiC1c315.png-wh_500x0-wm_3 -wmp_4-s_909958234.png "title=" Route-n view the routing table. PNG "alt=" Wkiom1fnd9uhwk0daaaiwfqic1c315.png-wh_50 "/>
Add: Route add
Route add [-net|-host] target [netmask Nm] [GW GW] [[Dev] If]
Target: 192.168.1.3 Gateway: 172.16.0.1
# route add-host 192.168.1.3 GW 172.16.0.1 Dev eth0
Target: 192.168.0.0 Gateway: 172.16.0.1
# route add-net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1 Dev eth0
# route add-net 192.168.0.0/24 GW 172.16.0.1 Dev eth0
Default route, Gateway: 172.16.0.1
# route add-net 0.0.0.0 netmask 0.0.0.0 GW 172.16.0.1
# route add default GW 172.16.0.1
Delete: Route del
Route del [-net|-host] target [GW GW] [netmask Nm] [[Dev] If]
Target: 192.168.1.3 Gateway: 172.16.0.1
# route Del-host 192.168.1.3
Target: 192.168.0.0 Gateway: 172.16.0.1
# route del-net 192.168.0.0 netmask 255.255.255.0
To configure a routing instance:
1, two hosts configured with two network cards to act as two routes R1 and R2;
Routing R1
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/87/17/wKioL1fUAgSTntfBAAAQmiIdbmU918.png-wh_500x0-wm_3 -wmp_4-s_2823052252.png the configuration of the "title=" Route R1. png "alt=" wkiol1fuagstntfbaaaqmiidbmu918.png-wh_50 "/>
Routing R2
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/87/1A/wKiom1fUAg7TewnIAAAURA6-lsQ553.png-wh_500x0-wm_3 -wmp_4-s_2960992827.png the configuration of the "title=" Route R2. png "alt=" wkiom1fuag7tewniaaaura6-lsq553.png-wh_50 "/>
2, configure IP addresses and gateways for two hosts PC1 and PC2 respectively:
PC1
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/87/17/wKioL1fUAh2zK6oZAAANUtH4fRw422.png-wh_500x0-wm_3 -wmp_4-s_4082948776.png the configuration of the "title=" host PC1. png "alt=" wkiol1fuah2zk6ozaaanuth4frw422.png-wh_50 "/>
PC2
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/87/1A/wKiom1fUAieATsyOAAAQ2iFqfDo872.png-wh_500x0-wm_3 -wmp_4-s_2388255111.png the configuration of the "title=" host PC2. png "alt=" wkiom1fuaieatsyoaaaq2ifqfdo872.png-wh_50 "/>
3,centos 6 shutting down the NetworkManager service and shutting down the firewall:
Shut down the NetworkManager services: Service NetworkManager stop
Firewall off: iptables-f
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/87/1A/wKiom1fUAu6QZA4jAABWxYaESCU649.png-wh_500x0-wm_3 -wmp_4-s_537034016.png "title=" shuts down the NetworkManager service and shuts down the firewall. PNG "alt=" Wkiom1fuau6qza4jaabwxyaescu649.png-wh_50 "/>
4,centos shutting down the NetworkManager service and shutting down the firewall:
Close NetworkManager service: Systemctl stop NetworkManager
Firewall off: iptables-f
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/DE/wKiom1fNewjiAXaWAABIcm73xeM512.png-wh_500x0-wm_3 -wmp_4-s_565453723.png "title=" Configure the route to start conversion data and clear the firewall. PNG "alt=" Wkiom1fnewjiaxawaabicm73xem512.png-wh_50 "/>
5, add the default gateway to the routing table in route R1:
Route add default GW 10.1.0.8
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/87/1A/wKiom1fUBtLyklvxAAAZkj0Qk70070.png-wh_500x0-wm_3 -wmp_4-s_2578381546.png "title=" route add default GW 10.1.0.8 (for R1 to configure Defaults gateway). png "alt=" Wkiom1fubtlyklvxaaazkj0qk70070.png-wh_50 "/>
6, add the default gateway to the routing table in route R2:
Route add default GW 10.1.0.6
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/87/18/wKioL1fUBxWhsMYGAAAclocaJek846.png-wh_500x0-wm_3 -wmp_4-s_1090916531.png "title=" route add default GW 10.1.0.6 (for R2 to configure Defaults gateway). png "alt=" Wkiol1fubxwhsmygaaaclocajek846.png-wh_50 "/>
7. Turn on data conversion for routing R1:
Echo 1 >/proc/sys/net/ipv4/ip_forward
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/87/1A/wKiom1fUB-fB-ULlAAAWtsaNGEc573.png-wh_500x0-wm_3 -wmp_4-s_3725144122.png "title=" to R1 turn on data conversion. PNG "alt=" Wkiom1fub-fb-ullaaawtsangec573.png-wh_50 "/>
8. Turn on data conversion for routing R2:
Echo 1 >/proc/sys/net/ipv4/ip_forward
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/87/1A/wKiom1fUCGGhCDpSAAAO-3gH0RI383.png-wh_500x0-wm_3 -wmp_4-s_594201631.png "title=" to R2 turn on data conversion. PNG "alt=" Wkiom1fucgghcdpsaaao-3gh0ri383.png-wh_50 "/>
9, with PC1 gradually to spell PC2:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/87/1A/wKiom1fUCLHTCJ1oAACOjyxgINc323.png-wh_500x0-wm_3 -wmp_4-s_1343665057.png "title=" with PC1 gradually to fight to PC2. PNG "alt=" Wkiom1fuclhtcj1oaacojyxginc323.png-wh_50 "/>
10, with PC2 gradually to spell PC1:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/87/18/wKioL1fUCN2QJnGLAACwCJrK56g922.png-wh_500x0-wm_3 -wmp_4-s_3345320161.png "title=" with PC2 gradually to fight to PC1. PNG "alt=" Wkiol1fucn2qjnglaacwcjrk56g922.png-wh_50 "/>
Partitioning and configuring routing of IP Addresses