Showing posts with label Cisco. Show all posts
Showing posts with label Cisco. Show all posts

Sunday, June 8, 2014

CONFIGURING SITE TO SITE IPSEC VPN TUNNEL BETWEEN CISCO ROUTERS

Site-to-Site IPSec VPN Tunnels are used to allow the secure transmission of data, voice and video between two sites (e.g offices or branches). The VPN tunnel is created over the Internet public network and encrypted using a number of advanced encryption algorithms to provide confidentiality of the data transmitted between the two sites.
This article will show how to setup and configure two Cisco routers to create a permanent secure site-to-site VPN tunnel over the Internet, using the IP Security (IPSec) protocol. In this article we assume both Cisco routers have a static public IP address.  Readers interested in configuring support for dynamic public IP address endpoint routers can refer to our Configuring Site to Site IPSec VPN with Dynamic IP Endpoint Cisco Routers article.
IPSec VPN tunnels can also be configured using GRE (Generic Routing Encapsulation) Tunnels with IPsec. GRE tunnels greatly simply the configuration and administration of VPN tunnels and are covered in our Configuring Point-to-Point GRE VPN Tunnels article.  Lastly, DMVPNs – a new VPN trend that provide major flexibility and almost no administration overhead can also be examined by reading ourUnderstanding Cisco Dynamic Multipoint VPN (DMVPN),  Dynamic Multipoint VPN (DMVPN) Deployment Models & Architectures andConfiguring Cisco Dynamic Multipoint VPN (DMVPN) - Hub, Spokes , mGRE Protection and Routing - DMVPN Configuration articles.
ISAKMP (Internet Security Association and Key Management Protocol) and IPSec are essential to building and encrypting the VPN tunnel. ISAKMP, also called IKE (Internet Key Exchange), is the negotiation protocol that allows two hosts to agree on how to build an IPsec security association. ISAKMP negotiation consists of two phases: Phase 1 and Phase 2.  
Phase 1 creates the first tunnel, which protects later ISAKMP negotiation messages. Phase 2 creates the tunnel that protects data.  IPSec then comes into play to encrypt the data using encryption algorithms and provides authentication, encryption and anti-replay services.

IPSEC VPN REQUIREMENTS

To help make this an easy-to-follow exercise, we have split it into two steps that are required to get the Site-to-Site IPSec VPN Tunnel to work.
These steps are:
(1)  Configure ISAKMP (ISAKMP Phase 1)
(2)  Configure IPSec  (ISAKMP Phase 2, ACLs, Crypto MAP)
Our example setup is between two branches of a small company, these are Site 1 and Site 2. Both the branch routers connect to the Internet and have a static IP Address assigned by their ISP as shown on the diagram:
 cisco-routers-s2s-ipsec-vpn-1
Site 1 is configured with an internal network of 10.10.10.0/24, while Site 2 is configured with network 20.20.20.0/24. The goal is to securely connect both LAN networks and allow full communication between them, without any restrictions.

CONFIGURE ISAKMP (IKE) - (ISAKMP PHASE 1)

IKE exists only to establish SAs (Security Association) for IPsec. Before it can do this, IKE must negotiate an SA (an ISAKMP SA) relationship with the peer.
To begin, we’ll start working on the Site 1 router (R1).
First step is to configure an ISAKMP Phase 1 policy:
R1(config)#  crypto isakmp policy 1
R1(config-isakmp)# encr 3des
R1(config-isakmp)# hash md5
R1(config-isakmp)# authentication pre-share
R1(config-isakmp)# group 2
R1(config-isakmp)# lifetime 86400

The above commands define the following (in listed order):
3DES - The encryption method to be used for Phase 1.
MD5 - The hashing algorithm
Pre-share - Use Pre-shared key as the authentication method
Group 2 - Diffie-Hellman group to be used
86400 – Session key lifetime. Expressed in either kilobytes (after x-amount of traffic, change the key) or seconds. Value set is the default value.
We should note that ISAKMP Phase 1 policy is defined globally. This means that if we have five different remote sites and configured five different ISAKMP Phase 1 policies (one for each remote router), when our router tries to negotiate a VPN tunnel with each site it will send all five policies and use the first match that is accepted by both ends.
Next we are going to define a pre shared key for authentication with our peer (R2 router) by using the following command:
R1(config)# crypto isakmp key firewallcx address 1.1.1.2
The peer’s pre shared key is set to firewallcx and its public IP Address is 1.1.1.2. Every time R1 tries to establish a VPN tunnel with R2 (1.1.1.2), this pre shared key will be used.

 

