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

Thursday, October 16, 2008

Enable/Configure DHCP Snooping in Cisco Catalyst Switches (IOS)

DHCP snooping is a DHCP security feature that provides security by filtering untrusted DHCP messages and by building and maintaining a DHCP snooping binding table. An untrusted DHCP message is a message that is received from outside the network or firewall causing denial of service attacks.

The DHCP snooping binding table contains the MAC address, IP address, lease time, binding type, VLAN number, and interface information that corresponds to the local untrusted interfaces of a switch. An untrusted interface is an interface that is configured to receive messages from outside the network or firewall. A trusted interface is an interface that is configured to receive only messages from within the network.

DHCP snooping can be enabled on the switch per vlan as it can intercept the DHCP messages at the layer2.

The following is a step by step procedure to enable and configure DHCP snooping in Cisco catalyst switches running Cisco IOS

Enable DHCP Snooping

ciscoswitch(config)# ip dhcp snooping

Enable DHCP Snooping on VLANs

DHCP snooping can be enabled on one or more VLANs or a range of VLANs

ciscoswitch(config)# ip dhcp snooping vlan number 100

The above enables dhcp snooping on VLAN 100

To enable on more VLANs

ciscoswitch(config)# ip dhcp snooping vlan number 10-15 100 110

where the DHCP snooping is enabled on VLAN 10-15, 100 and 110

Enable DHCP Option 82

This allows DHCP option 82 message insertions into the packets. Option 82 is the Relay Agent Information Option as described in RFC 3046

ciscoswitch(config)# ip dhcp snooping information option

Configure Trust Interface

Interface not explcicitly configured as a trust interface is treated as an untrusted interface.

ciscoswitch(config)# interface fa0/0

ciscoswitch(config-if)# ip dhcp snooping trust

DHCP Snooping Rate limiting (optional)

Rate limiting allows restricting the number of DHCP packets per second (pps) that an interface can receive

ciscoswitch(config-if)# ip dhcp snooping limit rate 202

Where "202" indicates that the interface can receive "202" messages per second

This should configure DHCP Snooping on Cisco IOS switches.

Display DHCP Snooping

ciscoswitch# show ip dhcp snooping
DHCP Snooping is configured on the following VLANs:
10-15 100 110
Insertion of option 82 information is enabled.
Interface Trusted Rate limit (pps)
——— ——- —————-
FastEthernet2/1 yes 10
FastEthernet2/2 yes none
FastEthernet3/1 no 20

Display DHCP Snooping Binding Table

ciscoswitch# show ip dhcp snooping binding
MacAddress IP Address Lease (seconds) Type VLAN Interface
———– ———– —————- —– —– ————
0000.0100.0201 10.0.0.1 1600 dynamic 100 FastEthernet2/1

2 Comments so far »

  1. by Tawfiq, on May 29 2008 @ 1:21 pm

    Thanks to him who is written this document -
    -he is describe easily here what is
    dhcp snooping and how to implement this security feature
    its a brilliant do doubt -

  2. by Cisco.zephyr, on July 29 2008 @ 10:52 am

    This was straight to the point and gave just enough references to follow up for my own reasoning and thoughts.
    Thank you for a (as the other person commented)Brilliant simplistic configuration.

How to create VLAN Interfaces for InterVLAN Routing in Cisco IOS

How to create VLAN Interfaces for InterVLAN Routing in Cisco IOS
Posted on Jul 01, 2008 under Cisco |

Tags:Cisco cisco-switch InterVLAn-Routing ios router switch vlan

VLAN Interfaces are required in network scenarios where you have different VLANs and need Inter-VLAN switching on Layer3 (Routing capable) switches. Every VLAN that needs to be routed should have a VLAN interface.

Let's say we have VLAN 10 which hosts the subnet 192.168.10.0 subnet, VLAN hosts 192.168.20.0 subnet and VLAN 30 hosts 192.168.30.0 subnet. For Inter-VLAN routing to work, we need to have a VLAN interface setup for each of these VLANs and configured with an IP address from the same subnet which will be the default Gateway for that subnet. Lets say, 192.168.10.254,192.168.20.254.192.168.30.254 are the IP addresses for VLAN Interfaces of VLAn 10,20,30 respectively.

Assuming the VLANs are configured already, let's proceed to get the VLAN interfaces created.

Enable Routing on the Switch

ciscoswitch# conf t

ciscoswitch(config)# ip routing

Add VLAN Interface

ciscoswitch(config)# interface vlan10

ciscoswitch(config-if)# no shut

ciscoswitch(config-if)# ip address 192.168.10.0 255.255.255.0

This configures a VLAN interface for VLAN 10.

Default Route on Switch

Add a default route on the Switch. This will forward all traffic from the different VLANs to the default router.

ciscoswitch(config)#ip route 0.0.0.0 0.0.0.0 192.168.100.1

Interface to the Router

If the switch cannot reach the default router through a VLAN then an interface that connects to the router which does these routing needs to configured as a routed interface and assigned with an IP address that is in the same subnet as that of the Default router.

ciscoswitch(config)# interface gi0/1

ciscoswitch(config-if)# no shut

ciscoswitch(config-if)# no switchport

ciscoswitch(config-if)# ip address 192.168.100.2 255.255.255.0

This makes the inerface as a routed interface and assigns an IP address in the same subnet as the default router.
Related Posts

* Unable to delete Stale/Obsolete statc routes in Cisco IOS (Jul 03, 2008)
* High CPU usage when SNMP is enabled in Cisco Routers (Jun 19, 2008)
* Configure MD5 encrypted passwords for users on Cisco IOS (May 20, 2008)
* Enable/Configure DHCP Snooping in Cisco Catalyst Switches (IOS) (May 15, 2008)
* Allow user view Running/Startup-Config (red-only) in Cisco IOS (May 12, 2008)

url:http://www.itsyourip.com/cisco/how-to-create-vlan-interfaces-for-intervlan-routing-in-cisco-ios/

Configure Cisco Port Security on Switches and Router interface

Configure Cisco Port Security on Switches and Router interface
Posted on Dec 04, 2007 under Cisco, Security |

Tags:Cisco ios mac-address port-security router Security switch

Cisco Port Security is a features that can help secure access to the physical network. Any Network admins nightmare is an unauthorised device or a PC connecting to the network. This could be as simple as an innocent guest plugging his PC into a floor port hoping to get an internet connection or a malicious intruder connecting to the network trying to gain access to confidential information.

Consequences could as bad as

* Virus, Spyware or malware infection from a PC unprotected PC
* A malicious hacker or an intruder gaining access to the network
* A malicous attacker launching a Denial of Service attack using MAC Address flooding

Cisco IOS has the port-security feature which can be used to restrict the MAC-Address of the devices that connects to each of the physical switchports.

Cisco Port-Security can help to

* restrict the MAC-address or addresses that can connect through a switchport [default: first connected device MAC Address]
* restrict the number of MAC-Addresses that can connect through a switchport [default is 1 and maximum is 128]
* set aging in minutes of the MAC Addresses registed
* Action to take when there is a violation detected (default is to disable the port and send an SNMP Trap message to the SNMP management server (if any))

For a switch port to be security enabled,

* the switchport cannot be a Trunk Port
* the switchport cannot be a destination port for a Switchport Analyzer (SPAN)
* the switchport cannot belong to an EtherChannel port-channel interface
* the switchport cannot be an 802.1X port

If you try to enable 802.1X on a secure port, an error message appears, and 802.1X is not enabled. If you try to change an 802.1X-enabled port to a secure port, an error message appears, and the security settings are not changed.

To enable Port Security on a Cisco Switch or router interface

Enter the interface config mode (say fa0/1)

Switch# conf t

Switch(config)# interface fastethernet 0/1

Switch(config-if)# switchport mode access

This sets the switchport to access mode. Default mode of "Dynamic desirable" cannot be configured as a secure port

Switch(config-if)# switchport port-security

This enables the port security on the switchport with the defaults [1 MAC Address allowed, 1st connected MAC Address, disable port if there is a violation]

If you know the MAC Address of the device and that thats the only device that connects to the swicthport (for example, A server on a Serverfarm switch) then you can set the MAC-Address manually.

Switchport(config-if)# switchport port-security mac-address 1111.2222.3333

