-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaula13---Quick Start-1-GNS3-Lab-Setup-and-IDEs.txt
290 lines (211 loc) · 10.3 KB
/
aula13---Quick Start-1-GNS3-Lab-Setup-and-IDEs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
####
Python Network Programming for Network Engineers (Python 3)
########
aula 13
13. Quick Start 1: GNS3 Lab Setup and IDEs
#############################################################################
#############################################################################
########### TOPOLOGIA
Python3 course - initial topology
-Configurar a NetworkAutomation vm
cat /etc/network/interfaces
-Teria que descomentar as 2 ultimas linhas, no meu caso já estavam descomentadas:
root@NetworkAutomation-1:~# cat /etc/network/interfaces
#
# This is a sample network config uncomment lines to configure the network
#
# Static config for eth0
#auto eth0
#iface eth0 inet static
# address 192.168.0.2
# netmask 255.255.255.0
# gateway 192.168.0.1
# up echo nameserver 192.168.0.1 > /etc/resolv.conf
# DHCP config for eth0
auto eth0
iface eth0 inet dhcp
root@NetworkAutomation-1:~#
-Pegando ip:
root@NetworkAutomation-1:~# ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.122.120 netmask 255.255.255.0 broadcast 192.168.122.255
ether b2:b3:bd:8b:19:a2 txqueuelen 1000 (Ethernet)
RX packets 285 bytes 21771 (21.7 KB)
RX errors 0 dropped 12 overruns 0 frame 0
TX packets 8 bytes 1932 (1.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
-Roteador r1:
192.168.122.71
-Configurar usuários no roteador r1, para obter acesso via Telnet:
conf t
username fernando password nemsei90
username datacenter password nemsei90
enable secret nemsei90
line vty 0 4
login local
transport input all
end
wr
-To delete all lines in vim, use this command:
:1,$d
-Verificar conexões ao roteador usando o debug:
debug telnet
R1#debug telnet
Incoming Telnet debugging is on
R1#
-Usar o comando "show line" para ver conexões estabelecidas no momento:
R1#
R1#show line
Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int
* 0 CTY - - - - - 0 0 0/0 -
1 AUX 9600/9600 - - - - - 0 0 0/0 -
578 VTY - - - - - 4 0 0/0 -
579 VTY - - - - - 0 0 0/0 -
580 VTY - - - - - 0 0 0/0 -
581 VTY - - - - - 0 0 0/0 -
582 VTY - - - - - 0 0 0/0 -
Line(s) not in async mode -or- with no hardware support:
2-577
R1#
##################################################################################
##################################################################################
##################################################################################
##################################################################################
##################################################################################
-Executar o script em Python apartir do servidor de automação/container:
python3 python31.py
-Conexão via Telnet ocorrendo:
*Mar 24 23:32:56.097: Telnet578: 1 1 251 1
*Mar 24 23:32:56.097: TCP578: Telnet sent WILL ECHO (1)
*Mar 24 23:32:56.098: Telnet578: 2 2 251 3
*Mar 24 23:32:56.098: TCP578: Telnet sent WILL SUPPRESS-GA (3)
*Mar 24 23:32:56.098: Telnet578: 80000 80000 253 24
*Mar 24 23:32:56.099: TCP578: Telnet sent DO TTY-TYPE (24)
*Mar 24 23:32:56.099: Telnet578: 10000000 10000000 253 31
*Mar 24 23:32:56.100: TCP578: Telnet sent DO WINDOW-SIZE (31)
*Mar 24 23:32:56.118: TCP578: Telnet received DONT ECHO (1)
*Mar 24 23:32:56.119: TCP578: Telnet sent WONT ECHO (1)
*Mar 24 23:32:56.129: TCP578: Telnet received DONT SUPPRESS-GA (3)
*Mar 24 23:32:56.130: TCP578: Telnet sent WONT SUPPRESS-GA (3)
*Mar 24 23:32:56.131: TCP578: Telnet received WONT TTY-TYPE (24)
*Mar 24 23:32:56.132: TCP578: Telnet sent DONT TTY-TYPE (24)
*Mar 24 23:32:56.134: TCP578: Telnet received WONT WINDOW-SIZE (31)
*Mar 24 23:32:56.134: TCP578: Telnet sent DONT WINDOW-SIZE (31)
*Mar 24 23:32:56.162: TCP578: Telnet received DONT ECHO (1)
*Mar 24 23:32:56.162: TCP578: Telnet received DONT SUPPRESS-GA (3)
*Mar 24 23:32:56.162: TCP578: Telnet received WONT TTY-TYPE (24)
*Mar 24 23:32:56.163: TCP578: Telnet received WONT WINDOW-SIZE (31)
-Interface loopback ficando up:
R1#
*Mar 24 23:32:56.487: %SYS-5-CONFIG_I: Configured from console by fernando on vty0 (192.168.122.120)
*Mar 24 23:32:57.340: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback33, changed state to up
-Interface loopback configurada:
R1#show ip inter br
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 192.168.122.71 YES NVRAM up up
GigabitEthernet0/1 unassigned YES NVRAM administratively down down
GigabitEthernet0/2 unassigned YES NVRAM administratively down down
GigabitEthernet0/3 unassigned YES NVRAM administratively down down
Loopback0 1.1.1.1 YES NVRAM up up
Loopback33 3.3.3.3 YES manual up up
R1#
-Criada outra loopback, a loopback 44:
R1#
*Mar 24 23:42:18.828: Telnet578: 1 1 251 1
*Mar 24 23:42:18.829: TCP578: Telnet sent WILL ECHO (1)
*Mar 24 23:42:18.829: Telnet578: 2 2 251 3
*Mar 24 23:42:18.829: TCP578: Telnet sent WILL SUPPRESS-GA (3)
*Mar 24 23:42:18.829: Telnet578: 80000 80000 253 24
*Mar 24 23:42:18.830: TCP578: Telnet sent DO TTY-TYPE (24)
*Mar 24 23:42:18.830: Telnet578: 10000000 10000000 253 31
*Mar 24 23:42:18.830: TCP578: Telnet sent DO WINDOW-SIZE (31)
*Mar 24 23:42:18.849: TCP578: Telnet received DONT ECHO (1)
*Mar 24 23:42:18.852: TCP578: Telnet sent WONT ECHO (1)
*Mar 24 23:42:18.861: TCP578: Telnet received DONT SUPPRESS-GA (3)
*Mar 24 23:42:18.861: TCP578: Telnet sent WONT SUPPRESS-GA (3)
R1#
*Mar 24 23:42:18.863: TCP578: Telnet received WONT TTY-TYPE (24)
*Mar 24 23:42:18.864: TCP578: Telnet sent DONT TTY-TYPE (24)
*Mar 24 23:42:18.865: TCP578: Telnet received WONT WINDOW-SIZE (31)
*Mar 24 23:42:18.866: TCP578: Telnet sent DONT WINDOW-SIZE (31)
*Mar 24 23:42:18.892: TCP578: Telnet received DONT ECHO (1)
*Mar 24 23:42:18.892: TCP578: Telnet received DONT SUPPRESS-GA (3)
*Mar 24 23:42:18.893: TCP578: Telnet received WONT TTY-TYPE (24)
*Mar 24 23:42:18.893: TCP578: Telnet received WONT WINDOW-SIZE (31)
R1#
*Mar 24 23:42:19.518: %SYS-5-CONFIG_I: Configured from console by fernando on vty0 (192.168.122.120)
*Mar 24 23:42:20.247: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback44, changed state to up
R1#show ip inter br
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 192.168.122.71 YES NVRAM up up
GigabitEthernet0/1 unassigned YES NVRAM administratively down down
GigabitEthernet0/2 unassigned YES NVRAM administratively down down
GigabitEthernet0/3 unassigned YES NVRAM administratively down down
Loopback0 1.1.1.1 YES NVRAM up up
Loopback33 3.3.3.3 YES manual up up
Loopback44 4.4.4.4 YES manual up up
R1#
##################################################################################
##################################################################################
##################################################################################
##################################################################################
##################################################################################
##################################################################################
##################################################################################
##################################################################################
##################################################################################
##################################################################################
####################################### Habilitar o OSPF via script Python
-Verificando a inexistencia de protocolo ativo:
R1#show ip prot
R1#show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)
R1#
R1#
-Adicionadas estas linhas ao script:
tn.write(b"router ospf 1\n")
tn.write(b"network 0.0.0.0 255.255.255.255 area 0\n")
-Script executado, protocolo OSPF ativado:
R1#show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 4.4.4.4
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
0.0.0.0 255.255.255.255 area 0
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 110)
R1#
R1#
R1#
R1#SHOW IP OSPF inter br
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Lo0 1 0 1.1.1.1/32 1 LOOP 0/0
Lo33 1 0 3.3.3.3/32 1 LOOP 0/0
Lo44 1 0 4.4.4.4/32 1 LOOP 0/0
Gi0/0 1 0 192.168.122.71/24 1 DR 0/0
R1#