CONFIGURE IPSEC

To configure IPSec we need to setup the following in order:
Create extended ACL
Create IPSec Transform
Create Crypto Map
Apply crypto map to the public interface
Let us examine each of the above steps.

 

CREATING EXTENDED ACL

Next step is to create an access-list and define the traffic we would like the router to pass through the VPN tunnel.  In this example, it would be traffic from one network to the other, 10.10.10.0/24 to 20.20.20.0/24.  Access-lists that define VPN traffic are sometimes calledcrypto access-list or interesting traffic access-list.
R1(config)# ip access-list extended VPN-TRAFFIC
R1(config-ext-nacl)# permit ip 10.10.10.0 0.0.0.255 20.20.20.0 0.0.0.255

 

CREATE IPSEC TRANSFORM (ISAKMP PHASE 2 POLICY)

Next step is to create the transform set used to protect our data. We’ve named this TS:
R1(config)# crypto ipsec transform-set TS esp-3des esp-md5-hmac
The above command defines the following:  
ESP-3DES - Encryption method
MD5 - Hashing algorithm

CREATE CRYPTO MAP

The Crypto map is the last step of our setup and connects the previously defined ISAKMP and IPSec configuration together:
R1(config)# crypto map CMAP 10 ipsec-isakmp
R1(config-crypto-map)# set peer 1.1.1.2
R1(config-crypto-map)# set transform-set TS
R1(config-crypto-map)# match address VPN-TRAFFIC
We’ve named our crypto map CMAP. The ipsec-isakmp tag tells the router that this crypto map is an IPsec crypto map. Although there is only one peer declared in this crypto map (1.1.1.2), it is possible to have multiple peers within a given crypto map.

APPLY CRYPTO MAP TO THE PUBLIC INTERFACE

The final step is to apply the crypto map to the outgoing interface of the router. Here, the outgoing interface is FastEthernet 0/1.
R1(config)# interface FastEthernet0/1
R1(config- if)# crypto map CMAP
Note that you can assign only one crypto map to an interface.
As soon as we apply crypto map on the interface, we receive a message from the router  that confirms isakmp is on: “ISAKMP is ON”.
At this point, we have completed the IPSec VPN configuration on the Site 1 router.
We now move to the Site 2 router to complete the VPN configuration. The settings for Router 2 are identical, with the only difference being the peer IP Addresses and access lists:
R2(config)# crypto isakmp policy 1
R2(config-isakmp)# encr 3des
R2(config-isakmp)# hash md5
R2(config-isakmp)# authentication pre-share
R2(config-isakmp)# group 2
R2(config-isakmp)# lifetime 86400
R2(config)# crypto isakmp key firewallcx address 1.1.1.1
R2(config)# ip access-list extended VPN-TRAFFIC
R2(config-ext-nacl)# permit ip 20.20.20.0 0.0.0.255 10.10.10.0 0.0.0.255
 
R2(config)# crypto ipsec transform-set TS esp-3des esp-md5-hmac
R2(config)# crypto map CMAP 10 ipsec-isakmp
R2(config-crypto-map)# set peer 1.1.1.1
R2(config-crypto-map)# set transform-set TS
R2(config-crypto-map)# match address VPN-TRAFFIC
R2(config)# interface FastEthernet0/1
R2(config- if)# crypto map CMAP

 

NETWORK ADDRESS TRANSLATION (NAT) AND IPSEC VPN TUNNELS

Network Address Translation (NAT) is most likely to be configured to provide Internet access to internal hosts. When configuring a Site-to-Site VPN tunnel, it is imperative to instruct the router not to perform NAT (deny NAT) on packets destined to the remote VPN network(s).
This is easily done by inserting a deny statement at the beginning of the NAT access lists as shown below:
For Site 1’s router:
R1(config)# ip nat inside source list 100 interface fastethernet0/1 overload
R1(config)# access-list 100 remark -=[Define NAT Service]=-
R1(config)# access-list 100 deny ip 10.10.10.0 0.0.0.255 20.20.20.0 0.0.0.255
R1(config)# access-list 100 permit ip 10.10.10.0 0.0.0.255 any
R1(config)# access-list 100 remark

