diff --git a/README.md b/README.md index 1095af9..e483050 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,57 @@ # CN-Educoder -计算机网络 Educoder 课堂实验 PPPOE协议分析 tdun -VLAN 间单臂路由配置 - fourth +高级算机网络 Educoder 课堂实验 TDUN +对于大量重复的体力工作,做一次就行了,不如直接git clone +## 目录格式解释 -静态路由配置 - second +**实验** - repo 中答案所在文件夹,注意有的实验对应多个文件夹。 -网络协议分析 - myshixun +### 网络协议分析实验 -DHCP 服务器配置 - fifth +- **网络协议分析** - myshixun -# HOW to USE +### 网络组网和配置实验 + +- **GNS3 组建小型局域网** - first +- **静态路由配置** - second +- **动态路由 RIP 与 OSPF 配置** + - **动态路由 RIP 与 OSPF 配置 1-3 关** - third1-3 + - **动态路由 RIP 与 OSPF 配置 4 关** - third4 +- **VLAN 间单臂路由配置** - fourth +- **DHCP 服务器配置** - fifth + +### 代码类实验 + +- **WEB 服务器编程实现** - WEB 服务器编程实现 +- **UDP Ping 程序实现** - UDP Ping 程序实现 +- **基于 socket 的网络编程** - 基于 socket 的网络编程 + +## 使用说明 + +### 代码类和网络协议分析实验 + +对于代码类和网络协议分析实验,只需将代码或要求填写的文件内容手动复制到目标位置即可。 + +### 配置实验 + +实验环境可以访问互联网,只需按照以下步骤操作: + - 对于一般实验: + + 例如,GNS3 组建小型局域网实验测试目录在/data/workspace/myshixun/first下,则创建目录,然后把对应的文件全部拷贝到该目录下 + ```bash + git clone https://github.com/SurvivorNo1/CN-Educoder.git + mkdir -p /data/workspace/myshixun/first + cp CN-Educoder/first/* /data/workspace/myshixun/first/ + ``` + 点击测评,下一关即可完成实验 + - 特别的,动态路由 RIP 与 OSPF 配置实验,需要操作两次: + ```bash + git clone https://github.com/SurvivorNo1/CN-Educoder.git + mkdir -p /data/workspace/myshixun/third + cp CN-Educoder/third1-3/* /tmp/third/ + ``` + 点击3次测评,完成前3关,然后执行 + ```bash + cp CN-Educoder/third4/* /tmp/third/ + ``` +--- \ No newline at end of file diff --git a/UDP Ping程序实现/lab1.py b/UDP Ping程序实现/lab1.py new file mode 100644 index 0000000..5834e6d --- /dev/null +++ b/UDP Ping程序实现/lab1.py @@ -0,0 +1,10 @@ +# UDPPingerServer.py +from socket import * + +########## Begin ########## + +serverSocket = socket(AF_INET, SOCK_DGRAM) +serverSocket.bind(("0.0.0.0",12000)) +########## End ########## + +print( serverSocket) diff --git a/UDP Ping程序实现/lab2.py b/UDP Ping程序实现/lab2.py new file mode 100644 index 0000000..dc0f9b1 --- /dev/null +++ b/UDP Ping程序实现/lab2.py @@ -0,0 +1,16 @@ +from socket import * + +# 创建UDP套接字 +serverSocket = socket(AF_INET, SOCK_DGRAM) +# 绑定本机IP地址和端口号 +serverSocket.bind(('', 12000)) + +########## Begin ########## +# 接收客户端消息 +message, address = serverSocket.recvfrom(1024) +# 将数据包消息转换为大写 +message = message.upper() +#将消息传回给客户端 +serverSocket.sendto(message,address) +########## End ########## + \ No newline at end of file diff --git a/UDP Ping程序实现/lab3.py b/UDP Ping程序实现/lab3.py new file mode 100644 index 0000000..bf60042 --- /dev/null +++ b/UDP Ping程序实现/lab3.py @@ -0,0 +1,28 @@ +from socket import * +import random + +# 创建UDP套接字 +serverSocket = socket(AF_INET, SOCK_DGRAM) +# 绑定本机IP地址和端口号 +serverSocket.bind(('', 12000)) + +num=0 +while True: + + + # 接收客户端消息 + message, address = serverSocket.recvfrom(1024) + # 将数据包消息转换为大写 + message = message.upper() + + num=num+1 + if num>=8: + break + + ########## Begin ########## + if num % 3 == 1: + continue + ########## End ########## + + #将消息传回给客户端 + serverSocket.sendto(message, address) \ No newline at end of file diff --git a/UDP Ping程序实现/lab4.py b/UDP Ping程序实现/lab4.py new file mode 100644 index 0000000..29dda47 --- /dev/null +++ b/UDP Ping程序实现/lab4.py @@ -0,0 +1,11 @@ + +from socket import * + +########## Begin ########## +clientSocket = socket(AF_INET, SOCK_DGRAM) # 创建UDP套接字,使用IPv4协议 +# 设置套接字超时值1秒 +clientSocket.settimeout(1) +########## End ########## + +print(clientSocket) +print(clientSocket.gettimeout()) diff --git a/UDP Ping程序实现/lab5.py b/UDP Ping程序实现/lab5.py new file mode 100644 index 0000000..fe6490e --- /dev/null +++ b/UDP Ping程序实现/lab5.py @@ -0,0 +1,27 @@ +from socket import * +import time + +serverName = '127.0.0.1' # 服务器地址,本例中使用本机地址 +serverPort = 12000 # 服务器指定的端口 +clientSocket = socket(AF_INET, SOCK_DGRAM) # 创建UDP套接字,使用IPv4协议 +clientSocket.settimeout(1) # 设置套接字超时值1秒 + +for i in range(0, 9): + sendTime = time.time() + message = ('Ping %d %s' % (i+1, sendTime)).encode() # 生成数据报,编码为bytes以便发送 + + try: + + ########## Begin ########## + # 将信息发送到服务器 + clientSocket.sendto(message,(serverName,serverPort)) + # 从服务器接收信息,同时也能得到服务器地址 + modifiedMessage, serverAddress = clientSocket.recvfrom(1024) + ########## End ########## + + rtt = time.time() - sendTime # 计算往返时间 + print('Sequence %d: Reply from %s RTT = %.3fs' % (i+1, serverName, rtt)) # 显示信息 + except Exception as e: + print('Sequence %d: Request timed out.' % (i+1)) + +clientSocket.close() # 关闭套接字 \ No newline at end of file diff --git a/WEB服务器编程实现/lab1.py b/WEB服务器编程实现/lab1.py new file mode 100644 index 0000000..fa23abb --- /dev/null +++ b/WEB服务器编程实现/lab1.py @@ -0,0 +1,10 @@ +#import socket module +from socket import * +serverSocket = socket(AF_INET, SOCK_STREAM) +#Prepare a sever socket +########## Begin ########## +serverSocket.bind(('127.0.0.1',6789)) +serverSocket.listen(1) +########## End ########## +print(serverSocket) +serverSocket.close() \ No newline at end of file diff --git a/WEB服务器编程实现/lab2.py b/WEB服务器编程实现/lab2.py new file mode 100644 index 0000000..d6ede53 --- /dev/null +++ b/WEB服务器编程实现/lab2.py @@ -0,0 +1,23 @@ +#import socket module +from socket import * +serverSocket = socket(AF_INET, SOCK_STREAM) +#Prepare a sever socket +serverSocket.bind(("127.0.0.1",6789)) +serverSocket.listen(1) + +#while True: +#Establish the connection +print('开始WEB服务...') + +try: + ########## Begin ########## + connectionSocket, addr = serverSocket.accept() + message = connectionSocket.recv(1024) + ########## End ########## + print(addr[0]) + print(message) + connectionSocket.close() +except IOError: + + connectionSocket.close() +serverSocket.close() \ No newline at end of file diff --git a/WEB服务器编程实现/lab3.py b/WEB服务器编程实现/lab3.py new file mode 100644 index 0000000..68f1f4e --- /dev/null +++ b/WEB服务器编程实现/lab3.py @@ -0,0 +1,28 @@ +#import socket module +from socket import * + +serverSocket = socket(AF_INET, SOCK_STREAM) +#Prepare a sever socket +serverSocket.bind(("127.0.0.1",6789)) +serverSocket.listen(1) + +#while True: +print('开始WEB服务...') + +try: + connectionSocket, addr = serverSocket.accept() + message = connectionSocket.recv(1024) # 获取客户发送的报文 + #读取文件内容 + ######### Begin ######### + message = message.decode("utf-8") + line1 = message.split("\n")[0] + url = line1.split()[1] + fo = open(f".{url}","r+") + outputdata = fo.read() + ######### End ######### + print(outputdata) + connectionSocket.close() +except IOError: + + connectionSocket.close() +serverSocket.close() \ No newline at end of file diff --git a/WEB服务器编程实现/lab4.py b/WEB服务器编程实现/lab4.py new file mode 100644 index 0000000..b92f0fa --- /dev/null +++ b/WEB服务器编程实现/lab4.py @@ -0,0 +1,31 @@ +#import socket module +from socket import * + +serverSocket = socket(AF_INET, SOCK_STREAM) +#Prepare a sever socket +serverSocket.bind(("127.0.0.1",6789)) +serverSocket.listen(1) + +#while True: +print('开始WEB服务...') + +try: + connectionSocket, addr = serverSocket.accept() + message = connectionSocket.recv(1024) # 获取客户发送的报文 + + #读取文件内容 + filename = message.split()[1] + f = open(filename[1:]) + outputdata = f.read(); + + #发送响应的头部信息 + header = ' HTTP/1.1 200 OK\nConnection: close\nContent-Type: text/html\nContent-Length: %d\n\n' % (len(outputdata)) + #########Begin######### + connectionSocket.send(header.encode()) + #########End######### + + connectionSocket.close() +except IOError: + + connectionSocket.close() +serverSocket.close() \ No newline at end of file diff --git a/WEB服务器编程实现/lab5.py b/WEB服务器编程实现/lab5.py new file mode 100644 index 0000000..cccf1a7 --- /dev/null +++ b/WEB服务器编程实现/lab5.py @@ -0,0 +1,38 @@ +#import socket module +from socket import * + +serverSocket = socket(AF_INET, SOCK_STREAM) +#Prepare a sever socket +serverSocket.bind(("127.0.0.1",6789)) +serverSocket.listen(1) + +#while True: +print('开始WEB服务...') +try: + connectionSocket, addr = serverSocket.accept() + message = connectionSocket.recv(1024) # 获取客户发送的报文 + + #读取文件内容 + filename = message.split()[1] + f = open(filename[1:]) + outputdata = f.read(); + + #向套接字发送头部信息 + header = ' HTTP/1.1 200 OK\nConnection: close\nContent-Type: text/html\nContent-Length: %d\n\n' % (len(outputdata)) + connectionSocket.send(header.encode()) + + #发送文件内容 + #########Begin######### + for i in range(0, len(outputdata)): + connectionSocket.send(outputdata[i].encode()) + #########End######### + + #关闭连接 + connectionSocket.close() +except IOError: #异常处理 + #发送文件未找到的消息 + + #关闭连接 + connectionSocket.close() +#关闭套接字 +serverSocket.close() \ No newline at end of file diff --git a/WEB服务器编程实现/lab6.py b/WEB服务器编程实现/lab6.py new file mode 100644 index 0000000..00502ca --- /dev/null +++ b/WEB服务器编程实现/lab6.py @@ -0,0 +1,39 @@ + #import socket module +from socket import * + +serverSocket = socket(AF_INET, SOCK_STREAM) +#Prepare a sever socket +serverSocket.bind(("127.0.0.1",6789)) +serverSocket.listen(1) + +#while True: +print('开始WEB服务...') +try: + connectionSocket, addr = serverSocket.accept() + message = connectionSocket.recv(1024) # 获取客户发送的报文 + + #读取文件内容 + filename = message.split()[1] + f = open(filename[1:]) + outputdata = f.read(); + + #向套接字发送头部信息 + header = ' HTTP/1.1 200 OK\nConnection: close\nContent-Type: text/html\nContent-Length: %d\n\n' % (len(outputdata)) + connectionSocket.send(header.encode()) + + #S发送请求文件的内容 + for i in range(0, len(outputdata)): + connectionSocket.send(outputdata[i].encode()) + + #关闭连接 + connectionSocket.close() +except IOError: #异常处理 + #发送文件未找到的消息 + header = ' HTTP/1.1 404 not Found' + #########Begin######### + connectionSocket.send(header.encode()) + #########End######### + #关闭连接 + connectionSocket.close() +#关闭套接字 +serverSocket.close() \ No newline at end of file diff --git a/first/PC1_startup.vpc b/first/PC1_startup.vpc new file mode 100644 index 0000000..f52b308 --- /dev/null +++ b/first/PC1_startup.vpc @@ -0,0 +1,2 @@ +set pcname PC1 +ip 10.0.0.1 24 diff --git a/first/PC2_startup.vpc b/first/PC2_startup.vpc new file mode 100644 index 0000000..ab4f7e4 --- /dev/null +++ b/first/PC2_startup.vpc @@ -0,0 +1,2 @@ +set pcname PC2 +ip 10.0.0.2 24 diff --git a/first/first.gns3 b/first/first.gns3 new file mode 100644 index 0000000..69f9d8b --- /dev/null +++ b/first/first.gns3 @@ -0,0 +1,229 @@ +{ + "auto_close": true, + "auto_open": false, + "auto_start": false, + "drawing_grid_size": 25, + "grid_size": 75, + "name": "first", + "project_id": "8176d327-db07-43e8-b39e-f4925b4ce75d", + "revision": 9, + "scene_height": 1000, + "scene_width": 2000, + "show_grid": false, + "show_interface_labels": false, + "show_layers": false, + "snap_to_grid": false, + "supplier": null, + "topology": { + "computes": [], + "drawings": [], + "links": [ + { + "filters": {}, + "link_id": "f26c18d1-7687-41a1-9fb0-d35141283c02", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e0", + "x": 57, + "y": -1 + }, + "node_id": "2c5f6308-2ed8-43c4-ac52-82a68bfcba01", + "port_number": 0 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e1", + "x": 10, + "y": 47 + }, + "node_id": "766af5b8-8fb9-423d-80b0-5cd56a344f62", + "port_number": 1 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "5bf4e824-9702-4473-9af8-6de29e41612d", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e2", + "x": 60, + "y": 47 + }, + "node_id": "766af5b8-8fb9-423d-80b0-5cd56a344f62", + "port_number": 2 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e0", + "x": 7, + "y": -1 + }, + "node_id": "cc5c6a63-5c05-4edf-9ed9-bd85a4cb8933", + "port_number": 0 + } + ], + "suspend": false + } + ], + "nodes": [ + { + "compute_id": "local", + "console": 5000, + "console_auto_start": false, + "console_type": "none", + "custom_adapters": [], + "first_port_name": null, + "height": 32, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "Switch1", + "x": 9, + "y": -25 + }, + "locked": false, + "name": "Switch1", + "node_id": "766af5b8-8fb9-423d-80b0-5cd56a344f62", + "node_type": "ethernet_switch", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "ports_mapping": [ + { + "name": "Ethernet0", + "port_number": 0, + "type": "access", + "vlan": 1 + }, + { + "name": "Ethernet1", + "port_number": 1, + "type": "access", + "vlan": 1 + }, + { + "name": "Ethernet2", + "port_number": 2, + "type": "access", + "vlan": 1 + }, + { + "name": "Ethernet3", + "port_number": 3, + "type": "access", + "vlan": 1 + }, + { + "name": "Ethernet4", + "port_number": 4, + "type": "access", + "vlan": 1 + }, + { + "name": "Ethernet5", + "port_number": 5, + "type": "access", + "vlan": 1 + }, + { + "name": "Ethernet6", + "port_number": 6, + "type": "access", + "vlan": 1 + }, + { + "name": "Ethernet7", + "port_number": 7, + "type": "access", + "vlan": 1 + } + ] + }, + "symbol": ":/symbols/ethernet_switch.svg", + "template_id": "1966b864-93e7-32d5-965f-001384eec461", + "width": 72, + "x": -34, + "y": -54, + "z": 1 + }, + { + "compute_id": "local", + "console": 5001, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 59, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "PC1", + "x": 16, + "y": -25 + }, + "locked": false, + "name": "PC1", + "node_id": "2c5f6308-2ed8-43c4-ac52-82a68bfcba01", + "node_type": "vpcs", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": {}, + "symbol": ":/symbols/vpcs_guest.svg", + "template_id": "19021f99-e36f-394d-b4a1-8aaa902ab9cc", + "width": 65, + "x": -115, + "y": 38, + "z": 1 + }, + { + "compute_id": "local", + "console": 5003, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 59, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "PC2", + "x": 16, + "y": -25 + }, + "locked": false, + "name": "PC2", + "node_id": "cc5c6a63-5c05-4edf-9ed9-bd85a4cb8933", + "node_type": "vpcs", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": {}, + "symbol": ":/symbols/vpcs_guest.svg", + "template_id": "19021f99-e36f-394d-b4a1-8aaa902ab9cc", + "width": 65, + "x": 49, + "y": 32, + "z": 1 + } + ] + }, + "type": "topology", + "variables": null, + "version": "2.2.2", + "zoom": 100 +} \ No newline at end of file diff --git a/third1-3/PC1_startup.vpc b/third1-3/PC1_startup.vpc new file mode 100644 index 0000000..75ac3d2 --- /dev/null +++ b/third1-3/PC1_startup.vpc @@ -0,0 +1,2 @@ +set pcname PC1 +ip 10.0.0.1 10.0.0.254 24 diff --git a/third1-3/PC2_startup.vpc b/third1-3/PC2_startup.vpc new file mode 100644 index 0000000..057aeb3 --- /dev/null +++ b/third1-3/PC2_startup.vpc @@ -0,0 +1,2 @@ +set pcname PC2 +ip 20.0.0.1 20.0.0.254 24 diff --git a/third1-3/R1_configs_i1_startup-config.cfg b/third1-3/R1_configs_i1_startup-config.cfg new file mode 100644 index 0000000..758d6cd --- /dev/null +++ b/third1-3/R1_configs_i1_startup-config.cfg @@ -0,0 +1,95 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +! +! +ip cef +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +! +! +interface FastEthernet0/0 + ip address 10.0.0.254 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 12.12.12.1 255.255.255.0 + duplex auto + speed auto +! +! +router rip + version 2 + network 10.0.0.0 + network 12.0.0.0 + no auto-summary +! +no ip http server +no ip http secure-server +ip forward-protocol nd +! +! +! +no cdp log mismatch duplex +! +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third1-3/R2_configs_i2_startup-config.cfg b/third1-3/R2_configs_i2_startup-config.cfg new file mode 100644 index 0000000..975f7a9 --- /dev/null +++ b/third1-3/R2_configs_i2_startup-config.cfg @@ -0,0 +1,95 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R2 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +! +! +ip cef +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +! +! +interface FastEthernet0/0 + ip address 12.12.12.2 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 23.23.23.1 255.255.255.0 + duplex auto + speed auto +! +! +router rip + version 2 + network 12.0.0.0 + network 23.0.0.0 + no auto-summary +! +no ip http server +no ip http secure-server +ip forward-protocol nd +! +! +! +no cdp log mismatch duplex +! +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third1-3/R3_configs_i3_startup-config.cfg b/third1-3/R3_configs_i3_startup-config.cfg new file mode 100644 index 0000000..396ad19 --- /dev/null +++ b/third1-3/R3_configs_i3_startup-config.cfg @@ -0,0 +1,95 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R3 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +! +! +ip cef +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +! +! +interface FastEthernet0/0 + ip address 23.23.23.2 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 34.34.34.1 255.255.255.0 + duplex auto + speed auto +! +! +router rip + version 2 + network 23.0.0.0 + network 34.0.0.0 + no auto-summary +! +no ip http server +no ip http secure-server +ip forward-protocol nd +! +! +! +no cdp log mismatch duplex +! +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third1-3/R4_configs_i4_private-config.cfg b/third1-3/R4_configs_i4_private-config.cfg new file mode 100644 index 0000000..7f2d065 --- /dev/null +++ b/third1-3/R4_configs_i4_private-config.cfg @@ -0,0 +1,2 @@ + +end diff --git a/third1-3/R4_configs_i4_startup-config.cfg b/third1-3/R4_configs_i4_startup-config.cfg new file mode 100644 index 0000000..42e4dcd --- /dev/null +++ b/third1-3/R4_configs_i4_startup-config.cfg @@ -0,0 +1,91 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R4 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +interface FastEthernet0/0 + ip address 20.0.0.254 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 34.34.34.2 255.255.255.0 + duplex auto + speed auto +! +router rip + version 2 + network 20.0.0.0 + network 34.0.0.0 + no auto-summary +! +ip forward-protocol nd +! +! +no ip http server +no ip http secure-server +! +no cdp log mismatch duplex +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third1-3/third.gns3 b/third1-3/third.gns3 new file mode 100644 index 0000000..855c989 --- /dev/null +++ b/third1-3/third.gns3 @@ -0,0 +1,476 @@ +{ + "auto_close": true, + "auto_open": false, + "auto_start": false, + "drawing_grid_size": 25, + "grid_size": 75, + "name": "third", + "project_id": "58a2aa89-411c-44b7-bd17-f3bfbc52ed9d", + "revision": 9, + "scene_height": 1000, + "scene_width": 2000, + "show_grid": false, + "show_interface_labels": false, + "show_layers": false, + "snap_to_grid": false, + "supplier": null, + "topology": { + "computes": [], + "drawings": [], + "links": [ + { + "filters": {}, + "link_id": "6f95ad93-703c-47da-b8fe-85db7d46f7ed", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e0", + "x": 49, + "y": -6 + }, + "node_id": "ba89d981-516d-4108-be84-421bef69dfb2", + "port_number": 0 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": 15, + "y": 58 + }, + "node_id": "b94c595a-bf76-47d2-9b17-7435cd2ef2aa", + "port_number": 0 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "66bac7af-d504-489a-8b0a-26a6d6047ad4", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": 72, + "y": 20 + }, + "node_id": "b94c595a-bf76-47d2-9b17-7435cd2ef2aa", + "port_number": 1 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": -6, + "y": 23 + }, + "node_id": "17b60d61-a30f-4728-852e-a97bae80e106", + "port_number": 0 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "52ef017a-3655-408e-8543-7a650a6d8120", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": 72, + "y": 21 + }, + "node_id": "17b60d61-a30f-4728-852e-a97bae80e106", + "port_number": 1 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": -6, + "y": 22 + }, + "node_id": "66db5e40-caf8-40df-9de4-d83750eaa92c", + "port_number": 0 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "9b9e66c6-b187-49fd-8004-fc6ccd4f1016", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": 72, + "y": 22 + }, + "node_id": "66db5e40-caf8-40df-9de4-d83750eaa92c", + "port_number": 1 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": -6, + "y": 21 + }, + "node_id": "84b9a7a1-434f-44c5-8929-f6a55efeffbc", + "port_number": 1 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "a515333c-63f9-462b-b3bb-92b1ccdb6434", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": 49, + "y": 58 + }, + "node_id": "84b9a7a1-434f-44c5-8929-f6a55efeffbc", + "port_number": 0 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e0", + "x": 15, + "y": -6 + }, + "node_id": "2a7191fd-033c-4317-8ff0-6bc750ada48b", + "port_number": 0 + } + ], + "suspend": false + } + ], + "nodes": [ + { + "compute_id": "local", + "console": 5002, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R1", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R1", + "node_id": "b94c595a-bf76-47d2-9b17-7435cd2ef2aa", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "chassis": "3660", + "clock_divisor": 4, + "disk0": 0, + "disk1": 0, + "dynamips_id": 1, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x606436b8", + "idlesleep": 30, + "image": "c3660-telcoentk9-mz.124-25d.image", + "image_md5sum": "13b42ff8c0138d790ed3800e65d14cd2", + "iomem": 5, + "mac_addr": "cc01.0207.0000", + "mmap": true, + "nvram": 512, + "platform": "c3600", + "ram": 192, + "slot0": "Leopard-2FE", + "slot1": null, + "slot2": null, + "slot3": null, + "slot4": null, + "slot5": null, + "slot6": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "" + }, + "symbol": ":/symbols/router.svg", + "template_id": "e8a981b9-85e2-47e8-b41f-c1a7f81f9baa", + "width": 66, + "x": -244, + "y": -66, + "z": 1 + }, + { + "compute_id": "local", + "console": 5003, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R2", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R2", + "node_id": "17b60d61-a30f-4728-852e-a97bae80e106", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "chassis": "3660", + "clock_divisor": 4, + "disk0": 0, + "disk1": 0, + "dynamips_id": 2, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x606436b8", + "idlesleep": 30, + "image": "c3660-telcoentk9-mz.124-25d.image", + "image_md5sum": "13b42ff8c0138d790ed3800e65d14cd2", + "iomem": 5, + "mac_addr": "cc02.0216.0000", + "mmap": true, + "nvram": 512, + "platform": "c3600", + "ram": 192, + "slot0": "Leopard-2FE", + "slot1": null, + "slot2": null, + "slot3": null, + "slot4": null, + "slot5": null, + "slot6": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "" + }, + "symbol": ":/symbols/router.svg", + "template_id": "e8a981b9-85e2-47e8-b41f-c1a7f81f9baa", + "width": 66, + "x": -115, + "y": -72, + "z": 1 + }, + { + "compute_id": "local", + "console": 5004, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R3", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R3", + "node_id": "66db5e40-caf8-40df-9de4-d83750eaa92c", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "chassis": "3660", + "clock_divisor": 4, + "disk0": 0, + "disk1": 0, + "dynamips_id": 3, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x606436b8", + "idlesleep": 30, + "image": "c3660-telcoentk9-mz.124-25d.image", + "image_md5sum": "13b42ff8c0138d790ed3800e65d14cd2", + "iomem": 5, + "mac_addr": "cc03.0225.0000", + "mmap": true, + "nvram": 512, + "platform": "c3600", + "ram": 192, + "slot0": "Leopard-2FE", + "slot1": null, + "slot2": null, + "slot3": null, + "slot4": null, + "slot5": null, + "slot6": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "" + }, + "symbol": ":/symbols/router.svg", + "template_id": "e8a981b9-85e2-47e8-b41f-c1a7f81f9baa", + "width": 66, + "x": 24, + "y": -74, + "z": 1 + }, + { + "compute_id": "local", + "console": 5005, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R4", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R4", + "node_id": "84b9a7a1-434f-44c5-8929-f6a55efeffbc", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "clock_divisor": 8, + "disk0": 5, + "disk1": 5, + "dynamips_id": 4, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x6023a728", + "idlesleep": 30, + "image": "c3725-spservicesk9-mz.124-25d.image", + "image_md5sum": "2ffd9219270a24743e6bb32f5e700022", + "iomem": 5, + "mac_addr": "c204.0234.0000", + "mmap": true, + "nvram": 2048, + "platform": "c3725", + "ram": 128, + "slot0": "GT96100-FE", + "slot1": null, + "slot2": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "", + "wic0": null, + "wic1": null, + "wic2": null + }, + "symbol": ":/symbols/router.svg", + "template_id": "9c019983-907a-488e-91a9-4aa02552bc8f", + "width": 66, + "x": 136, + "y": -71, + "z": 1 + }, + { + "compute_id": "local", + "console": 5000, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 59, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "PC1", + "x": 16, + "y": -25 + }, + "locked": false, + "name": "PC1", + "node_id": "ba89d981-516d-4108-be84-421bef69dfb2", + "node_type": "vpcs", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": {}, + "symbol": ":/symbols/vpcs_guest.svg", + "template_id": "19021f99-e36f-394d-b4a1-8aaa902ab9cc", + "width": 65, + "x": -295, + "y": 35, + "z": 1 + }, + { + "compute_id": "local", + "console": 5006, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 59, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "PC2", + "x": 16, + "y": -25 + }, + "locked": false, + "name": "PC2", + "node_id": "2a7191fd-033c-4317-8ff0-6bc750ada48b", + "node_type": "vpcs", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": {}, + "symbol": ":/symbols/vpcs_guest.svg", + "template_id": "19021f99-e36f-394d-b4a1-8aaa902ab9cc", + "width": 65, + "x": 194, + "y": 43, + "z": 1 + } + ] + }, + "type": "topology", + "variables": null, + "version": "2.2.2", + "zoom": 100 +} \ No newline at end of file diff --git a/third4/PC1_startup.vpc b/third4/PC1_startup.vpc new file mode 100644 index 0000000..75ac3d2 --- /dev/null +++ b/third4/PC1_startup.vpc @@ -0,0 +1,2 @@ +set pcname PC1 +ip 10.0.0.1 10.0.0.254 24 diff --git a/third4/PC2_startup.vpc b/third4/PC2_startup.vpc new file mode 100644 index 0000000..057aeb3 --- /dev/null +++ b/third4/PC2_startup.vpc @@ -0,0 +1,2 @@ +set pcname PC2 +ip 20.0.0.1 20.0.0.254 24 diff --git a/third4/R1_configs_i1_startup-config.cfg b/third4/R1_configs_i1_startup-config.cfg new file mode 100644 index 0000000..058f10f --- /dev/null +++ b/third4/R1_configs_i1_startup-config.cfg @@ -0,0 +1,94 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +! +! +ip cef +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +! +! +interface FastEthernet0/0 + ip address 10.0.0.254 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 12.12.12.1 255.255.255.0 + duplex auto + speed auto +! +! +router ospf 1 + log-adjacency-changes + network 10.0.0.0 0.0.0.255 area 1 + network 12.12.12.0 0.0.0.255 area 1 +! +no ip http server +no ip http secure-server +ip forward-protocol nd +! +! +! +no cdp log mismatch duplex +! +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third4/R2_configs_i2_startup-config.cfg b/third4/R2_configs_i2_startup-config.cfg new file mode 100644 index 0000000..fe42094 --- /dev/null +++ b/third4/R2_configs_i2_startup-config.cfg @@ -0,0 +1,94 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R2 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +! +! +ip cef +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +! +! +interface FastEthernet0/0 + ip address 12.12.12.2 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 23.23.23.1 255.255.255.0 + duplex auto + speed auto +! +! +router ospf 1 + log-adjacency-changes + network 12.12.12.0 0.0.0.255 area 1 + network 23.23.23.0 0.0.0.255 area 0 +! +no ip http server +no ip http secure-server +ip forward-protocol nd +! +! +! +no cdp log mismatch duplex +! +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third4/R3_configs_i3_startup-config.cfg b/third4/R3_configs_i3_startup-config.cfg new file mode 100644 index 0000000..2b0956b --- /dev/null +++ b/third4/R3_configs_i3_startup-config.cfg @@ -0,0 +1,94 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R3 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +! +! +ip cef +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +! +! +interface FastEthernet0/0 + ip address 23.23.23.2 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 34.34.34.1 255.255.255.0 + duplex auto + speed auto +! +! +router ospf 1 + log-adjacency-changes + network 23.23.23.0 0.0.0.255 area 0 + network 34.34.34.0 0.0.0.255 area 2 +! +no ip http server +no ip http secure-server +ip forward-protocol nd +! +! +! +no cdp log mismatch duplex +! +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third4/R4_configs_i4_private-config.cfg b/third4/R4_configs_i4_private-config.cfg new file mode 100644 index 0000000..7f2d065 --- /dev/null +++ b/third4/R4_configs_i4_private-config.cfg @@ -0,0 +1,2 @@ + +end diff --git a/third4/R4_configs_i4_startup-config.cfg b/third4/R4_configs_i4_startup-config.cfg new file mode 100644 index 0000000..18c131f --- /dev/null +++ b/third4/R4_configs_i4_startup-config.cfg @@ -0,0 +1,90 @@ +! + +! +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R4 +! +boot-start-marker +boot-end-marker +! +! +no aaa new-model +memory-size iomem 5 +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +ip tcp synwait-time 5 +! +! +! +interface FastEthernet0/0 + ip address 20.0.0.254 255.255.255.0 + duplex auto + speed auto +! +interface FastEthernet0/1 + ip address 34.34.34.2 255.255.255.0 + duplex auto + speed auto +! +router ospf 1 + log-adjacency-changes + network 20.0.0.0 0.0.0.255 area 2 + network 34.34.34.0 0.0.0.255 area 2 +! +ip forward-protocol nd +! +! +no ip http server +no ip http secure-server +! +no cdp log mismatch duplex +! +! +control-plane +! +! +! +! +! +! +! +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous +line vty 0 4 + login +! +! +end diff --git a/third4/third.gns3 b/third4/third.gns3 new file mode 100644 index 0000000..855c989 --- /dev/null +++ b/third4/third.gns3 @@ -0,0 +1,476 @@ +{ + "auto_close": true, + "auto_open": false, + "auto_start": false, + "drawing_grid_size": 25, + "grid_size": 75, + "name": "third", + "project_id": "58a2aa89-411c-44b7-bd17-f3bfbc52ed9d", + "revision": 9, + "scene_height": 1000, + "scene_width": 2000, + "show_grid": false, + "show_interface_labels": false, + "show_layers": false, + "snap_to_grid": false, + "supplier": null, + "topology": { + "computes": [], + "drawings": [], + "links": [ + { + "filters": {}, + "link_id": "6f95ad93-703c-47da-b8fe-85db7d46f7ed", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e0", + "x": 49, + "y": -6 + }, + "node_id": "ba89d981-516d-4108-be84-421bef69dfb2", + "port_number": 0 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": 15, + "y": 58 + }, + "node_id": "b94c595a-bf76-47d2-9b17-7435cd2ef2aa", + "port_number": 0 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "66bac7af-d504-489a-8b0a-26a6d6047ad4", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": 72, + "y": 20 + }, + "node_id": "b94c595a-bf76-47d2-9b17-7435cd2ef2aa", + "port_number": 1 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": -6, + "y": 23 + }, + "node_id": "17b60d61-a30f-4728-852e-a97bae80e106", + "port_number": 0 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "52ef017a-3655-408e-8543-7a650a6d8120", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": 72, + "y": 21 + }, + "node_id": "17b60d61-a30f-4728-852e-a97bae80e106", + "port_number": 1 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": -6, + "y": 22 + }, + "node_id": "66db5e40-caf8-40df-9de4-d83750eaa92c", + "port_number": 0 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "9b9e66c6-b187-49fd-8004-fc6ccd4f1016", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": 72, + "y": 22 + }, + "node_id": "66db5e40-caf8-40df-9de4-d83750eaa92c", + "port_number": 1 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/1", + "x": -6, + "y": 21 + }, + "node_id": "84b9a7a1-434f-44c5-8929-f6a55efeffbc", + "port_number": 1 + } + ], + "suspend": false + }, + { + "filters": {}, + "link_id": "a515333c-63f9-462b-b3bb-92b1ccdb6434", + "nodes": [ + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "f0/0", + "x": 49, + "y": 58 + }, + "node_id": "84b9a7a1-434f-44c5-8929-f6a55efeffbc", + "port_number": 0 + }, + { + "adapter_number": 0, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "e0", + "x": 15, + "y": -6 + }, + "node_id": "2a7191fd-033c-4317-8ff0-6bc750ada48b", + "port_number": 0 + } + ], + "suspend": false + } + ], + "nodes": [ + { + "compute_id": "local", + "console": 5002, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R1", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R1", + "node_id": "b94c595a-bf76-47d2-9b17-7435cd2ef2aa", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "chassis": "3660", + "clock_divisor": 4, + "disk0": 0, + "disk1": 0, + "dynamips_id": 1, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x606436b8", + "idlesleep": 30, + "image": "c3660-telcoentk9-mz.124-25d.image", + "image_md5sum": "13b42ff8c0138d790ed3800e65d14cd2", + "iomem": 5, + "mac_addr": "cc01.0207.0000", + "mmap": true, + "nvram": 512, + "platform": "c3600", + "ram": 192, + "slot0": "Leopard-2FE", + "slot1": null, + "slot2": null, + "slot3": null, + "slot4": null, + "slot5": null, + "slot6": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "" + }, + "symbol": ":/symbols/router.svg", + "template_id": "e8a981b9-85e2-47e8-b41f-c1a7f81f9baa", + "width": 66, + "x": -244, + "y": -66, + "z": 1 + }, + { + "compute_id": "local", + "console": 5003, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R2", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R2", + "node_id": "17b60d61-a30f-4728-852e-a97bae80e106", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "chassis": "3660", + "clock_divisor": 4, + "disk0": 0, + "disk1": 0, + "dynamips_id": 2, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x606436b8", + "idlesleep": 30, + "image": "c3660-telcoentk9-mz.124-25d.image", + "image_md5sum": "13b42ff8c0138d790ed3800e65d14cd2", + "iomem": 5, + "mac_addr": "cc02.0216.0000", + "mmap": true, + "nvram": 512, + "platform": "c3600", + "ram": 192, + "slot0": "Leopard-2FE", + "slot1": null, + "slot2": null, + "slot3": null, + "slot4": null, + "slot5": null, + "slot6": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "" + }, + "symbol": ":/symbols/router.svg", + "template_id": "e8a981b9-85e2-47e8-b41f-c1a7f81f9baa", + "width": 66, + "x": -115, + "y": -72, + "z": 1 + }, + { + "compute_id": "local", + "console": 5004, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R3", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R3", + "node_id": "66db5e40-caf8-40df-9de4-d83750eaa92c", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "chassis": "3660", + "clock_divisor": 4, + "disk0": 0, + "disk1": 0, + "dynamips_id": 3, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x606436b8", + "idlesleep": 30, + "image": "c3660-telcoentk9-mz.124-25d.image", + "image_md5sum": "13b42ff8c0138d790ed3800e65d14cd2", + "iomem": 5, + "mac_addr": "cc03.0225.0000", + "mmap": true, + "nvram": 512, + "platform": "c3600", + "ram": 192, + "slot0": "Leopard-2FE", + "slot1": null, + "slot2": null, + "slot3": null, + "slot4": null, + "slot5": null, + "slot6": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "" + }, + "symbol": ":/symbols/router.svg", + "template_id": "e8a981b9-85e2-47e8-b41f-c1a7f81f9baa", + "width": 66, + "x": 24, + "y": -74, + "z": 1 + }, + { + "compute_id": "local", + "console": 5005, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 45, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "R4", + "x": 21, + "y": -25 + }, + "locked": false, + "name": "R4", + "node_id": "84b9a7a1-434f-44c5-8929-f6a55efeffbc", + "node_type": "dynamips", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": { + "auto_delete_disks": true, + "aux": null, + "clock_divisor": 8, + "disk0": 5, + "disk1": 5, + "dynamips_id": 4, + "exec_area": 64, + "idlemax": 500, + "idlepc": "0x6023a728", + "idlesleep": 30, + "image": "c3725-spservicesk9-mz.124-25d.image", + "image_md5sum": "2ffd9219270a24743e6bb32f5e700022", + "iomem": 5, + "mac_addr": "c204.0234.0000", + "mmap": true, + "nvram": 2048, + "platform": "c3725", + "ram": 128, + "slot0": "GT96100-FE", + "slot1": null, + "slot2": null, + "sparsemem": true, + "system_id": "FTX0945W0MY", + "usage": "", + "wic0": null, + "wic1": null, + "wic2": null + }, + "symbol": ":/symbols/router.svg", + "template_id": "9c019983-907a-488e-91a9-4aa02552bc8f", + "width": 66, + "x": 136, + "y": -71, + "z": 1 + }, + { + "compute_id": "local", + "console": 5000, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 59, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "PC1", + "x": 16, + "y": -25 + }, + "locked": false, + "name": "PC1", + "node_id": "ba89d981-516d-4108-be84-421bef69dfb2", + "node_type": "vpcs", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": {}, + "symbol": ":/symbols/vpcs_guest.svg", + "template_id": "19021f99-e36f-394d-b4a1-8aaa902ab9cc", + "width": 65, + "x": -295, + "y": 35, + "z": 1 + }, + { + "compute_id": "local", + "console": 5006, + "console_auto_start": false, + "console_type": "telnet", + "custom_adapters": [], + "first_port_name": null, + "height": 59, + "label": { + "rotation": 0, + "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", + "text": "PC2", + "x": 16, + "y": -25 + }, + "locked": false, + "name": "PC2", + "node_id": "2a7191fd-033c-4317-8ff0-6bc750ada48b", + "node_type": "vpcs", + "port_name_format": "Ethernet{0}", + "port_segment_size": 0, + "properties": {}, + "symbol": ":/symbols/vpcs_guest.svg", + "template_id": "19021f99-e36f-394d-b4a1-8aaa902ab9cc", + "width": 65, + "x": 194, + "y": 43, + "z": 1 + } + ] + }, + "type": "topology", + "variables": null, + "version": "2.2.2", + "zoom": 100 +} \ No newline at end of file diff --git a/基于 socket 的网络编程/lab1-client.py b/基于 socket 的网络编程/lab1-client.py new file mode 100644 index 0000000..94b2bec --- /dev/null +++ b/基于 socket 的网络编程/lab1-client.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# @Time : 2022/8/1 10:19 +# @Author : 陈玉辉 +# @File : service.py +import socket + +# 定义要连接的服务器信息 +HOST = "127.0.0.1" # 在右侧补充代码, 本地主机,指这台计算机,对应的 IP 地址为 127.0.0.1 +PORT = 5000 # 端口 0~1024 为系统保留 +ADDRESS = (HOST, PORT) +BUFFER = 1024 # 数据发送和接收的最大缓冲区大小 #创建客户端套接字对象 +client = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # 在括号内补充代码, 相当于声明 socket 类 型,同时生成 socket 链接对象,面向网络的套接字: 通过网络进行数据交互, TCP #连接服务器 +client.connect(ADDRESS) +infos = ["hello service", "I'm client", "exit"] +for info in infos: + #在下方补充代码,发送信息 + client.send(info.encode()) + # 在下方补充代码, 接收服务端信息 print("等待服务端发送信息: ") + data = client.recv(BUFFER) + if data: + print("收到服务端返回的数据:{}".format(data.decode("utf-8"))) +client.close() diff --git a/基于 socket 的网络编程/lab1-service.py b/基于 socket 的网络编程/lab1-service.py new file mode 100644 index 0000000..f09d882 --- /dev/null +++ b/基于 socket 的网络编程/lab1-service.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# @Time : 2022/8/1 10:19 +# @Author : 陈玉辉 +# @File : service.py +import socket + +HOST = "127.0.0.1" # 在右侧补充代码, 本地主机,指这台计算机,对应的 IP 地址为 127.0.0.1 +PORT = 5000 # 端口 0~1024 为系统保留 +ADDRESS = (HOST, PORT) +BUFFER = 1024 # 数据发送和接收的最大数据大小 + +print("初始化服务器主机套接字对象.....") +server = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # 在括号内补充代码, 面向网络的套接字: 通过 网络进行数据交互, TCP 协议,server 就是 socket 的实例 +print("绑定主机信息....") + +server.bind(ADDRESS) # 元组,相当于一个参数 +server.listen(10) + +print("wait client") +conn, addr = server.accept() +while True: + # 在下方补充代码,获取消息 + recvmsg = conn.recv(BUFFER) + data = recvmsg.decode("utf-8") + print("收到来自客户端的消息: ", data) + if data == "exit": + break + # 在下方补充代码,发送消息 + conn.send(data.encode()) + +server.close() diff --git a/基于 socket 的网络编程/lab2-client.py b/基于 socket 的网络编程/lab2-client.py new file mode 100644 index 0000000..0789d9e --- /dev/null +++ b/基于 socket 的网络编程/lab2-client.py @@ -0,0 +1,20 @@ +import socket + +# 定义要连接的服务器信息 +HOST = "127.0.0.1" # 在右侧补充代码,获取本地主机,指这台计算机,对应的 IP 地址为 127.0.0.1 +PORT = 5001 # 端口 0~1024 为系统保留 +ADDRESS = (HOST, PORT) +BUFFER = 1024 # 数据发送和接收的最大缓冲区大小 +# 创建客户端套接字对象 +client = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) # 在括号内补充代码,相当于声明 socket 类型,同时生成 socket 链接对象,面向网络的套接字: 通过网络进行数据交互, UDP +client.settimeout(2) +msgs = ["hello services", "I'm client", "exit"] +for msg in msgs: + # 在下方补充代码, 给服务器发送消息 + msg = msg.encode() + client.sendto(msg,(HOST,PORT)) + # 在下方补充代码, 接收服务端信息 + recvmsg, addr = client.recvfrom(BUFFER) + data = recvmsg.decode("utf-8") + print('收到服务端的发来的消息: ', data) +client.close() diff --git a/基于 socket 的网络编程/lab2-service.py b/基于 socket 的网络编程/lab2-service.py new file mode 100644 index 0000000..1fe6f8f --- /dev/null +++ b/基于 socket 的网络编程/lab2-service.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +import socket + +# 定义服务器信息 +print('初始化服务器主机信息') +HOST = "127.0.0.1" # 在右侧补充代码,获取本地主机,指这台计算机,对应的 IP 地址为 127.0.0.1 +PORT = 5001 # 端口 0~1024 为系统保留 +ADDRESS = (HOST, PORT) +BUFFER = 1024 # 数据发送和接收的最大缓冲区大小 +# 创建 UDP 服务 socket 对象 +print("初始化服务器主机套接字对象......") +server = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) # 在括号内补充代码, 面向网络的套接字: 通过网络进行数据交互, UDP 协议,server 就是 socket 的实例 +# 在下方补充代码 绑定主机信息 +server.bind(ADDRESS) +print('绑定的主机信息......') +# 等待连接 +print('等待客户端连接') +while True: + recvmsg, addr = server.recvfrom(BUFFER) # 在右侧补充代码,获取返回信息 + data = recvmsg.decode("utf-8") + print("收到来自客户端的消息: ", data) + server.sendto(recvmsg,addr) # 在右侧补充代码,发送信息 + if data == "exit": + break +server.close() \ No newline at end of file