Where 1111.2222.3333 is the MAC Address of the server. This will disable the secure port, if any other device other than the one with the above MAC-Address connects to the switch port.

If there is a switch or a hub (say 12 port or a 24 port) that connects to the switchport which you want to secure then you can set the maximum number of MAC-Addresses that connects to the port and/or set the MAC-Address optionally.

Switchport(config-if)# switchport port-security max 12

This sets the maximum number of mac-address allowed on the secure port (default is 128).

One step further, if you want to manually add some or all of these MAC-Addresses then you can specify using the following command one for each MAC-Address

Switchport(config-if)# switchport port-security mac-address 0000.0000.0000

Switchport(config-if)# switchport port-security mac-address 0000.0000.1111

If now, you need to set the maximum number of MAC Addresses on the switchport but are aware that some or most of them are temporary ones (guest users or temporary workers) then you can set the aging time on the port-security which allows MAC-Addresses on the Secure switchport will be deleted after the set aging time. This helps to avoid a situation where obsolete MAC-Address occupy the table and saturates causing a violation (when the max number exceeds).

Switchport(config-if)# switchport port-security aging time 10

Where time is specified in minutes (10 mins in the above)

Now, you can set the action to be taken when there is a violation. The default is to shutdown the port and mark the port err-disabled.

For example,

Switchport(config-if)# switchport port-security violation protect

Where protect is the action taken when a violation event is triggered.

The actions are

protect — Drops packets with unknown source addresses until you remove a sufficient number of secure MAC addresses to drop below the maximum value.

restrict — Drops packets with unknown source addresses until you remove a sufficient number of secure MAC addresses to drop below the maximum value and causes the Security Violation counter to increment.

shutdown (default) — Puts the interface into the error-disabled state immediately and sends an SNMP trap notification.

To show the port-security,

Switch# show port-security interface fastethernet 0/1
Security Enabled:Yes, Port Status:SecureUp
Violation Mode:Shutdown
Max. Addrs:5, Current Addrs:0, Configure Addrs:0

To display port-security info without any interface provided

Switch# show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation Security
Action
(Count) (Count) (Count)
—————————————————————————-
Fa0/1 11 11 0 Shutdown
Fa0/2 15 5 0 Restrict
Fa0/3 5 4 0 Protect
—————————————————————————-
Total Addresses in System: 21
Max Addresses limit in System: 128

To display the security MAC-Address table

Switch# show port-security address
Secure Mac Address Table
——————————————————————-
Vlan Mac Address Type Ports Remaining Age
(mins)
—- ———– —- —– ————-
1 0001.0001.0001 SecureDynamic Fa0/1 15 (I)
1 0001.0001.0002 SecureDynamic Fa0/1 15 (I)
1 0001.0001.0003 SecureConfigured Fa0/1 16 (I)
1 0001.0001.0004 SecureConfigured Fa0/1 -
1 0001.0001.0005 SecureConfigured Fa0/1 -
1 0005.0005.0006 SecureConfigured Fa0/5 23
1 0005.0005.0007 SecureConfigured Fa0/5 23
1 0005.0005.0008 SecureConfigured Fa0/5 23
1 0011.0011.0009 SecureConfigured Fa0/11 25 (I)
1 0011.0011.0010 SecureConfigured Fa0/11 25 (I)
——————————————————————-
Total Addresses in System: 10
Max Addresses limit in System: 128

For more information, check this Cisco documentation

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Related Posts

* Unable to delete Stale/Obsolete statc routes in Cisco IOS (Jul 03, 2008)
* How to create VLAN Interfaces for InterVLAN Routing in Cisco IOS (Jul 01, 2008)
* High CPU usage when SNMP is enabled in Cisco Routers (Jun 19, 2008)
* Configure MD5 encrypted passwords for users on Cisco IOS (May 20, 2008)
* Enable/Configure DHCP Snooping in Cisco Catalyst Switches (IOS) (May 15, 2008)

Tuesday, October 7, 2008

Adding a Cisco switch to a VTP domain

Adding a Cisco switch to a VTP domain
By James on October 16, 2007
757 views
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Categories: Cisco Tags: IOS

Adding a switch to a VTP domain is fairly easy to do, but done incorrectly, can bring down a whole network. Fortunatly I have not had this happen to me, but I have heard horror stories. There are a few simple steps to take to make sure everything stays running smoothly.

The very first step to complete as soon as you are ready to put a new switch on a network and join it to the domain, is to make sure that the vtp mode is set to transparent. Setting the mode to transparent ensures that the “Configuration Revision” is set to 0. If the switch has been used in a lab and has vlans configured and a configuration revision that is higher than the domain server, even if the switch being added is in client mode, it will overwrite the server and propagate all of it’s vlans across the network.


This is directly taken from Cisco’s website:

A recently added switch can cause problems in the network. It can be a switch that was previously used in the lab, and a good VTP domain name was entered. The switch was configured as a VTP client and was connected to the rest of the network. Then, you brought the trunk link up to the rest of the network. In just a few seconds, the whole network can go down.

If the configuration revision number of the switch that you inserted is higher than the configuration revision number of the VTP domain, it propagates its VLAN database through the VTP domain.

This occurs whether the switch is a VTP client or a VTP server. A VTP client can erase VLAN information on a VTP server. You can tell this has occurred when many of the ports in your network go into the Inactive state but continue to assign to a nonexistent VLAN.

To make sure this does not happen, before you connect the switch to the network, make sure to set the vtp mode to transparent.
C3750-Client(config)#vtp mode transparent
C3750-Client(config)#exit
C3750-Client#show vtp status
C3750-Client#sh vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 1005
Number of existing VLANs : 7
VTP Operating Mode : Transparent
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0×18 0×17 0xE9 0×22 0×49 0×96 0×0C 0×7E
Configuration last modified by 10.10.10.20 at 3-1-93 00:03:25

Now that this switch won’t overwrite the server, configure the vtp domain and password, and then change the mode to client.
C3750-Client(config)#vtp domain Test
Changing VTP domain name from NULL to Test
C3750-Client(config)#vtp password Testpassword
C3750-Client(config)#vtp mode client
Setting device to VTP CLIENT mode

Show the vtp status to confirm.
C3750-Client#show vtp status
VTP Version : 2
Configuration Revision : 62
Maximum VLANs supported locally : 1005
Number of existing VLANs : 38
VTP Operating Mode : Client
VTP Domain Name : Test
VTP Pruning Mode : Enabled
VTP V2 Mode : Enabled
VTP Traps Generation : Disabled
MD5 digest : 0xCD 0×9D 0xFF 0xC3 0×6F 0×63 0×5F 0xF5
Configuration last modified by 10.10.10.2 at 10-16-07 22:16:43

And then a show vlan and check the output to make sure all the vlans have propagated.
C3750-Client#show vlan

The only rule you really need when adding switches is to make sure the switch is in TRANSPARENT mode first.


url:http://jklogic.net/adding-a-cisco-switch-to-a-vtp-domain/

Monday, October 6, 2008

How to configure a Cisco Catalyst switch to act as a DHCP relay agent

How to configure a Cisco Catalyst switch to act as a DHCP relay agent
How to configure a Cisco Catalyst switch to act as a DHCP relay agent in the following Cisco Catalyst switches:
2940 - 2970 - 3550 - 3560 - 3750 - 4000 - 4500 - 6000 - 6500
Relay agents are used to forward requests and replies between clients and servers when they are not on the same physical subnet.
Relay agent forwarding is distinct from the normal forwarding of an IP router, where IP datagrams are switched between networks somewhat transparently.
Relay agents receive Dynamic Host Configuration Protocol (DHCP) messages and then generate a new DHCP message to send out on another interface.
The 2900XL, 2950 and 3500XL switches cannot be configured as a DHCP helper, or DHCP relay.
This requires a router or a switch with a Layer 3 capability that can do InterVLAN routing.
These switches are Layer 2 devices, which can only do DHCP snooping.
The ip helper-address command is present on a configurable Layer 3 interface.
The general rule is to configure the command on the Layer 3 interface closest to the client.
In order configure a Cisco Catalyst switch to act as a DHCP relay agent, issue the ip helper-address command in interface configuration mode and specify the IP address of the DHCP server on the remote subnet.
This ensures that all DHCP broadcasts are forwarded to that address.
More than one helper address can be configured per interface.
You may also wish to investigate:
Understanding and Troubleshooting DHCP in Catalyst Switch or Enterprise Networks

Thursday, October 2, 2008

Tất cả các lệnh cấu hình trong CCNA theo chuyên mục

Phần 1. Routing - Định Tuyến (Các giao thức phức tạp)
OSPF.

Note: Tất cả những router có cùng area phải cấu hình giống nhau tất cả các thông số thì khu vực đó mới hoạt động đúng chức năng được.

1. Cấu hình cơ bản

Router(config)#router ospf process ID
Router(config-router)#network Network_number Wildcard_mask area_ID

2. Cấu hình priority ở các interface để bầu DR và BDR

Priority càng lớn thì khả năng được bầu làm DR càng cao, ngược với bầu Root brige của Switch, càng nhỏ thì lại càng được bầu.

Router(config)#interface fastethernet 0/0
Router(config-int)#ip ospf priority 55

Sau khi cấu hình xong priority có thể kiểm tra bằng lệnh.

Router# show ip ospf interface f0/0

3. Chỉnh sửa lại OSPF cost metric trong mỗi interface

Cost càng nhỏ thì tuyến đó càng được coi là best path

Router(config-int)#ip ospf cost 1

4.Cấu hình OSPF Authentication ở các interface và áp dùng vào router

Authentication key được hiểu như là password để các router trong cùng một vùng chia sẻ với nhau.

a.Cấu hình authentication đơn giản

Router(config-if)#ip ospf authentication-key password
Router(config-router)#area area number authentication

b.Cấu hình authentication theo dạng mã hoá, bảo mật cao.

Router(config-if)ip ospf message-digest-key key ID md5 encryption-type key
Router(config-router)#area area ID authentication message-digest

5.Cấu hình OSPF timer trong các interface

Router(config-if)ip ospf hello-interval timer
Router(config-if)ip ospf dead-interval timer

6.Cấu hình quảng bá một tuyến mặc định trong OSPF

Router(config-router)#default-information originate

7.Quảng bà một tuyến khác (không phải là default)

Router(config-router)#redistribute protocols subnets

8.Các lệnh show dùng để kiểm tra cấu hình OSPF

show ip protocol
show ip route
show ip ospf
show ip ospf interface
show ip ospf database
show ip ospf neighbor detail
clear ip route *
debug ip ospf events
debug ip ospf adj

EIGRP

1.Cấu hình cơ bản.

Router(config)#router eigrp autonomous number
Router(config-router)#network network number
Router(config-router)#eigpr log-neighbor-changes (Không có cũng được)
Router(config-router)#no auto-summary

2.Thay đổi băng thông và tự tổng hợp tuyến trong interface

Router(config-if)#bandwidth kilobits
Router(config-if)#ip summary-address protocol AS network number subnets mask

3.Cân bằng tải trong EIGRP

Router(config-router)#variance number

4.Quảng bá default route

Cách 1:
Router(config)#ip route 0.0.0.0 0.0.0.0 [interface/nexthop]
Router(config)#redistribute static

Cách 2:
Router(config)#ip default-network network number

Cách 3:
Router(config-if)#ip summary-network eigrp AS number 0.0.0.0 0.0.0.0

5.Quảng bá các tuyến khác trong EIGRP (không phải là default)

Router(config-router)#redistribute protocol process ID metrics k1 k2 k3 k4 k5
Ex: Router(config-router)#redistribute ospf metrics 100 100 100 100 100

6.Chia sẻ traffic trong EIGRP

Router(config-router)#traffic share {balanced/min}

7.Các lệnh kiểm tra cấu hình EIGRP

- show ip eigrp neighbor
- show ip eigrp interface
- show ip eigrp topology
- show ip eigrp traffic
- debug eigrp fsm
- debug eigrp packet

Phần 2. 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

Phần 3. 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 192.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

Phần 4. NAT – PPP – Frame Relay

I.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

*
o 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

*
o 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


(Theo [Chỉ có thành viên của diễn đàn mới xem được nội dung của liên kết này. ] Moderator)