And Site 2’s router:
R2(config)# ip nat inside source list 100 interface fastethernet0/1 overload
R2(config)# access-list 100 remark -=[Define NAT Service]=-
R2(config)# access-list 100 deny ip 20.20.20.0 0.0.0.255 10.10.10.0  0.0.0.255
R2(config)# access-list 100 permit ip 20.20.20.0 0.0.0.255 any
R2(config)# access-list 100 remark

 

BRINGING UP AND VERIFYING THE VPN TUNNEL

At this point, we’ve completed our configuration and the VPN Tunnel is ready to be brought up.  To initiate the VPN Tunnel, we need to force one packet to traverse the VPN and this can be achieved by pinging from one router to another:
R1# ping 20.20.20.1 source fastethernet0/0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.1, timeout is 2 seconds:
Packet sent with a source address of 10.10.10.1
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 44/47/48 ms


The first ping received a timeout, but the rest received a reply, as expected. The time required to bring up the VPN Tunnel is sometimes slightly more than 2 seconds, causing the first ping to timeout.
To verify the VPN Tunnel, use the show crypto session command:
R1# show crypto session
Crypto session current status
Interface: FastEthernet0/1
Session status: UP-ACTIVE    
Peer: 1.1.1.2 port 500
  IKE SA: local 1.1.1.1/500 remote 1.1.1.2/500 Active
  IPSEC FLOW: permit ip 10.10.10.0/255.255.255.0 20.20.20.0/255.255.255.0
        Active SAs: 2, origin: crypto map


Thursday, January 2, 2014

Checkpoint and Cisco site-to-site VPN

Checkpoint and Cisco site-to-site VPN

This guide shows you how to create site-to-site VPN tunnel between checkpoint firewall and cisco router. Let's begin:

Checkpoint
IP address: 1.1.1.2
Network behind: 172.20.200.0/24

Create a network object that is the network that will be sitting behind the new Cisco router



Set the NAT – for Internet routing

2

Create a network object that is the network that will be sitting behind Checkpoint firewall:

3


Set the NAT – for Internet routing

4

Create a new interoperable device on CheckPoint for Cisco router

5

On Topology option, add external Interface

6

Note picture above is wrong (should be 1.1.1.1) – sorry$
Mark it as an external interface

7

Create an internal Interface:

8

Mark it as an Internal interface which leads to the network behind Cisco router

9

On the VPN domain option, choose manually defined: and assign the network that is behind Cisco router

10

On the VPN Manager, create a new community or join the new interoperable device to the existing community (either meshed or star)
Create a new one:

11

On the participating gateway, put the Cisco router and Checkpoint firewall

12

On the VPN properties, make sure the phase 1 and phase 2 is having the same setup in both Cisco (later) and Checkpoint
In this example we are using 3des-md5 for phase 1 and aes-128-md5 for phase 2

13

On the Advanced Properties, make sure the phase 1 and phase 2 is having the same setup in both Cisco (later) and Checkpoint
In this example we are using group 2 for phase 1 diffie-hellman group
Disable NAT inside VPN community – so that site-to-site VPN is not Natted

14

On Shared Secret page, put the share secret on to be used with Cisco router:

15

Create a rule in Checkpoint firewall to encrypt the traffic between network behind each firewall:

16

Push the policy to the CheckPoint firewall!

Cisco
IP address: 1.1.1.1
Network behind: 172.20.199.0/24

Create the isamkmp policy:
crypto isakmp policy 1
encr 3des
hash md5
authentication pre-share
group 2


Create the crypto key:
crypto isakmp key address 1.1.1.2 no-xauth

where shared-key is the shared key you setup in Checkpoint and 1.1.1.2 is the checkpoint IP address

Create transform set:
crypto ipsec transform-set cm-transformset-1 esp-aes esp-md5-hmac
Create the crypto-map:
crypto map cm-cryptomap 1 ipsec-isakmp
description VPN tunnel to Checkpoint
set peer 1.1.1.2
set security-association lifetime seconds 28800
set transform-set cm-transformset-1
match address 111


Create the outbound access list inside VPN (allow Cisco network to Checkpoint network):
access-list 111 permit ip 172.20.199.0 0.0.0.255 172.20.200.0 0.0.7.255
Create the inbound access list for external interface:
access-list 101 permit icmp any any
access-list 101 permit ip 1.1.1.2 0.0.0.0 any
access-list 101 permit ip 172.20.200.0 0.0.0.255 any
access-list 101 deny ip any any log

Assign crypto-map to the external interface:
interface Serial0/0
bandwidth 2048
ip address 1.1.1.1 255.255.255.0
ip access-group 101 in
no ip proxy-arp
ip nat outside
ip route-cache flow
no cdp enable
crypto map cm-cryptomap

Configure internal interface:
interface FastEthernet0/0
description Cisco LAN
ip address 172.20.199.254 255.255.255.0
no ip proxy-arp
ip nat inside
ip route-cache flow
speed 100
full-duplex
ntp broadcast
no cdp enable


Create the NAT rule:
ip nat inside source route-map nonat interface Serial0/0 overload
route-map nonat permit 10
match ip address 150 


Create access list for NAT:
Do-not NAT traffic between sites
NAT everything else

access-list 150 deny ip 172.20.199.0 0.0.0.255 172.20.200.0 0.0.0.255
access-list 150 permit ip 172.20.199.0 0.0.0.255 any

http://blog.laurence.id.au/2007/06/checkpoint-and-cisco-site-to-site-vpn.html

Monday, April 8, 2013

How To Configure Cisco's Syslog Logging


In this blog entry I will outline the steps you need to take on your Cisco Router or Catalyst device to configure syslog logging.

If you are configuring a Cisco Router for syslog logging then please follow the steps below:

1. In order to ensure that logging is enabled, issue the logging on command.

Router(config)# logging on

2. In order to specify the Essentials server that is to receive the router syslog messages, issue the logging ip_address command. ip_address is the address of the server that collects the syslog messages.

Router(config)# logging 1.1.1.1

3. In order to limit the types of messages that can be logged to the Essentials server, set the appropriate logging trap level with the logging trap informational command. The informational portion of the command signifies severity level 6. This means all messages from level 0-5 (from emergencies to notifications) are logged to the Essentials server.

Router(config)# logging trap informational

Valid logging facilities are local0 through local7.

Valid levels are:

emergency
alert
critical
error
warning
notification
informational
debug
4. In order to verify if the device sends syslog messages, run the sh logging command. You see all the syslog messages that are sent. If you do not see syslog messages, ensure that this is configured:

logging on logging console debug logging monitor debug logging trap debug

If you are configuring a Cisco Catalyst device for syslog logging please follow the steps below:

1. Ensure sure logging is enabled with the set logging server enable command.

Catalyst> (enable) set logging server enable

2. Specify the Essentials server that is to receive the router syslog messages, with the logging server_ip command. server ip is the IP address of the Essentials server.

Catalyst> (enable) set logging server 1.1.1.1

3. Limit the types of messages logged to the Essentials server. Enter set logging level informational, where informational signifies severity level 6. This means that all messages from level 0-5 (from emergencies to notifications) are logged to the Essentials server.

Catalyst> (enable) set logging server severity 6

4. In order to see if syslog messages are sent, use the sh logging buffer command. You see syslog messages that are sent. If you experience problems with switches, try this configuration:

set logging level all 7 default

set logging server enable

set logging server 1.1.1.1 (your unix syslog server ip address)

set logging server facility LOCAL7

set logging server severity 7 #syslog

set logging console enable

set logging server enable

set logging server 1.1.1.1

set logging level cdp 7 default

set logging level mcast 7 default

set logging level dtp 7 default

set logging level dvlan 7 default

set logging level earl 7 default

set logging level fddi 7 default

set logging level ip 7 default

set logging level pruning 7 default

set logging level snmp 7 default

set logging level spantree 7 default

set logging level sys 7 default

set logging level tac 7 default

set logging level tcp 7 default

set logging level telnet 7 default

set logging level tftp 7 default

set logging level vtp 7 default

