Skip to content

Instantly share code, notes, and snippets.

@pkociepka
Last active December 8, 2016 00:30
Show Gist options
  • Select an option

  • Save pkociepka/3785685c266f59cd2a37005f03dcad07 to your computer and use it in GitHub Desktop.

Select an option

Save pkociepka/3785685c266f59cd2a37005f03dcad07 to your computer and use it in GitHub Desktop.

Konfiguracja switcha

VLAN

Tworzenie VLAN-a
vlan 10
exit
Łącze zwykłe
int fa0/0
  switchport access vlan 10
  switchport mode access
Łącze trunk
int fa0/2
  switchport trunk encapsulation dot1q
  switchport mode trunk

Konfiguracja routera

Porty

Adresacja
int fa0/0
  ip address 192.168.1.1 255.255.255.0
  no shutdown
VLAN
int fa0/0.10
  encapsulation dot1q 10
  ip address ... ...

DHCP

Serwer:

conf t
  ip dhcp pool AdresyDlaLAN1
  network 172.16.1.0 255.255.255.0
  default-router 172.16.1.1
…
interface fa0/1
  ip address 172.16.100.1

Zwykły router:

interface fa0/0
  ip address 172.16.1.1 255.255.255.0
  ip helper-address 172.16.100.1

DNS

ip local pool PULA 10.4.10.1 10.4.10.15
async-bootp dns-server 10.1.10.55

Routing

Statyczny
ip route 192.168.1.0 255.255.255.0 10.0.0.1
RIP
router rip
  version 2
  network 10.0.0.0
OSPF
conf t
router ospf 100
 network 172.16.0.0 0.0.127.255 area 100
 default-information originate    # propagacja trasy domyślnej w domenie OSPF
BGP

1170 to numer systemu autonomicznego.

router bgp 1170
 neighbor 44.0.0.70 remote-as 1170    # ogłaszamy w AS 170
 neighbor 10.0.0.1 distribute-list 42 out    # ogłaszamy tam, gdzie pozwala ACL 42
 network 150.0.80.0 mask 255.255.255.0

ACL

Podstawowe

Numery 10-100. Wpuszczają/blokują cały ruch od hostow odpowiadających wzorcowi.

access-list 10 permit 10.0.0.0 0.0.1.25
Rozszerzone

Wpuszczają/blokują ruch z konkretnych protokołow, od hostow odpowiadających pierwszemu wzorcowi do hostow odpowiadających drugiemu wzorcowi.

access-list [number] [permit | deny] [proto] [pattern_from] [pattern_to]
pattern := [address] [mask] | host [address] | any
np:
access-list 100 deny icmp 10.0.0.0 0.0.0.1 30.0.0.0 0.0.0.3
Przypisanie ACL
int fa0/0
  ip access-group 100 [in | out]
Reflexive
conf t
  ip access-list extended ZBIERAM
    permit ip any any reflect KOSZYCZEK

  ip access-list extended SPRAWDZAM
    evaluate KOSZYCZEK

  int s0/0/0
    ip access-group ZBIERAM out
    ip access-group SPRAWDZAM in

Zdalny dostęp

Prosty
conf t
  username wilfried password diffie
  username martin password hellmann

  line vty 0 15
    transport input telnet    # na wirtualnych terminalach ruch telnet
    login local   # uwierzytelnianie w lokalnej bazie uzytkownikow
Lepszy
config t
  username wilfried secret diffie
  username martin secret hellmann

  crypto key zeroize rsa
  crypto key generate rsa modulus 1024

  aaa new-model
  aaa authentication login AGH_WYMIATA local    # lista stosowanych metod uwierzytelniania

  line vty 0 15
    transport input ssh
    aaa login authentication AGH_WYMIATA

    access-class 77 in    # sesje od hostow odpowiadających wzorcowi

Site to site

ISAKMP

Ze wspołdzielonym kluczem

crypto isakmp key agh_rulez address 150.0.0.6
crypto isakmp policy 100
  authentication pre-share
  group 5
  exit
Tunel
# ACL wybierająca pakiety do szyfrowania
access-list 177 permit ip 10.1.0.0 0.0.0.3 10.2.0.0 0.0.0.3

# Zestaw przekształceń
crypto ipsec transform-set ZMIEL_MI_TO esp-aes

# Powiązanie końcow tunelu
crypto map POWIAZ 100 ipsec-isakmp
  match address 177
  set transform-set ZMIEL_MI_TO
  set peer 150.0.0.6
  exit
interface s0/0
  crypto map POWIAZ

** Routery dokonują interpretacji ACL (!) - z drugiej strony musi być lista „odwrotna” **

S2S z interfejsem Tunnel

ISAKMP (jak wcześniej):

R1(config)# crypto isakmp key agh_rulez address 0.0.0.0 0.0.0.0
R1(config)# crypto isakmp policy 100
R1(config-isakmp)# authentication pre-share
R1(config-isakmp)# encryption aes
R1(config-isakmp)# group 5
R1(config-isakmp)# exit

R3(config)#
# to samo, tylko z adresem sieci R1 zamiast 0.0.0.0

Zestaw przekształceń:

R1(config)#
crypto ipsec transform-set MLYNEK2 esp-aes esp-sha-hmac
  exit
crypto ipsec profile SEC_PROF
  set transform-set MLYNEK2
  exit

R3(config)#
# j. w.

Tunel:

R1(config)#
interface Tunnel 0
  ip address 10.3.0.1 255.255.255.252
  tunnel source s0/0
  tunnel destination 150.0.0.6
  [tunnel mode ipsec ipv4]
  tunnel protection ipsec profile SEC_PROF
  exit

R3(config)#
# to samo, tylko podmienić odpowiednie adresy

VPDN

Najpierw robimy DNS

Szablon dla dynamicznych interfejsow
R2(config)#
interface Virtual-Template 4
 ip unnumbered loopback 0
 peer default ip address pool PULA
 ppp authentication chap
 exit
Przychodzące ządania L2TP
R2(config)#
vpdn enable
vpdn-group INF4
 accept-dialin
 protocol l2tp
 virtual-template 4
Uwierzytelnianie ISAKMP, zestaw przekształceń i kryptomapa

Dla routerow 1-3:

R2(config)#
crypto ipsec transform-set FOR_WINXP esp-3des esp-md5-hmac
 mode transport
 exit
crypto map MAPA 10 ipsec-isakmp profile PROF
 set transform-set FOR_WINXP

Dla routerow 4-5:

R2(config)#
crypto ipsec transform-set FOR_WINXP esp-3des esp-md5-hmac
  mode transport
  exit
crypto dynamic map DM 10
  set transform-set FOR_WINXP
crypto map MAPA 10 ipsec-isakmp dynamic DM
Zabezpieczenie tunelu
R2(config)# vpdn-group INF4
no l2tp tunnel authentication
l2tp security crypto-profile PROF
int s0/0
 description outside
 crypto map MAPA

RADIUS

R2(config)#
aaa new-model
radius-server host 10.1.0.44 auth-port 1812 acct-port 1813 key AGHRAD
aaa authentication ppp PPP_AUTH group radius local

interface Virtual-Template 4
 ppp authentication chap PPP_AUTH
R2(config)#
aaa accounting network PPP_ACCT start-stop group radius

interface Virtual-Template 4
 ppp accounting PPP_ACCT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment