一:使用Wireshark抓TCP的三次握手和四次断开
163(www.163.com)ip地址为219.145.171.124
三次握手:
第一次:
第二次:
第三次:
四次断开:
第一次:
第二次:
第三次:
二:使用Wireshark抓DHCP四次握手
第一次:
第二次:
第三次:
第四次:
三:使用Wireshark抓ARP请求和响应
ARP请求:
ARP响应:
四:实验
第一步:配置路由器R1接口,DHCP信息。
Continue with configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>
Router>en
Router#
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#hostname R1
R1(config)#
R1(config)#int f0/0
R1(config-if)#
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
R1(config-if)#
R1(config-if)#ex
R1(config)#
R1(config)#int f0/1
R1(config-if)#
R1(config-if)#ip address 172.16.1.254 255.255.255.0
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#
R1(config-if)#ex
R1(config)#
R1(config)#ip dhcp pool 172.16.1.0
R1(dhcp-config)#network 172.16.1.0 255.255.255.0
R1(dhcp-config)#def
R1(dhcp-config)#default-router 172.16.1.254
R1(dhcp-config)#dns
R1(dhcp-config)#dns-server 8.8.8.8
R1(dhcp-config)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#
第二步:配置路由器R2接口,DHCP信息。
Continue with configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#int f0/0
R2(config-if)#ip address 10.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
ex
R2(config)#int f0/1
R2(config-if)#ip address 20.1.1.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
R2(config-if)#ex
R2(config)#int f1/0
R2(config-if)#ip address 172.16.2.254 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R2(config-if)#ex
R2(config)#
R2(config)#ip dhcp pool 172.16.2.0
R2(dhcp-config)#network 172.16.2.0 255.255.255.0
R2(dhcp-config)#de
R2(dhcp-config)#default-router 172.16.2.254
R2(dhcp-config)#dns
R2(dhcp-config)#dns-server 8.8.8.8
R2(dhcp-config)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#
第三步:配置路由器R3接口,网段汇总。
Continue with configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3
R3(config)#int f0/0
R3(config-if)#ip address 20.1.1.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#ex
R3(config)#
R3(config)#
R3(config)#int f0/1
R3(config-if)#ip address 192.168.1.254 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config-if)#ex
R3(config)#
R3(config)#int f1/0
R3(config-if)#ip address 192.168.2.254 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R3(config-if)#end
R3#
%SYS-5-CONFIG_I: Configured from console by console
R3#
第四步:配置路由器R2静态路由。
R2>
R2>en
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#
R2(config)#ip route 172.16.1.0 255.255.255.0 10.1.1.1
R2(config)#ip route 192.168.0.0 255.255.252.0 20.1.1.2 (网段汇总)
R2(config)#ex
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#
第五步:配置路由器R1静态路由。
R1>
R1>en
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 172.16.2.0 255.255.255.0 10.1.1.2
R1(config)#ip route 192.168.0.0 255.255.252.0 10.1.1.2 (网段汇总)
R1(config)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#
第六步:配置路由器R3静态路由。
R3>
R3>en
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip route 172.16.2.0 255.255.255.0 20.1.1.1
R3(config)#ip route 172.16.1.0 255.255.255.0 20.1.1.1
R3(config)#end
R3#
%SYS-5-CONFIG_I: Configured from console by console
R3#
PC5 ping PC0(172.16.1.1),通。
PC5 ping PC2(172.16.2.1),通。
第七步:配置路由器R1、R2多路径负载均衡。
配置R1 f1/0口ip地址:
R1>
R1>en
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f1/0
R1(config-if)#ip address 30.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
配置R2 f1/1口ip地址:
R2>
R2>en
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int f1/1
R2(config-if)#ip address 30.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
配置R1 f1/0口路由表:
R1>
R1>en
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 172.16.2.0 255.255.255.0 30.1.1.2
R1(config)#ip route 192.168.0.0 255.255.252.0 30.1.1.2
R1(config)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
配置R2 f1/1口路由表:
R2>
R2>en
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 172.16.1.0 255.255.255.0 30.1.1.1
R2(config)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
路由器R1路由表:
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, FastEthernet1/0
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, FastEthernet0/1
S 172.16.2.0 [1/0] via 10.1.1.2
[1/0] via 30.1.1.2
S 192.168.0.0/22 [1/0] via 10.1.1.2
[1/0] via 30.1.1.2
R1#
路由器R2路由表:
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
20.0.0.0/24 is subnetted, 1 subnets
C 20.1.1.0 is directly connected, FastEthernet0/1
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, FastEthernet1/1
172.16.0.0/24 is subnetted, 2 subnets
S 172.16.1.0 [1/0] via 10.1.1.1
[1/0] via 30.1.1.1
C 172.16.2.0 is directly connected, FastEthernet1/0
S 192.168.0.0/22 [1/0] via 20.1.1.2
R2#
路由器R3路由表:
Gateway of last resort is not set
20.0.0.0/24 is subnetted, 1 subnets
C 20.1.1.0 is directly connected, FastEthernet0/0
172.16.0.0/24 is subnetted, 2 subnets
S 172.16.1.0 [1/0] via 20.1.1.1
S 172.16.2.0 [1/0] via 20.1.1.1
C 192.168.1.0/24 is directly connected, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet1/0
R3#
断开路由器R2 f0/0口,PC5 ping PC0,通。
断开路由器R2 f0/0口,PC5 ping PC2,通。
第八步:配置路由器R1 f1/1接口。
R1#
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f1/1
R1(config-if)#ip address 100.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up
R1(config-if)#
第九步:配置缺省路由。
R1:
R1#
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 0.0.0.0 0.0.0.0 100.1.1.100
R1(config)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
R2:
R2>
R2>en
R2#
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1
R2(config)#ip route 0.0.0.0 0.0.0.0 30.1.1.1
R2(config)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
R3:
R3>
R3>en
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip route 0.0.0.0 0.0.0.0 20.1.1.1
R3(config)#end
R3#
%SYS-5-CONFIG_I: Configured from console by console
第10步:空接口路由
PC5 Tracert 192.168.0.1会一直转发,出现环路。
R3>en
R3#
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip route 192.168.0.0 255.255.252.0 null 0
R3(config)#end
R3#
%SYS-5-CONFIG_I: Configured from console by console
R3#
PC5 ping 192.168.0.0 不会转发给缺省路由了。
实验完成。