set logging level vmps 7 default

set logging level kernel 7 default

set logging level filesys 7 default

set logging level drip 7 default

set logging level pagp 7 default

set logging level mgmt 7 default

set logging level mls 7 default

set logging level protfilt 7 default

set logging level security 7 default

set logging level radius 7 default

set logging level udld 7 default

set logging level gvrp 7 default

set logging server facility LOCAL7

!

Enter: sh logging

You see this output:

Logging buffer size: 500

timestamp option: enabled

Logging history size: 1

Logging console: enabled

Logging server: enabled {1.1.1.1}

server facility: LOCAL7

server severity: debugging(7)

Current Logging Session: enabled

Your Cisco device will now be configured for syslog logging.


Software 4 win: http://www.geardownload.com/internet/syslog-watcher-personal-edition-download.html

http://www.joshd.ca/content/how-configure-ciscos-syslog-logging

Saturday, March 24, 2012

Switching - Chuyển mạch



1.Cấu hình cơ bản chung cho một Switch
Reset tất cả cấu hình của Switch và reload lại.
Switch#delete flash:vlan.dat
Switch#erase startup-config
Switch#reload
2.Cấu hình về Security và management
Switch(config)#hostname tên switch
Switch(config)#line console 0
Switch(config-line)#password mật khẩu
Switch(config-line)#login
Switch(config)#line vty 0 4
Switch(config-line)#pass mật khẩu
Switch(config-line)#login
3.Thiết lập địa chỉ IP và default gateway cho Switch
Switch(config)#interface vlan1
Switch(config-int)#ip address địa chỉ subnetmask
Switch(config)#ip default-gateway địa chỉ
4.Thiết lập tốc độ và duplex của cổng
Switch(config-int)#speed tốc độ
Switch(config-int)#duplex full
5.Thiết lập dịch vụ HTTP và cổng
Switch(config)#ip http server
Switch(config)#ip http port 80
6.Thiết lập, quản lý địa chỉ MAC
Switch(config)#mac-address-table static địa chỉ MAC interface fastethernet số vlan
Switch#show mac-address-table
Switch#clear mac-address-table
7.Cấu hình bảo mật cho cổng
Switch(config-if)#switchport mode acess
Switch(config-if)#switchport port-security
Cấu hình Static: Switch(config-if)#switchport port-security mac-address địa chỉ Mac
Cấu hình Sticky: Switch(config-if)#switchport port-security mac-address sticky (thông dụng nhất)
Switch(config-if)#switchport port-security maximum value
Switch(config-if)#switchport port-security violation shutdown
8.Tạo Vlan
Cách 1.
Switch#vlan database
Switch(vlan)#vlan number
Cách 2. Khi gán các cổng vào vlan, dù vlan chưa tồn tại nhưng Switch vẫn tự tạo.
Switch(config)#interface fastethernet 0/0
Switch(config-int)#switchport access vlan vlan-id
Muốn xoá vlan ta làm như sau:
Switch(config-if)#no switchport access vlan vlan-id
Switch#clear vlan vlan_number (xoá toàn bộ vlan )
9.Gán nhiều cổng vào trong vlan cùng một lúc, cấu hình Range
Đối với dãy cổng không liên tục.
Switch(config)#interface range cổng 1, cổng 2, cổng 3
Đối với một dãy liên tục.
Switch(config)#interface range cổng 1-n
Switch(config-range)#switchport access vlan vlan-id
Ví dụ:
Switch(config)#interface range f0/0, f0/2, f0/4
Switch(config)#interface range f0/0-10
Switch(config-range)#switchport access vlan 10
10.Cấu hình Trunk
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchpor trunk encapsulation encapsulation-type
Switch#show trunk
11.Cấu hình VTP
Switch#vlan database
Switch(vlan)#vtp v2-mode
Switch(vlan)#vtp domain tên domain
Switch(vlan)#vtp {server/client/transperant}
Switch(vlan)#vtp password password (Tạo pass cho domain)
Switch#show vtp status
12.Cấu hình Inter-Vlan trên Router
Router(config)#interface fastethernet 0/0.1
Router(config-subif)#encapsulation type
Router(config-subif)#ip address địa chỉ subnetmask

Access-list và các cấu hình liên quan


