forked from Sxmon17/cisco_script_collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter-template.txt
More file actions
262 lines (199 loc) · 6.36 KB
/
Copy pathrouter-template.txt
File metadata and controls
262 lines (199 loc) · 6.36 KB
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
! ===============================================================
! R O U T E R - [DEVICE-NAME]
! ===============================================================
enable
configure terminal
! Set Hostname
! ------------
hostname [HOSTNAME]
! Disable DNL
! -----------
no ip domain-lookup
! Enable Unicast Routing
! ----------------------
ipv6 unicast-routing
! Set Enable Password
! -------------------
enable secret [ENABLE-PASSWORD (cisco)]
! Set Console Password
! --------------------
line console 0
motd-banner
logging synchronous
password [CONSOLE-PASSWORD (cisco)]
exec-timeout [MINUTES (0)] [SECONDS (0)]
login
exit
! Configure Ports For Secure Access
! ---------------------------------
line vty [(PORT-RANGE (0 15)]
motd-banner
logging synchronous
password [PORT-PASSWORD (cisco)]
exec-timeout [MINUTES (0)] [SECONDS (0)]
transport input [CONNECTION-TYPE (telnet) | (ssh))
login [DB-LOCATION (local)]
exit
! Write Banner MOTD
! -----------------
banner motd [BANNER-MODT (+This is a secure system. Authorized Access Only!+)]
! Configure (Sub-)Interface(s)
! ----------------------------
interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)][.SUBINTERFACE]
description [NETWORK-DESCRIPTION]
ipv6 enable
encapsulation dot1Q [VLAN-ID] [native]
ip address [(dhcp)] | [[PORT-IPv4-ADDRESS] [PORT-IPv4-SUBNET-MASK]]
ipv6 address [(dhcp)] | [IPv6-ADDRESS/IPv6-PREFIX]
ipv6 address [fe80::LLA-Address] link-local
clock rate [CLOCK-RATE (64000)]
no shutdown
exit
! Adding Security Configurations (not available for all routers)
! --------------------------------------------------------------
! auto secure
service password-encryption
security passwords min-length [MIN-PASSWORD-LENGTH]
login block-for [TIMOUT-DURATION (180)] attempts [ATTEMPTS (3)] within [TIMESPAN (20)]
! Mitigate ARP & DHCP Attacks
! ---------------------------
ip dhcp snooping
ip dhcp snooping vlan [VLAN-ID]
ip arp inspection vlan [VLAN-ID]
ip arp inspection validate src-mac dst-mac ip
! Configure trusted (infrastructural) links
! -----------------------------------------
interface [(range)] [PORT-TYPE (gig/fa)] [PORT-NUMBER(S) (0/0, 0/1/1, ...)]
ip dhcp snooping trust
ip arp inspection trust
exit
! Mitigate Reconnaisance Attacks
! ------------------------------
no cdp run
no lldp run
! Create DHCP-Pool(s)
! -------------------
ip dhcp excluded-address [START-IP-ADDRESS] [END-IP-ADDRESS(included)]
ip dhcp pool [POOLNAME]
network [NETWORK-IP-ADDRESS] [NETWORK-IP-SUBNET-MASK]
default-router [IP-ADDRESS]
dns-server [IP-ADDRESS]
domain-name [DOMAIN-NAME]
lease [LEASE-DURATION(days hours minutes | infinite)]
exit
! Enable DHCP-Service
! -------------------
service dhcp
! Disable Unused Services
! -----------------------
! no ip http server
! Configure Relay Agent
! ---------------------
int [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)]
ip helper-address [IP-HELPER-ADDRESS]
exit
! Enable OSPF Support
! -------------------
router ospf [PROCESS-ID (1)]
router-id [RIP (IP-FORMAT)]
network [NETWORK-ADDRESS] [WILDCARD-MASK] area [AREA-ID (0)]
passive-interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)]
default-information originate
exit
interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)]
ip ospf [PROCESS-ID (1)] area [AREA-ID (0)]
exit
! Configure GRE Tunnels
! ---------------------
interface tunnel [TUNNEL-NR]
tunnel mode gre ip
tunnel source [SRC-INTERFACE]
tunnel destination [DESTINATION-IP]
ip address [IP-ADDRESS] [NETMASK]
exit
! Add Static Routes
! -----------------
ip route 0.0.0.0 0.0.0.0 [IPv4-GATEWAY-OF-LAST-RESORT]
ip route ::/0 [IPv6-GATEWAY-OF-LAST-RESORT]
! Enable RIP Support
! ------------------
router rip
version 2
no auto-summary
network [IP-NETWORK-ADDRESS]
passive-interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)]
default-information originate
exit
! Enable BGP Support
! ------------------
router bgp [AS-NUMBER]
bgp router-id interface [ROUTER-ID]
network [NETWORK-ADDRESS] mask [NETMASK]
! iBGP
neighbor [NEIGHBOR-IP] remote-as [LOCAL-AS-NUMBER]
neighbor [NEIGHBOR-IP] update-source [LOOPBACK-INTERFACE]
! eBGP
neighbor [PEER-IP] remote-as [REMOTE-AS-NUMBER]
neighbor [PEER-IP] ebgp-multihop [MAX-HOP-COUNT (3)]
exit
! Configure SSH-Access
! --------------------
ip domain-name [DOMAIN-NAME]
username [USERNAME] secret [SSH-PASSWORD]
username [USERNAME] privilege [PRIVILEGE-LEVEL (0-16)]
crypto key generate rsa general-keys modulus [MODULUS-LENGTH (2048)]
ip ssh version 2
! Add HSRP Redundancy
! -------------------
interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)]
standby version 2
standby [GROUP-ID] ip [IPv4-ADDRESS]
standby [GROUP-ID] priority [PRIORITY (100)]
standby [GROUP-ID] preempt
exit
! Add NAT Service
! ---------------
! SNAT
ip nat inside source static [IP-INSIDE-ADDRESS] [IP-OUTSIDE-ADDRESS]
! DNAT (PAT-Option)
ip nat pool [NAT-POOLNAME] [START-IP-ADDRESS] [END-IP-ADDRESS] netmask [NETMASK] [overload]
access-list [ACL-NR] [permit | deny] [NETWORK-ADDRESS] [WILDCARD-MASK]
ip nat inside source list [ACL-NR] pool [NAT-POOLNAME]
! PAT
ip nat inside source list [ACL-NR] interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)] overload
interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)]
ip nat [inside | outside]
exit
! Define ACLs & Device Access
! ---------------------------
! Standard
ip access-list standard [ACL-NUMBER (1-99) | ACL-NAME]
remark [ACL-REMARK]
[SEQ-NUMBER] [deny | permit] [any | host [HOST-IP] | [NETWORK-ADDRESS] [WILDCARD MASK]] [any | host [HOST-IP] | [NETWORK-ADDRESS] [WILDCARD MASK]]
deny any any
exit
! Extended
ip access-list extended [ACL-NUMBER (100-199) | ACL-NAME]
remark [ACL-REMARK]
[SEQ-NUMBER] [deny | permit] [icmp | ip | tcp | udp | ospf] [any | host [HOST-IP] | [NETWORK-ADDRESS] [WILDCARD MASK]] [any | host [HOST-IP] | [NETWORK-ADDRESS] [WILDCARD MASK]] eq [PORT-NUMBER]
deny ip any any
exit
interface [PORT-TYPE (gig/fa)] [PORT-NUMBER (0/0, 0/1/1, ...)]
ip access-group [ACL-NUMBER | ACL-NAME] [in | out]
exit
line vty [(PORT-RANGE(0 15)]
ip access-class [ACL-NAME] [in | out]
exit
! CBAC Configuration
ip access-list extended CBAC_ACL
remark BLOCK_ALL_TRAFFIC
deny ip any any
exit
ip inspect name CBAC_INSPECTION [(icmp) | (tcp) | (udp) | (http)]
interface [OUTSIDE-INTERFACE]
ip access-group CBAC_ACL in
ip inspect CBAC_INSPECTION out
exit
! Save Configuration
! ------------------
do write memory