1.Nhắc lại về lý thuyết
Có 2 loại access-list.
- Loại thứ nhất: Standard IP Access-list chỉ lọc dữ liệu dựa vào địa chỉ IP nguồn. Range của loại này là từ 1à 99. Nên được áp dụng với cổng gần đích nhất.
- Loại thứ hai: Extended IP Access-list lọc dữ liệu dựa vào
o Địa chỉ IP nguồn
o Địa chỉ IP đích
o Giao thức (TCP, UDP)
o Số cổng (HTTP, Telnet…)
o Và các thông số khác như Windcard mask
Range của loại này là từ 100 à199. Nên được áp dụng với cổng gần nguồn nhất.
Hai bước để cấu hình Access-list
- Bước 1: Tạo access-list trong chế độ cấu hình config.
- Bước 2: Áp dụng access-list cho từng cổng tuỳ theo yêu cầu ở chế độ cấu hình (config-if)
Lưu ý:
- Mặc định của tất cả Access-list là deny all, vì vậy trong tất cả các access-list tối thiểu phải có 1 lệnh permit. Nếu trong access-list có cả permit và deny thì nên để các dòng lệnh permit bên trên.
- Về hướng của access-list (In/Out) khi áp dụng vào cổng có thể hiểu đơn giản là: In là từ host, Out là tới host hay In vào trong Router, còn Out là ra khỏi Router.
- Đối với IN router kiểm tra gói tin trước khi nó được đưa tới bảng xử lý. Đối vơi OUT, router kiểm tra gói tin sau khi nó vào bảng xử lý.
- Windcard mask được tính bằng công thức:
WM = 255.255.255.255 – Subnet mask (Áp dụng cho cả Classful và Classless addreess)
- 0.0.0.0 255.255.255.255 = any
- Ip address 0.0.0.0 = host ip address (chỉ định từng host một )
2.Cấu hình Standard Access-list (Ví dụ)
Router(config)#access-list 1 deny 172.16.0.0 0.0.255.255
Router(config)#access-list 1 permit any
Router(config)#interface fastethernet 0/0
Router(config-in)#ip access-group in
3.Cấu hình Extended Access-list (Ví dụ)
Router(config)#access-list 101 deny tcp 172.16.0.0 0.0.255.255 host 192.168.1.1 eq telnet
Router(config)#access-list 101 deny tcp 172.16.0.0 0.0.255.255 host 192.168.1.2 eq ftp
Router(config)#access-list 101 permit any any
Router(config)#interface fastethernet 0/0
Router(config-int)#ip access-group out
4.Cấu hình named ACL thay cho các số hiệu
Router(config)#ip access-list extended server-access (tên của access-list)
Router(config-ext-nacl)#permit tcp any host 92.168.1.3 eq telnet
Router(config)#interface fastethernet 0/0
Router(config-int)#ip access-group server-access out
5.Permit hoặc Deny Telnet sử dụng Standard Acl (Ví dụ)
Router(config)#access-list 2 permit 172.16.0.0 0.0.255.255
Router(config)#access-list 2 deny any
Router(config)#line vty 0 4
Router(config-line)#password cisco
Router(config-line)#login
Router(config-line)#ip access-class 2 in
6.Xoá và kiểm tra Access-list
Muốn xoá thì ta dùng lệnh sau:
Router(config)# no ip access-list số hiệu
Kiểm tra Acl ta dùng các lệnh sau:
- show access-list
- show running-config
- show ip interface

Cấu hình NAT


  • Cấu hình Static NAT
Cấu hình NAT trong chế độ Router(config). Các lệnh như sau
Router(config)#ip nat inside source static [inside local address] [inside global address]
Ví dụ:
R(config)#ip nat inside source statice 10.0.0.1 202.103.2.1 (Địa chỉ 10.10.0.1 sẽ được chuyển thành 202.103.2.1 khi đi ra khỏi Router)
Sau khi cấu hình xong phải áp dụng vào cổng in và cổng out, trong ví dụ dưới đây, cổng Ethernet là công in, còn cổng Serial là cổng out
Router(config)#interface ethernet 0
Router(config-if)#ip nat inside
Router(config)#interface serial 0
Router(config-if)#ip nat outside
  • Cấu hình Dynamic NAT
Router(config)#ip nat pool [ tên pool] [A.B.C.D A1.B1.C1.D1] netmask [mặt nạ]
Router(config)#ip nat inside source list [số hiệu ACL] pool [tên pool]
Router(config)#access-list [số hiệu ACL] permit A.B.C.D windcard masks
Ví dụ:
R(config)#ip nat pool nat-pool1 179.9.8.80 179.9.8.95 netmask 255.255.255.0
R(config)#ip nat inside source list 1 pool nat-pool1
R(config)#access-list 1 permit 10.1.0.0 0.0.0.255
Sau đó áp vào cổng In và Out như Static NAT
Note: Giải địa chỉ inside local address và inside global address phải nằm trong giải cho phép của ACL
  • Cấu hình PAT overload
  • Cấu hình overload với 1 địa chỉ IP cụ thể.
Router(config)#ip nat pool [tên pool] [ip global inside] [subnet mask]
Router(config)#ip nat inside source list [tên số hiệu ACL] pool [tên pool] overload
Router(config)#access-list [số hiệu] permit [địa chỉ] [windcard mask]
Ví dụ:
R(config)#access-list 2 permit 10.0.0.0 0.0.0.255
R(config)#ip nat pool nat-pool2 179.9.8.20 255.255.255.240
R(config)#ip nat inside source list 2 nat-pool2 overload
  • Cấu hình overload dùng địa chỉ của cổng ra.(Thường xuyên được dung hơn là trường hợp trên)
Router(config)#ip nat inside source list [tên số hiệu ACL] interface [cổng ra] overload
Router(config)#access-list [số hiệu] permit [địa chỉ] [windcard mask]
Ví dụ:
R(config)#ip nat inside source list 3 interface serial 0 overload
R(config)#access-list 3 permit 10.0.0.0 0.0.0.255
  • Các lệnh Clear NAT/PAT
Lệnh xóa tất cả dynamic nat trên toàn bộ các interface.
Router#clear ip nat translation *
Lệnh xóa các single nat trên từng interface
Router#clear ip nat translation [inside/outside] [global ip - local ip]
Lệnh xóa các extended nat trên từng interface
Router#clear ip nat translation protocol [inside/outside] [global ip - global port – local ip – local port]
  • Kiểm tra và Debug các NAT và PAT
Router#show ip nat translation
Router#show ip nat statics
Router#debug ip nat
  • Cấu hình DHCP
Router(config)#ip dhcp excluded-address ip-address (end-ip-address)
Router(config)#ip dhcp pool [tên pool]
Router(dhcp-config)#network addess subnetmask
Router(dhcp-config)#default-router address
Router(dhcp-config)#dns-server address
Router(dhcp-config)#netbios-name-server address
Router(dhcp-config)#domain-name tên domain
Router(dhcp-config)#lease ngày/giờ/phút
  • Kiểm tra và troubleshoot cấu hình DHCP
Router#show ip dhcp binding
Router#debug ip dhcp server events
  • Trong trường hợp DHCP server không nằm cùng mạng với host
Note: khi DHCP server không cùng mạng với host thì ta phải dùng lệnh ip helper-address giúp host đến DHCP server.
Router(config)#interface [cổng nằm cùng mạng với host]
Router(config-if)#ip helper-address [địa chỉ của DHCP server]
Note: Trong trường hợp muốn gói tin của host được broadcast ở mạng chứa DHCP thì ta dùng thêm lệnh ip directed-broadcast ở cổng cùng mạng với DHCP server
Router(config)#interface [cổng nằm cùng mạng với dhcp]
Router(config-ì)#ip directed-broadcast
II. Cấu hình PPP
1. Cấu hình cơ bản
R(config)#interface serial 0/0
R(config-if)#encapsulation ppp
2. Cấu hình PAP
Cấu hình PAP không yêu cầu hai Router giống nhau về password nhưng CHAP thì phải có.
(Cấu hình trên RA)
R(config)#host RA
RA(config)#username RB password 321
RA(config-if)#encapsulation ppp
RA(config-if)#ppp authentication pap
RA(config-if)#ppp pap sent-username RA password 123
(Cấu hình trên RB)
R(config)#host RB
RB(config)#username RA password 123
RB(config-if)#encapsulation ppp
RB(config-if)#ppp authentication pap
RB(config-if)#ppp pap sent-username RB password 321
3. Cấu hình CHAP (yêu cầu phải giống nhau về password)
(Cấu hình trên RA)
R(config)#host RA
RA(config)#username RB password 123
RA(config-if)encapsulation ppp
RA(config-if)ppp authentication chap
(Cấu hình trên RB)
R(config)#host RB
RB(config)#username RA password 123
RB(config-if)encapsulation ppp
RB(config-if)ppp authentication chap
4. Các cấu hình khác của PPP
a. Cấu hình Multilink
R(config-if)#encapsulation ppp
R(config-if)#ppp multilink
b. Cấu hình Compression
R(config-if)#encapsulation ppp
R(config-if)#compress [predictor/stac/mppc]
c. Cấu hình Error detection
R(config-if)#encapsulation ppp
R(config-if)#ppp quality [phần trăm]
5. Các lệnh kiểm tra cấu hình PPP
R#show interface (xem encapsulation)
R#debug ppp negotiation (Xem quá trình kết nối giữa 2 node)
R#debug ppp authentication (Xem quá trình xác thực giữa 2 node)
III. Cấu hình Frame-Relay
1. Cấu hình đơn giản
R(config-if)#encapsulation frame-relay {ciso| ietf} (mặc định là cisco)
Khi lệnh này được thực thi, DLCI sẽ được Inverse ARP tự động map, người dùng không cần phải làm gì cả.
* Nhưng Inverse ARP không làm việc với các kết nối Hub-and-Spoke
2. Cấu hình Frame-relay static map
R(config-if)#encapsulation frame-relay
R(config-if)#frame-relay map ip remote–ip-address local-dlci [broadcast] [cisco| ietf]
(ip address trong dòng lệnh trên chỉ lấy làm minh họa bởi nó rất phổ biến, chính xác phải là remote–protocol–address)
Broadcast trong câu lệnh trên có 2 chức năng:
§ Forward broadcast khi multicast không được khởi động.
§ Đơn giản hóa cấu hình OSPF cho mạng nonbroadcast sử dụng FRelay.
Ví dụ:
R(config-if)#encapsulation frame-relay
R(config-if)#frame-relay map ip 192.168.2.1 100 broadcast
3. Cấu hình FR trong mạng None Broadcast MutiAccess
- Trong mạng Broadcast khi 1 máy tính truyền frame tất cả các node lắng nghe frame nhưng chỉ có node cần nhận mới nhận được.
- Trong mạng None Broadcast khi 1 máy tính truyền frame thì chỉ có node cần nhận mới lắng nghe và nhận được frame đó, các node còn lại thì không. Frame được truyền qua 1 virtual Circuit hoặc 1 thiết bị chuyển mạch.
- Star topology có thể được coi như là 1 mạng Hub and Spoke.
4. Giải quyết vấn đề với Routing Updates mà không disable Split Horizal
Giải pháp dùng Sub-interface
R(config)#interface s0/0
R(config-if)#encapsulation frame-relay
R(config-if)interface s0/0.1 [multipoint| point-to-point]
- point-to-point: Mỗi subinterface có subnet riêng của mình. Broadcast và Split horizol không là vấn đề.
- Multi-point: Tất cả các subinterface liên quan phải cùng chung 1 subnet và như vậy Broadcast và Split horizol sẽ có vấn đề.
Ví dụ:
(Point-to-point)
R(config)#interface s0/0
R(config-if)#encapsulation frame-relay
R(config-if)#interface s0/0.1 point-to-point
R(config-subif)#frame-relay interface-dlci 18
(Multipoint)
R(config)#interface s0/0
R(config-if)#encapsulation frame-relay
R(config-if)#interface s0/0.2 multipoint
R(config-subif)#frame-relay interface-dlci 19
R(config-subif)#frame-relay interface-dlci 20
5. Cấu hình trên Frame-relay Switching (ví dụ)
R(config)#frame-relay switching
R(config)#interface s0/0
R(config-if)#encapsulation frame-relay
R(config-if)#frame-relay intf-type dce
R(config-if)#frame-relay route 103interface serial 0/1 301