You are on page 1of 971

Tổng quan về quản trị mạng

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Quy trình xây Lập kế hoạch Vận hành và
Triển khai hệ
dựng hệ và thiết kế hệ
thống
thống
quản trị hệ
thống
thống mạng

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


• Đảm bảo hệ thống hoạt động thông suốt
Mục tiêu của • Tăng cường an ninh/ an toàn thông tin
Quản trị Mạng • Khai thác hiệu quả tài nguyên chung

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


• Quản trị sự cố (Fault Management)
Các công việc • Quản trị cấu hình (Configuration Management)
của Quản trị • Quản trị bảo mật (Security Management)
• Quản trị hiệu năng (Performance Management)
Mạng • Quản trị thống kê (Accounting Management)

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Quản trị sự cố
• Phát hiện lỗi trong hệ thống
• Cô lập lỗi
• Khắc phục lỗi
• Sửa chữa triệt để lỗi
• Liên tục giám sát/ kiểm soát các lỗi phát sinh

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Quản trị cấu hình
• Kiểm soát cấu hình/ sơ đồ kết nối các thiết bị
triển khai trong hệ thống
• Cập nhật cấu hình/ sơ đồ các thiết bị mới
• Lựa chọn cấu hình ổn định, thỏa mãn các yêu
cầu cụ thể
• Khi xảy ra lỗi phải có phương án trả về cấu
hình chạy tốt gần nhất
• Kiểm soát các hành động thay đổi cấu hình
thiết bị

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Quản trị bảo mật
• Xác định các tài nguyên quan trọng trong hệ
thống
• Xây dựng các chính sách bảo mật/ quyền truy
cập tài nguyên
• Phối hợp: bảo mật ra vào khu làm việc, bảo
mật truy cập máy tính, bảo mật ứng dụng …
để tạo ra 1 hệ thống bảo mật hoàn chỉnh
• Giám sát, cập nhật các trạng thái cảnh báo về
bảo mật

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Quản trị hiệu năng
• Giám sát tài nguyên/ năng lực hoạt động của
thiết bị
• Phân tích điểm nghẽn hệ thống
• Đưa ra ngưỡng tài nguyên cho các thiết bị, để
khi thiết bị hoạt động quá ngưỡng phải kịp
thời nâng cấp, tránh quá tải làm gián đoạn hệ
thống

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Quản trị thống kê
• Ánh xạ quyền truy cập hệ thống theo quyền
của mỗi đối tượng
• Thống kê các đối tượng vào – ra hệ thống: khi
nào, làm gì, bao lâu?
• Cung cấp thông tin cho việc tính cước nếu là
nhà cung cấp dịch vụ

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Mô hình Quản trị Mạng

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Các nguồn thông tin quản trị

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


• Giao thức được phát triển cho việc
quản trị mạng thông dụng là SNMP
SNMP (Simple
Protocol)
Network Management
SNMP (tt)
• SNMP sử dụng UDP (ngầm
định) hoặc TCP để gửi/ nhận
các thông điệp với các cổng
161 và 162

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


SNMP – Cơ sở thông tin quản trị (MIB)

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


SNMP – Các loại biến MIB

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


Hỏi và đáp

Nguyễn Tấn Khôi - Nguyễn Thế Xuân Ly


WINDOWS SERVER 2012

Bài 2
ACTIVE DIRECTORY
Nội dung bài học
➢Các mô hình mạng trong môi trường
Microsoft
➢Active Directory
➢Cài đặt và cấu hình Active Directory
Các mô hình mạng
➢Mô hình Workgroup
▪ Mô hình Workgroup còn gọi là mô hình peer to
peer.
▪ Các máy tính trong mạng có vai trò như nhau.
▪ Thông tin tài khoản người dùng được lưu
trong tập tin SAM (Security Accounts
Manager) trên mỗi máy cục bộ.
▪ Quá trình chứng thực cho người dùng đăng
nhập diễn ra tại máy cục bộ mà user đăng
nhập.
Các mô hình mạng (t.t)
➢Mô hình Domain
▪ Hoạt động theo cơ chế client-server
▪ Có ít nhất một server làm chức năng điều
khiển vùng (Domain Controller).
▪ Thông tin người dùng được quản lý bởi dịch
vụ Active Directory và được lưu trữ trên
Domain Controller với tên tập tin là NTDS.DIT.
▪ Quá trình chứng thực cho người dùng đăng
nhập diễn ra tập trung tại máy Domain
Controller.
Mô hình Domain (t.t)
➢Quá trình chứng thực cho người dùng
Active Directory
➢Giới thiệu Active Directory
➢Chức năng của Active Directory
▪ Lưu giữa các thông tin người dùng và máy
tính
▪ Đóng vai trò chứng thực (Authentication
server) và quản lý đăng nhập (Logon server)
▪ Duy trì bản chỉ mục (Index) giúp cho quá trình
tìm kiếm tài nguyên mạng nhanh hơn
▪ Cho phép tạo ra nhiều tài khoản người dùng
với mức độ quyền (user right) khác nhau.
▪ Chia nhỏ domain thành nhiều subdomain hay
OU (Organizational Unit)
Active Directory (t.t)
➢Directory Service
▪ Giới thiệu Directory Service
▪ Các thành phần trong Directory Service
• Object (Đối tượng)
• Attribute (Thuộc tính)
• Schema (Cấu trúc tổ chức)
• Container (Vật chứa)
– Domain
– Site
– OU (Organizational Unit)
• Global catalog
Active Directory (t.t)
➢Kiến trúc của Active Directory
Kiến trúc của Active Directory

➢Objects
▪ Các khái niệm liên quan
• Object classes: Các Object classes thông dụng là
User, Computer, Printer
• Attributes: là tập hợp các giá trị phù hợp và được
gắn kết với một đối tượng cụ thể.
Kiến trúc của Active Directory

➢Organizational Units
▪ OU là đơn vị nhỏ nhất trong hệ thống AD
▪ Hai công dụng của OU
• Trao quyền kiểm soát một tập hợp tài khoản người
dùng, máy tính hay các thiết bị mạng cho một hoặc
một nhóm phụ tá quản trị viên (sub-administrator)
để giảm bớt gánh năng cho Administrator
• Kiểm soát và khoá bớt một số chức năng trên máy
trạm thông qua chính sách nhóm (Group Policy
Object)
Kiến trúc của Active Directory

➢Organizational Units
Kiến trúc của Active Directory

➢Domain
▪ Domain là đơn vị chức năng nòng cốt của cấu
trúc logic Active Diretory
▪ Ba chức năng của domain
• Đóng vai trò như một khu vực quản trị
(administrative boundary) các đối tượng.
• Giúp chúng ta quản lý bảo mật các tài nguyên chia
sẻ.
• Cung cầp các server dự phòng làm chức năng điều
khiển vùng (domain controller) và đảm bảo thông
tin trên các server này đồng bộ với nhau
Kiến trúc của Active Directory

➢Domain: cập nhật thông tin giữa các DC


Kiến trúc của Active Directory

➢Domain Tree
• Là cấu trúc bao gồm nhiều domain được sắp xếp
có cấp bậc theo cấu trúc hình cây.
Kiến trúc của Active Directory

➢Forest
• Forest (rừng) được xây dựng trên một hoặc nhiều
Domain Tree, nói cách khác Forest là tập hợp các
Domain Tree có thiết lập quan hệ và ủy quyền cho
nhau.
Lab 1 - Cài đặt và cấu hình
Active Directory
➢Nâng cấp server thành Domain Controller
➢Gia nhập máy trạm vào Domain
➢Cài đặt và cấu hình Additional Domain
Controller
➢Cài đặt và cấu hình Child Domain
Hỏi và đáp
WINDOWS SERVER 2012
Bài 3
QUẢN LÝ TÀI KHOẢN
NGƯỜI DÙNG VÀ NHÓM
Nội dung bài học
➢Tài khoản người dùng và tài khoản nhóm
➢Chứng thực và kiểm soát truy cập
➢Các tài khoản tạo sẵn
➢Quản lý tài khoản người dùng và nhóm
cục bộ
➢Quản lý tài khoản người dùng vá nhóm
trên Active Directory
Định nghĩa tài khoản người
dùng và tài khoản nhóm
➢Tài khoản người dùng
▪ Tài khoản người dùng cục bộ
Tài khoản người dùng (t.t)
▪ Tài khoản người dùng miền
Tài khoản người dùng (t.t)
▪ Yêu cầu tài khoản người dùng
• Username: dài 1-20 ký tự (từ Windows Server 2003
trở đi, username có thể dài 104 ký tự, tuy nhiên khi
đăng nhập từ các máy cài hệ điều hành Windows
NT 4.0 về trước thì mặc định chỉ hiểu 20 ký tự )
• Username là một chuổi duy nhất
• Username không chứa các ký tự sau: “ / \ [ ] : ; | = ,
+*?<>”
• Username có thể chứa các ký tự đặc biệt: dấu
chấm câu, khoảng trắng, dấu gạch ngang, dấu gạch
dưới.
Định nghĩa tài khoản người
dùng và tài khoản nhóm (t.t)
➢Tài khoản nhóm
▪ Nhóm bảo mật (Security group)
• Nhóm bảo mật được dùng để cấp phát các quyền
hệ thống (rights) và quyền truy cập (permission).
• Mỗi nhóm bảo mật có một SID riêng.
• Có 4 loại nhóm bảo mật: local (nhóm cục bộ),
domain local (nhóm cục bộ miền), global (nhóm
toàn cục hay nhóm toàn mạng) và universal (nhóm
phổ quát).
▪ Nhóm phân phối (distribution group).
• Nhóm phân phối là nhóm phi bảo mật, không có
SID và không xuất hiện trong ACL (Access Control
List).
Tài khoản nhóm (t.t)
➢ Qui tắt gia nhập nhóm
▪ Tất cả các nhóm Domain Domain Locals
local, Global, Universal đều
có thể đặt vào trong nhóm
Machine Local.
Machine Locals Globals
▪ Tất cả các nhóm Domain
local, Global, Universal đều
có thể dặt vào trong chính
loại nhóm của mình. Universals
▪ Nhóm Global và Universal
có thể đặt vào trong nhóm
Domain local.
▪ Nhóm Global có thể đặt vào
trong nhóm Universal.
Chứng thực và kiểm soát
truy cập
➢Các giao thức chứng thực
▪ Quy trình chứng thực: đăng nhập tương tác
và chứng thực mạng.
▪ Kerberos V5: là giao thức chuẩn Internet dùng
để chứng thực người dùng và hệ thống.
▪ NT LAN Manager (NTLM): là giao thức chứng
thực chính của Windows NT.
▪ Secure Socket Layer/Transport Layer Security
(SSL/TLS): là cơ chế chứng thực chính được
dùng khi truy cập vào máy phục vụ Web an
toàn.
Chứng thực và kiểm soát
truy cập (t.t)
➢Kiểm soát truy cập của đối tượng
▪ Người dùng, nhóm, máy tính, các tài nguyên
mạng đều được định nghĩa dưới dang các đối
tượng.
▪ Kiểm soát truy cập dựa vào bộ mô tả đối
tượng ACE (Access Control Entry)
▪ Một ACL (Access Control List) chứa nhiều
ACE, nó là danh sách tất cả người dùng và
nhóm có quyền truy cập đến đối tượng.
➢Số nhận diện bảo mật SID (Security
Identifier)
▪ SID có dạng chuẩn “S-1-5-21-D1-D2-D3-RID”
Các tài khoản tạo sẵn
➢Các tài khoản người dùng tạo sẵn
▪ Administrator
▪ Guest
▪ ILS_Anonymous_User
▪ IUSR_computer-name
▪ IWAM_computer-name
▪ Krbtgt
▪ TSInternetUser
Các tài khoản tạo sẵn (t.t)
➢ Tài khoản nhóm Domain Local tạo sẵn
▪ Administrators
▪ Account Operators
▪ Domain Controllers
▪ Backup Operators
▪ Guests
▪ Print Operator
▪ Server Operators
▪ Users
▪ Replicator
▪ Incoming Forest Trust Builders
▪ Network Configuration Operators
▪ Pre-Windows 2000 Compatible Access
▪ Remote Desktop User
▪ Performace Log Users
▪ Performace Monitor Users
Các tài khoản tạo sẵn (t.t)
➢Tài khoản nhóm Global tạo sẵn
▪ Domain Admins
▪ Domain Users
▪ Group Policy Creator Owners
▪ Enterprise Admins
▪ Schema Admins
Các tài khoản tạo sẵn (t.t)
➢Các nhóm tạo sẵn đặc biệt
▪ Interactive
▪ Network
▪ Everyone
▪ System
▪ Creator owner
▪ Authenticated users
▪ Anonymous logon
▪ Service
▪ Dialup
Quản lý tài khoản người dùng
và nhóm cục bộ
➢Công cụ quản lý tài khoản người dùng cục
bộ
▪ Dùng công cụ Local Users and Groups
▪ Có 2 phương thức truy cập đến công cụ Local
Users and Groups
• Dùng như một MMC (Microsoft Management
Console) snap-in.
• Dùng thông qua công cụ Computer Management
▪ Các bước chèn Local Local Users and Groups
snap-in vào trong MMC. (Thực hành)
Quản lý tài khoản người dùng
và nhóm cục bộ (t.t)
➢Quản lý tài khoản người dùng cục bộ
▪ Tạo tài khoản mới
▪ Xoá tài khoản
▪ Khoá tài khoản
▪ Đổi tên tài khoản
▪ Thay đổi mật khẩu
➢Quản lý tài khoản nhóm cục bộ
▪ Tạo tài khoản nhóm
▪ Xoá tài khoản nhóm
▪ Thêm người dùng vào nhóm
Quản lý tài khoản người dùng
và nhóm trên Active Directory
➢Công cụ quản lý tài khoản người dùng
trên Active Directory
▪ Công cụ Active Directory User and Computer
▪ Truy xuất công cụ Active Directory User and
Computer thông qua MMC
➢Quản lý tài khoản người dùng
▪ Tạo tài khoản mới
▪ Xoá tài khoản
▪ Khoá tài khoản
▪ Đổi tên tài khoản
▪ Thay đổi mật khẩu
Quản lý tài khoản người dùng
và nhóm trên Active Directory
➢Quản lý tài khoản nhóm trên Active
Directory
▪ Tạo tài khoản nhóm
▪ Xoá tài khoản nhóm
▪ Thêm người dùng vào nhóm
▪ Gia nhập nhóm vào nhóm
Quản lý tài khoản người dùng
và nhóm trên Active Directory
➢Các thuộc tính của tài khoản người dùng
▪ Tab General
▪ Tab Address
▪ Tab Telephones
▪ Tab Organization
▪ Tab Account
▪ Tab Profile
▪ Tab Member of
▪ Tab Dial-in
Quản lý tài khoản người dùng
và nhóm trên Active Directory
➢ Các tùy chọn liên quan đến tài khoản người
dùng
User must change Người dùng phải thay đổi mật khẩu lần đăng nhập
password at next logon kế tiếp, sau đó mục này sẽ tự động bỏ chọn
User cannot change Nếu được chọn thì ngăn không cho người dùng tùy
password ý thay đổi mật khẩu.
Password never expires Nếu được chọn thì mật khẩu của tài khoản này
không bao giờ hết hạn.
Store password using Chỉ áp dụng tùy chọn này đối với người dùng đăng
reversible encryption nhập từ các máy Apple.
Account is disabled Nếu được chọn thì tài khoản này tạm thời bị khóa,
không sử dụng được.
Smart card is required Tùy chọn này được dùng khi người dùng đăng nhập
for interactive login vào mạng thông qua một thẻ thông minh (smart
card), lúc đó người dùng không nhập username và
password mà chỉ cần nhập vào một số PIN.
Quản lý tài khoản người dùng
và nhóm trên Active Directory
➢ Các tùy chọn liên quan đến tài khoản người
dùng
Account is trusted for Chỉ áp dụng cho các tài khoản dịch vụ nào cần
delegation giành được quyền truy cập vào tài nguyên với vai
trò những tài khoản người dùng khác.
Account is sensitive Dùng tùy chọn này trên một tài khoản khách vãng lai
and cannot be hoặc tạm để đảm bảo rằng tài khoản đó sẽ không
delegated được đại diện bởi một tài khoản khác.
Use DES encryption Nếu được chọn thì hệ thống sẽ hỗ trợ Data
types for this account. Encryption Standard (DES) với nhiều mức độ khác
nhau.
Do not require Kerberos Nếu được chọn hệ thống sẽ cho phép tài khoản này
preauthentication dùng một kiểu thực hiện giao thức Kerberos khác
với kiểu của Windows Server 2003 trở lên.
Quản lý tài khoản người dùng
và tài khoản nhóm
➢Quản lý tài khoản người dùng và tài khoản
nhóm bằng dòng lệnh
▪ Lệnh net user: tạo thêm, hiệu chỉnh và hiển thị
thông tin của các tài khoản người dùng.
▪ Cú pháp:
• net user [username [password | *] [options]]
[/domain]
• net user username {password | *} /add [options]
[/domain]
• net user username [/delete] [/domain]
Quản lý tài khoản người dùng
và tài khoản nhóm (t.t)
➢Quản lý tài khoản người dùng và tài khoản
nhóm bằng dòng lệnh (t.t)
▪ Lệnh net group: tạo mới thêm, hiển thị hoặc
hiệu chỉnh nhóm toàn cục.
▪ Cú pháp:
• net group [groupname [/comment:"text"]] [/domain]
• net group groupname {/add [/comment:"text"] |
/delete} [/domain]
• net group groupname username[ ...] {/add | /delete}
[/domain]
Quản lý tài khoản người dùng
và tài khoản nhóm (t.t)
➢Quản lý tài khoản người dùng và tài khoản
nhóm bằng dòng lệnh (t.t)
▪ Lệnh net localgroup: thêm, hiển thị hoặc hiệu
chỉnh nhóm cục bộ.
▪ Cú pháp:
• net localgroup [groupname [/comment:"text"]]
[/domain]
• net localgroup groupname {/add [/comment:"text"] |
/delete} [/domain]
• net localgroup groupname name [ ...] {/add | /delete}
[/domain]
Quản lý tài khoản người dùng
và tài khoản nhóm (t.t)
➢ Quản lý tài khoản người dùng và tài khoản nhóm
bằng dòng lệnh (t.t)
▪ Lệnh dsadd user, dsmod user: tạo mới, chỉnh sửa tài
khoản người dùng.
▪ Các ví dụ:
• dsmod user "CN=Don Funk,CN=Users,DC=Microsoft,
DC=Com" -pwd A1b2C3d4 -mustchpwd yes
• dsmod user "CN=Don Funk,CN=Users,DC=Microsoft,
DC=Com" "CN=Denise Smith,CN=Users,DC=Microsoft,
DC=Com" -pwd A1b2C3d4 -mustchpwd yes
• dsmod user "CN=Don Funk,CN=Users,DC=Microsoft,
DC=Com" "CN=Denise Smith,CN=Users,DC=Microsoft,
DC=Com" -disabled yes
• dsmod user "CN=Don Funk,CN=Users,DC=Microsoft,
DC=Com" -pwd A1b2C3d4 -mustchpwd yes
Lab 2 - Xây dựng OU
➢Tạo và cấu hình tài khoản trên Domain
Controller
➢Tạo OU, Group, User và cấu hình ủy quyền
quản trị OU
Lab 3 - LÀM VIỆC CÙNG
POWERSHELL
➢Tạo OU, tài khoản người dùng và nhóm
thông qua PowerShell
➢Sử dụng Powershell Script để tạo tài
khoản người dùng với số lượng lớn
Hỏi và đáp
WINDOWS SERVER 2012

Bài 4
CHÍNH SÁCH NHÓM
Nội dung bài học
➢Giới thiệu về chính sách nhóm (Group
Policy)
➢Triển khai một chính sách nhóm trên miền
➢Một số minh hoạ GPO trên người dùng và
cấu hình máy
Giới thiệu
➢So sánh giữa System Policy và Group
Policy:
▪ Chính sách nhóm chỉ xuất hiện trên miền AD
▪ Có nhiều chức năng hơn chính sách hệ thống
▪ Chính sách nhóm tự động huỷ bỏ tác dụng khi
được gở bỏ.
▪ Có thể áp dụng chính sách nhóm ở nhiều cấp
độ.
▪ Chỉ có thể áp dụng chính sách nhóm cho các
máy sử dụng HĐH Windows 2K trở lên.
Giới thiệu
➢Chức năng của Group Policy
▪ Triển khai phần mềm ứng dụng
▪ Gán các quyền hệ thống cho người dùng
▪ Giới hạn những ứng dụng mà người dùng
được phép thi hành
▪ Kiểm soát các thiết lập hệ thống
▪ Kiểm soát các kịch bản đăng nhập, đăng xuất,
khởi động, và tắt máy.
▪ Đơn giản hoá và hạn chế các chương trình
▪ Hạn chế tổng quát màn hình Desktop của
người dùng
Triền khai một chính sách nhóm
trên miền
➢Group Policy Object (GPO)
➢Để tạo GPO ta dùng Group Policy Object
Editor
Triền khai một chính sách nhóm
trên miền (t.t)
➢Xem chính sách cục bộ của một máy ở xa
▪ GPEDIT.MSC /gpcomputer: machinename
➢Tạo chính sách trên miền
▪ Có 2 cách truy xuất đến công cụ Group Policy
Object Editor:
• Start  Run  GPEDIT.MSC
• Active Directory Users and Computers Right
Click  Properties  tab Group Policy  Edit
Triền khai một chính sách nhóm
trên miền (t.t)
➢Group Policy Object Editor
Một số ví dụ
➢Khai báo một Logon Script dùng chính
sách nhóm
➢Chuyển hướng các thư mục
➢Hạn chế chức năng của Internet Explorer
➢Chỉ cho phép thi hành một số ứng dụng
(Xem Demo)
Hỏi và đáp
WINDOWS SERVER 2012
Bài 5
DOMAIN NAME SYSTEM (DNS)
Giới thiệu dịch vụ DNS

➢ DNS là dịch vụ quản lý tên miền.


➢ Dịch vụ DNS do Paul Mockapetris - USC's
Information Sciences Institute thiết kế,
➢ Hoạt động theo mô hình Client-Server.
➢ Cơ sở dữ liệu DNS được phân tán trên nhiều Name
Server.
➢ Hiệu suất sử dụng tăng nhờ cơ chế nhân
bản(replication) và lưu tạm(caching).
➢ Domain được phân bổ theo cơ chế phân cấp
tương tự như sự phân bổ trong hệ thống UNIX.
Giới thiệu dịch vụ DNS(t.t.)

Sơ đồ tổ chức DNS
Giới thiệu dịch vụ DNS(t.t.)

Các Top-Level Domain:

.com .vn
.org .us
.net .ca
.edu .jp
.gov .cn
.mil uk
.int
us
.arts
tw
.nom
.rec …

Giới thiệu dịch vụ DNS(t.t.)

Các thành phần trong dịch vụ DNS:

Resource Root “.”


Record
.com

.edu
Resource
Record
DNS Clients DNS Servers DNS Servers trên Internet
Truy vấn thông tin
➢ Truy vấn là quá trình gởi yêu cầu phân giải tên miền tới DNS
Server, có hai loại truy vấn : truy vấn đệ quy (recursive query)
và truy vấn tương tác (Iteractive query).
➢ DNS Client và DNS Server Khởi tạo Truy Vấn cho việc phân
giải tên miền.
➢ Authoritative DNS server sẽ thực hiện:
▪ Kiểm tra cache, kiểm tra zone, gởi IP address cho truy vấn.
➢ Non-authoritative DNS server sẽ thực hiện:
▪ Chuyển yêu cầu truy vấn không thể phân giải
đến Forwarder server.
▪ Sử dụng root hints server để trả lời cho truy vấn.
Recursive query

recursive query được gởi tới DNS server, trong đó DNS client
yêu cầu DNS server cung cấp đầy đủ thông tin cho truy vấn.

DNS server kiểm tra forward lookup zone và


cache để trả lời truy vấn

Recursive query for


mail1.yahoo.com

66.8.133.10 Database

Computer1 Local DNS Server


Interactive query
interative query là truy vấn được gởi tới DNS server trong đó
DNS client yêu cầu DNS server cung cấp thông tin tốt nhất mà
nó có chứ không tìm sự trợ giúp từ Name server khác. ACK của
interative query thường tham chiếu đến DNS server con trong
DNS tree.

Interative Query
Local Root Hint (.)
Ask .com 1
DNS Server

.com
2

3
Computer1 yahoo.com
Forwarder
forwarder cung cấp cơ chế chuyển yêu cầu truy vấn cho
internal DNS servers ra ngoài external DNS server

Iterative Query
Forwarder Root Hint (.)
Ask .com

.com

yahoo.com
Local Computer1
DNS Server
Caching DNS Server
Caching Table
Host Name IP Address TTL
clientA.vnn.vn. 192.168.8.44 28 seconds

Where’s
ClientA Client
is at
192.168.8.44
A?

ClientA
Client1
ClientA Client
Where’s is at
Client2 192.168.8.44
A?

Caching là tiến trình lưu trữ tạm một số thông tin phân giải trước để cung
cấp cho các lần phân giải sau này nhằm làm tăng tốc quá trình phân giải tên
miền
Phân giải địa chỉ
Cơ chế lưu trữ và duy trì CSDL
Namespace: csc.vnn.vn
DNS Server Resource records cho zone
csc.vnn.vn
Host name IP address
DNS ClientA 192.168.2.45

DNS ClientB 192.168.2.46


Zone File: DNS ClientC 192.168.2.47
csc.vnn.vn.dns

DNS ClientC
DNS ClientA DNS ClientB
resource record (RR) là chuẩn cấu trúc của DNS database chứa thông tin cần thiết
cung cấp cho các yêu cầu truy vấn DNS

zone file là thành phần của DNS database chứa các resource records
Resource record và record type

Loại Record Mục đích


A Phân giải tên thành địa chỉ IP
PTR Phân giải địa chỉ IP thành tên host name
SOA Chứng thực cơ sở dữ liệu cho zone
SRV Phân giải tên của cung cấp dịch vụ AD
NS Chỉ định DNS server cho zone
MX Chỉ định mail server cho zone
CNAME Phân giải hostname thành hostname
Tạo cơ sở dữ liệu cho Zone

Tạo record A : ánh xạ host name -> ip address


Tạo record CNAME: : ánh xạ host name ->host
name
Tạo record NS: : ánh xạ host name ->host name
Tạo record MX:: chỉ định mail server quản lý
mail cho miền.
DNS Zone

vn

com vnn edu

hcmuns hcmut hcmiu


Phân loại DNS Zone

Zones Mô tả

Read/Write
Read/write DNS database
Primary

Read-Only
Read-only DNS database
Secondary

Copy of
limited
Bảng sao của zone chứa một số RR
Stub records
Forward Lookup Zone và Reverse
Lookup Zone

Namespace: csc.vnn.vn.
DNS Client1 192.168.2.45
Forward DNS Client2 192.168.2.46
DNS Server chứng thực cho csc zone
Training

DNS Client3 192.168.2.47

192.168.2.45 DNS Client1


Reverse 1.168.192.in-
zone addr.arpa 192.168.2.46 DNS Client2

192.168.2.47 DNS Client3

DNS Client2 = ?

192.168.2.46 = ?

DNS Client3

DNS Client1
DNS Client2
DNS Zone transfer
DNS zone transfer là quá trình đồng bộ cơ sở dữ liệu DNS zone data
giữa các DNS servers

1 SOA query for a zone

2 SOA query answered

3 IXFR or AXFR query for a zone

IXFR or AXFR query answered


4
(zone transfer)
Secondary Server Primary and
Master Server
DNS Notify

DNS notify là một cơ chế thông báo sự thay đổi cơ sở dữ liệu


DNS cho secondary name server khi có sự thay đổi cơ sở dữ
liệu trong zone

updated
Destination Server 1 Resource record Source Server
SOA serial number
2 được update

3 DNS notify

Zone transfer
4
Secondary Server Primary and
Master Server
Giới thiệu Dynamic DNS

1. Dynamic update là tiến trình mà DNS


client tự động tạo, đăng ký hoặc cập nhật
RR trong zone.
2. Manual update là tiến trình mà người quản trị
phải tạo, đăng ký hoặc cập nhật resource
record
Cập nhật RR tự động từ DNS Client

DNS Server Resource


Records 1 Client gởi SOA query

DNS server gởi zone name


2 và server IP address

1 2 3 4 5 Client kiểm tra đã đăng


3 ký chưa

DNS server trả lời trạng


4 thái chưa đăng ký

Client gởi dynamic update


5 tới DNS server
Windows Windows Windows
Server 2003 XP 2000
DHCP đăng ký và cập nhật RR cho
DNS Client
DNS Server
DHCP client gởi request
1 để thuê IP
Resource
Records DHCP server cấp địa chỉ
2 IP cho Client
DHCP server tự động tạo
3 FQDN cho Client
3 4 DHCP server cập nhật
4 DNS forward và reverse
records cho client

1
2
Window Server 2003 IP Address Lease DHCP Down-
Running DHCP level Client
Active Directory - Integrated Zone

Loại DNS zone Thuận lợi

Non Active
Directory- Không yêu cầu dịch vụ Active Directory
integrated zone
Active Directory- Lưu DNS zone data trong Active Directory cung
integrated zone cấp nhiều tính năng bảo mật
sử dụng Active Directory replication thay vì
zone transfers
Cho phép chỉ secure dynamic updates
sử dụng cấu trúc multi-master thay vì single
master

Active Directory-integrated DNS zone là DNS zone lưu


trong Active Directory
Secure Dynamic Update với Active
Directory - Integrated Zone
secure dynamic update là tiến trình trong đó DNS Client
cập nhật RR chỉ khi nào Client thực sự đăng nhập vào
DNS Server
Find authoritative server
DNS Client
running Local
Windows XP Result DNS Server

Domain Controller with


Active Directory-
Integrated DNS Zone
Cấu hình Preferred và Alternate DNS
Server cho Client
3. Chỉ định các alternate DNS
servers

1. Preferred DNS
server

4. Preferred và alternate
DNS servers tự động
xuất hiện trong list này
2. Nếu preferred server lỗi
thì client truy vấn tới
alternate DNS server
Cấu hình domain suffix

Tuỳ chọn Suffix Danh sách Name query = server1


Domain suffix

server1.tm.csc.vnn.vn

server1.csc.vnn.vn

server1.vnn.vn

Connection
Specific Suffix
Sự ủy quyền (delegation)

Namespace: csc.vnn.vn
DNS server

csc.vnn.vn

DNS server

csc.vnn.vn

Delegation là quá trình gán toàn quyền subdomain cho một


name server khác quản lý.
Cấu hình DNS
➢Lab DNS
Câu hỏi và giải đáp
WINDOWS SERVER 2012
Bài 6
DỊCH VỤ DHCP
Nội dung bài học
➢Giới thiệu dịch vụ DHCP
➢Hoạt động của giao thức DHCP
➢Cài đặt dịch vụ DHCP
➢Chứng thực dịch vụ DHCP trong Active
Directory
➢Cấu hình dịch vụ DHCP
➢Cấu hình các tuỳ chọn DHCP
➢Cấu hình dành riêng địa chỉ
Giới thiệu dịch vụ DHCP
➢DHCP: Dynamic Host Configuration
Protocol
➢Yêu cầu của DHCP Server
▪ Máy tính đã cài đặt Windows Server 2012 và
dịch vụ DHCP
▪ Các card mạng phải được cấu hình bằng các
IP tĩnh
▪ Danh sách các địa chỉ IP cấp cho máy client
➢Yêu cầu của DHCP client
▪ Tất cả các máy trạm sử dụng HĐH của
Microsoft, Linux, Unix, Macintosh đều có thề
làm DHCP client.
Hoạt động của giao thức DHCP
➢ Dịch vụ DHCP hoạt
động theo mô hình
Client/Server
➢ Quá trình tương tác
giữa DHCP client
và DHCP server
Chứng thực dịch vụ DHCP
trong Active Directory
➢Chứng thực DHCP trong AD:
▪ Dịch vụ DHCP được cài đặt trên server thành
viên của domain (member server) hoặc cài
trên Domain Controller.
▪ Cấp phép hoạt động cho dịch vụ DHCP trong
môi trường Domain.
▪ Chỉ những DHCP được chứng thực mới được
hoạt động trên mạng.
➢Các thao tác chứng thực (Xem Demo phía
sau)
Cấu hình dịch vụ DHCP
➢Các thông tin liên quan trong quá trình cấu
hình DHCP server
▪ Scope name
▪ IP Address range
▪ Exclusions address
▪ Lease Duration
▪ Router (Default gateway) option
▪ Domain Name and DNS Server option
Cài đặt dịch vụ DHCP
➢Lab DHCP
Hỏi và đáp
WINDOWS SERVER 2012
Bài 7
DỊCH VỤ WEB
GIỚI THIỆU DỊCH VỤ WEB

➢ GIỚI THIỆU GIAO THỨC HTTP.


➢ WEB SERVER VÀ NGUYÊN TẮC HOẠT ĐỘNG.
▪ WEB CLIENT.
▪ WEB ĐỘNG.
▪ WEB TĨNH.
➢ GIỚI THIỆU, CÀI ĐẶT IIS, CẤU HÌNH IIS
GIỚI THIỆU GIAO THỨC HTTP

➢ HTTP là một giao thức cho phép Web Browsers


và Servers có thể giao tiếp với nhau, nó chuẩn
hoá các thao tác cơ bản mà một Web Server
phải làm được.
▪ HTTP chủ yếu thực thi hai phương thức GET, POST.
▪ HTTP port mặc định có giá trị 80
▪ Thông tin trả về từ server theo cú pháp của ngôn ngữ
HTML.
▪ Phiên bản hiện tại HTTP 2.0
WEBSERVER VÀ NGUYÊN TẮC HOẠT
ĐỘNG

Client gởi yêu cầu


đến Web server

Web Server
Web server gởi trả
lời về Client

Web server tìm tài Web server nhận tài


liệu từ file system liệu từ file system

File system

➢ Sơ đồ hoạt động giữa Web Browser và Web Server


WEB CLIENT

➢Là chương trình duyệt Web ở phía người


dùng như Internet Explorer, Netscape để
hiển thị trang Web cho người dùng.
▪ Web client có thể thực hiện một số phép toán
đơn giản trên Web page.
▪ Thực thi các script phía máy khách như
JavaScript, VBScripts,…
▪ Lưu trữ cache cho các Object, Image cho
Webpage.
▪ Tích hợp các tính năng security.
WEB ĐỘNG

➢Sơ đồ hoạt động của web động


GiỚI THIỆU IIS

➢ IIS được xây dựng trên nền Windows, IIS cung


cấp một số đặc điểm mới giúp tăng tính năng tin
cậy, tính năng quản lý, tính năng bảo mật, tính
năng mở rộng và tương thích với hệ thống mới.
➢ Các thành phần chính của IIS
▪ HTTP.sys
▪ WWW Service Administration and Monitoring
Component.
▪ Worker process
▪ Inetinfo.exe
➢Các IIS Isolation mode
GiỚI THIỆU IIS (t.t.)

➢Các IIS Isolation mode

▪IIS Isolation mode. ▪Worker Process Isolation mode


GiỚI THIỆU IIS (t.t.)

➢ Cung cấp các tính năng bảo mật:


▪ Anonymous authentication
▪ Basic authentication
▪ Digest authentication
▪ Advanced Digest authentication
▪ Integrated Windows authentication
▪ Certificates
▪ .NET Passport Authentication
➢ Cung cấp các ứng dụng:
▪ Application Pool
▪ ASP.NET
➢ công cụ quản trị:
▪ IIS Manager.
▪ Remote Administration (HTML) Tool.
▪ Command –line administration scipts
Cấu Hình IIS Web service
▪ Default Web site.
▪ Application Pool.
▪ Web Service Extensions.
▪ Tạo một Web Site.
▪ Tạo thư mục ảo.
▪ Cấu hình bảo mật cho Web site.
▪ Tạo Web Hosting.
▪ Quản trị Web site từ xa.
Application Pool
➢Application Pool
▪ Là một nhóm các ứng dụng cùng chia sẻ một
worker process (W3wp.exe).
▪ Application Pool giúp có thể hiệu chỉnh cơ
chế tái sử dụng vùng nhớ ảo, tái sử dụng
worker process, hiệu chỉnh performance (về
request queue, CPU), health.
➢Một số thuộc tính của Application Pool
như: Recycling, Performance, Health,
Identity.
Web Service Extensions
➢Web Service Extensions: là thành phần
cung cấp cho IIS khả năng thực thi xử lý
Web động trên Web site
• ASP
• ASP.NET
• Server Side Includes
• WebDAV
Tạo một Web Site
➢ Cần chuẩn bị một số thông tin khi tạo Web site:
▪ Tên Web site (ví dụ: www.domain)
▪ Loại nội dung của Web site:
• Web động viết bằng ngôn ngữ gì: ASP, ASP.NET, PHP,…
• Cơ sở dữ liệu của Web động lưu ở đâu?
• Cơ chế kết nối cơ sở dữ liệu cho Web động như thế nào?
➢ Bên cạnh giao diện người dùng thì chúng ta có
thể tạo Web site thông qua lệnh:
▪ iisweb.vbs /create <Home Directory> ”Site
Description" /i <IP Address> /b <Port>.
Tạo thư mục ảo
➢Virtual Directory:
▪ Mục đích của thư mục ảo trong Web là để ánh
xạ một tài nguyên từ đường dẫn thư mục vật
lý thành đường dẫn URL, thông qua đó ta có
thể truy xuất tài nguyên này qua Web Browser.
Cấu hình bảo mật cho Web site
▪ Cấu hình chứng thực và điều khiển truy cập
(Authentication And Access Control)
▪ Giới hạn truy xuất Web cho host/domain (IP
address and domain name restriction).
▪ Secure communication.
Tạo Web Hosting
➢ Web Hosting: là kỹ thuật duy trì nhiều Web site
trên Web Server.
▪ Để xác định từng Web site. Web Server phải dựa vào các
thông số như:
• Host Header Name.
• Địa chỉ IP.
• Số hiệu cổng Port.
➢ Để cấu hình Web hosting cần chuẩn bị các thông
tin sau:
▪ Địa chỉ FQDN cho từng Web site.
▪ Phương thức tạo Web hosting.
▪ Cấp quyền cập nhật Web hosting cho user.
Quản trị Web site từ xa
▪ IIS cung cấp cơ chế quản trị dịch Web, quản trị một
số tính năng cơ bản của hệ thống từ xa bằng cách
sử dụng công cụ Remote Administration (HTML).
Sử dụng Remote Administration có thể:
• Quản lý và cấu hình Web Site từ xa.
• Quản lý cấu hình mạng.
• Quản lý người dùng cục bộ.
• Quản lý và duy trì một số dịch vụ cơ bản.
Triển khai và cấu hình IIS
➢Lab IIS
Câu hỏi và giải đáp
WINDOWS SERVER 2012

Bài 8
DỊCH VỤ FTP
Dịch vụ FTP
➢ GIỚI THIỆU FILE TRANSFER PROTOCOL.
➢ CẤU HÌNH FTP SERVER TRÊN INTERNET
INFORMATION SERVICES(IIS).
Giới thiệu giao thức FTP

➢FTP là giao thức truyền file trên mạng


TCP/IP
▪ Hoạt động dựa trên chuẩn giao thức TCP.
▪ Là một dịch vụ đặc biệt sử dụng hai cổng 20
để truyền dữ liệu (data port), 21 để truyền
lệnh (command port).
Giới thiệu giao thức FTP(t.t.)
FTP SERVER FTP CLIENT

20 21 1026 1027
➢ Active ftp DATA CMD CMD DATA
Giới thiệu giao thức FTP(t.t.)

2026 21 1026 1027


DATA CMD DATA DATA

➢ Passive FTP
FTP Client và Transfer mode

➢ IIS hỗ trợ cả hai chế độ kết nối Active và


Passive.
FTP Client Transfer Mode

Command-line Active

Internet Explorer 5.1 và các phiên Passive


bản trước đó

Internet Explorer 5.5 và các phiên Active and Passive


bản sau này

Từ FrontPage 1.1 tới FrontPage 2002 Active


FTP Isolation User
➢ Do not isolate users: mode này không giới hạn truy
xuất của người dùng. Thông thường ta sử dụng
mode này để tạo một public FTP Site.
➢ Isolate users: mode này chứng thực người dùng
cục bộ (Local User) và người dùng miền (Domain
User) truy xuất vào FTP Site. Đối với mode này
người quản trị phải tạo cho mỗi người dùng một
thư mục con của thư mục FTP Root theo cú pháp
<FTPROOT>\<LocalUser | Domain>\<Username>
➢ Isolate users using Active Directory: tương tự như
mode Isolate Users nhưng tích hợp vào AD để bảo
mật cơ chế truy xuất tài nguyên cho người dùng.
Chương trình FTP Server

➢FTP Server là máy chủ lưu trữ tài nguyên


và hỗ trợ giao thức FTP để cung cấp dịch
vụ truyền file trên mạng TCP/IP.
Chương trình FTP Client

➢Là một chương trình dùng giao thức FTP


để giao tiếp với FTP Server.
➢FTP Server phải cung cấp cho FTP Client
các thông tin:
▪ Địa chỉ IP của FTP Server.
▪ Account
• Username.
• Password.
Một số tập lệnh cơ bản của FTP
Client
Tên lệnh Cú pháp Ý nghĩa
? hoặc lệnh ? [command] Hiển thị giúp đỡ về
help [command]
Get get remote-file [local-file] Download file từ FTP Server
về máy cục bộ
Lcd lcd [directory] Thay đổi thư mục trên máy
cục bộ
Ls ls [remote-directory] [local-file] Liệt kê các tập tin và thư mục
Mget mget remote-files [ ...] Download nhiều file
Put put local-file [remote-file] Upload tập tin
Mput mput local-files [ ...] Upload nhiều tập tin
Open open computer [port] Kết nối tới ftp server
prompt Prompt Tắt cơ chế confirm sau mỗi
lần download file
disconnect Disconnect Hủy kết nối FTP
Pwd Pwd Xem thư mục hiện tại
Quit Quit Thoát khỏi ftp session
Cài đặt và cấu hình dịch vụ FTP

➢ Cài đặt FTP Service


➢ Cấu hình FTP Service
▪ Xem và thay đổi cấu hình FTP Site
▪ Tạo FTP Site.
▪ Tạo thư mục ảo.
▪ Điều khiển truy xuất FTP Site.
▪ Theo dõi và quản lý logfile.
Tạo FTP site

➢Khi tạo mới FTP site ta cần chuẩn bị:


▪ Tên FTP site: dùng dịch vụ DNS để cung cấp
cho tên cho FTP site.
▪ FTP User cần sử dụng.
▪ Thư mục gốc của FTP site (Home Directory)
▪ Quyền hạn truy xuất (FTP Permission)
Tạo/Xóa FTP site bằng dòng lệnh

➢Lệnh tạo FTP site:


▪ iisftp /create <Home Dir> “Description” /i <IP
address>
➢Lệnh xóa FTP site:
▪ iisftp /delete "<Tên FTP>"
Tạo Virtual Directory
➢ Thư mục con của FTP root đều có thể truy xuất
thông qua đường dẫn URL của dịch vụ FTP như:
“ftp://<FTP_site_name>/<tên_thư_mục_con>”.
➢ Để có thể chia sẻ tài nguyên bên ngoài FTP Root
cho FTP User thì ta phải tạo thư mục ảo (virtual
directory),
▪ Thông virtual directory ta tạo một thư mục ảo bên
trong FTP Site ánh xạ vào bất kỳ một thư mục nào đó
trên ổ đĩa cục bộ hoặc vào một tài nguyên chia sẻ trên
mạng.
▪ Khi đó ta có thể truy xuất tài nguyên theo địa chỉ:
“ftp://<FTP_site_name>/<tên_thư_mục_ảo >”
Tạo Virtual FTP Site

➢ Virtual FTP Site: giúp duy trì nhiều FTP site


trên một máy chủ.
➢Các bước chuẩn bị khi cấu hình:
▪ Tạo IP Alias (n địa chỉ tương ứng với n site).
▪ Đặt tên cho FTP Site (dùng dịch vụ DNS).
▪ FTP User cần sử dụng.
▪ Thư mục FTP Root cho từng Web site.
▪ Quyền hạn truy xuất.
Theo dõi và quản lý Log file
➢Quản lý log giúp người quản trị xử lý sự
cố, theo dõi quá trình hoạt động của dịch
vụ:
▪ Mặc định FTP lưu lại một số sự kiện như: Địa
chỉ của FTP Client truy xuất, thời gian truy
xuất của máy trạm, trạng thái hoạt động của
dịch vụ,…
▪ Log file được lưu tại thư mục
%systemroot%\system32\LogFiles\MSFTPSVn
nnnnnnn, trong đó nnnnnnnn là số ID của FTP
Site.
Triển khai và cấu hình FTP
➢Lab FTP
Câu hỏi và giải đáp
Introduction to
Networking
Semester 1 – Module 1

Module Objectives:

 Understand the physical connection that has to take place for a computer to
connect to the Internet.
 Recognize the components that comprise the computer.
 Install and troubleshoot network interface cards and/or modems.
 Use basic testing procedures to test the Internet connection.
 Demonstrate a basic understanding of the use of web browsers and plug-ins.
Basic Internet Connection
Basic Internet Connection (ADSL)
Basic Internet Connection (Fiber)
Internet Connection Requirements

 Internet is the largest data network on earth
 Consists of many large and small networks that are 
interconnected Individual computers are the sources and 
destinations of information through the Internet
 Connection to the Internet can be broken down into three parts:
 Physical connection – device such as NIC
 Logical connection – protocols such as TCP/IP
 Applications – software that interprets and display data
Computer Basics
 Electronic Components
 Transistor, Integrated circuit (IC), Resistor, Capacitor, 
Connector, and Light emitting diode (LED)
 PC Subsystems
 Printed circuit board, CD­ROM drive, Central processing unit 
(CPU), Hard drive, Microprocessor, Motherboard, Bus, 
Random­access memory (RAM), Read­only memory (ROM), 
System unit, Expansion slot, Power supply, 
 Backplane components
 Network interface card (NIC), Video card, Audio card, Parallel 
port, Serial port, Mouse port, Power cord
Network Interface Card

 A  NIC,  or  LAN  adapter,  provides  network 


communication  capabilities  to  and  from  a 
PC
 These  considerations  are  important
in the selection of a NIC:
 Type  of  expansion  slot  –  PCI/PCI 
Express/Express Card/USB 
 Types  of  media  –  Wired  (Twisted­pair, 
coaxial, fiber­optic) or wireless
 Protocols – LAN or WAN
E.g: Ethernet or 3G 
NIC’s & Modems
 A NIC provides a network interface for each host
 Situations that require NIC installation include the following:
 Installation of a NIC on a PC that does not already have one 
 Replacement of a malfunctioning or damaged NIC 
 Upgrade from a 10­Mbps NIC to a 10/100/1000­Mbps NIC 
 Change to a different type of NIC, such as wireless 
 Installation of a secondary, or backup, NIC for network 
security reasons 

 A modem, or modulator­demodulator,
has two main functions:
 provides the computer with connectivity to
a telephone line
 converts data from a digital signal to an analog
signal that is compatible with a standard phone line
Internet Connections for Consumers

 Requires use of a Modem
 On demand (Dial­up – slow)
 Always on High Speed Connections
 xDSL – Verizon
 Cable – Comcast
 Fiber
TCP/IP
 TCP/IP is a set of protocols or 
rules that have been developed 
to allow computers to share 
resources across a network 
 The operating system tools must 
be used to configure TCP/IP on 
a workstation 
Testing Connectivity with Ping
 Ping is a basic program that verifies a particular IP address 
exists and can accept requests.
 Ping stands for Packet Internet or Inter­Network Groper.
 How can ping be used?
 ping 127.0.0.1 ­ loopback test. It verifies the operation of the 
TCP/IP stack and NIC transmit/receive function.
 ping host computer IP address ­ verifies the TCP/IP 
address configuration for the local host and connectivity to 
the host.
 ping default­gateway IP address ­ verifies whether the 
router that connects the local network to other networks can 
be reached.
 ping remote destination IP address ­ verifies connectivity 
to a remote host.
Web Browsers and Plug-ins
 A Web  browser is software that interprets HTML, which is one 
of the languages used to code Web page content.
 4  of  the  most  popular  engines  for  web  browsers  are  Trident 
(Internet Explorer), Gecko (Firefox), Blink (Chrome) and Webkit 
(Safari) 
 Plug­ins are applications that work with the browser to launch the 
programs required to view special files:
 Flash – Plays multimedia files created by Macromedia Flash 
 Quicktime – Plays video files created by Apple 
 
Troubleshooting Connectivity

1. Define the Problem
2. Gather the Facts
3. Consider the Possibility
4. Create an Action Plan
5. Implement the Plan
6. Observe the Results
7. Document the Results
8. Introduce Problems and Troubleshoot
Labs
1.1.2 Lab Exercise: PC Hardware ­ This lab introduces the basic peripheral 
components of a PC computer system and PC connections including network 
attachment.
1.1.6 Lab Exercise: PC Network TCP/IP Configuration ­ In this lab, the 
student will identify tools used to discover a computer network configuration with 
various operating systems.
1.1.7 Lab Exercise: Using ping and tracert from a Workstation ­ In this lab, 
the student will learn to use the ping command and the Traceroute (tracert) 
command from a workstation.
1.1.8 Lab Exercise: Web Browser Basics ­ In this lab, the student will learn how 
to use a web browser to access Internet sites and become familiar with the concept 
of a URL.
1.1.9 Lab Exercise: Basic PC/Network Troubleshooting Process ­ In this lab, 
the student will learn the proper sequence for troubleshooting computer and 
network problems and become familiar with the more common hardware and 
software problems.
Binary Presentation
 Computers work with and store data using electronic switches 
(binary or bits (b)) that are either ON (1b or +5v) or OFF (0b or 0v).
 The 1s and 0s are used to represent the two possible states of an 
electronic component in a computer. 
 Keyboarding uses ASCII
 Transfer uses raw bits
Bits and Bytes
Base 10 numbering system

Decimal ­ 10 possible (0,1,2,3….9)
104=10,000 103=1,000 102=100 101=10 100=1
Base 2 numbering system with 1 octet (8 bits)

Binary ­ 2 possible  (0&1)
27=128 26=64 25=32 24=16 23=8 22=4 21=2 20=1
Converting Decimal to 8-bit Binary

247
27=128 26=64 25=32 24=16 23=8 22=4 21=2 20=1
1 1 1 1 0 1 1 1
Converting Binary to Decimal

10111010
1*27=128 0*26=64 1*25=32 1*24=16 1*23=8 0*22=4 1*21=2 0*20=1

128 0 32 16 8 0 2 0 186
IP Addresses (version 4) – IPv4
 Currently,  addresses  assigned  to  computers  on  the  Internet  are 
32­bit binary numbers.
 To make it easier to work with these addresses, the 32­bit binary 
number is broken into 4 octets separated by dots. Then they are 
converted to a series of decimal numbers. 

        11001000    .    01110010    .    00000110    .   00110011
IPv4 (cont.)
• IPv4 always combines with Subnet mask (SM) to specify that 
IP  belongs  to  which  subnet  by  using  AND  logic.  Thus,  SM 
shares the same structure with IPv4.
 However, the bits of 1 in SM have to be written firstly. When 
they are finished, the bits of 0 are written.
 For example:
IP  00001010.00100010.00010111.10000110  10.34.23.134
SM11111111.11111111.00000000.00000000  255.255.0.0
IPv4 (cont.)

The  IP  10.34.0.0  with  SM  255.255.0.0  is  called  network  address  of 
subnet which contains IP 10.34.24.134.
IPv4 (cont.)
• IPv4 could be written briefly as follows:
IP /
 For example: 10.34.24.134 /16
 Generally, we can express IPv4 below:
x.y.z.t /u with 
 For example: 6.7.8.9/10
IPv4 (cont.)
 A subnet could be described below:

Network Address –  IP for hosts Broadcast Address


Net. Add (BA – Not assigned)
(Not assigned)
Hexadecimal
Hexadecimal 16 possibilities (0,1,2,3,
….9,A,B,C,D,E,F)
In hex. Binary octects are represented 
with just 2 digits. 
161=2 160=1
Number Systems Comparison Chart
MAC Address

• Every  computer  has  a  unique  way  of 


identifying  itself  :    MAC  address  or 
physical address.
• The  physical  address  is  located  on  the 
Network Interface Card (NIC).
• MAC  addresses  have  no  structure,  and 
are considered flat address spaces.
MAC address format

The first six hexadecimal digits,


The remaining six hexadecimal
which are administered by the
digits comprise the interface
IEEE, identify the manufacturer
serial number.
or vendor.
MAC address
 MAC  addresses  are  sometimes  referred  to  as 
burned­in  addresses  (BIAs)  because  they  are 
burned into read­only memory (ROM) and are 
copied  into  random­access  memory  (RAM) 
when the NIC initializes.
 For example: 
0000.0c12.3456 or 00­00­0c­12­34­56.
 Broadcast layer 2: FFFF.FFFF.FFFF
Using MAC addresses

Data A D Data A D Data A D Data A D

Destination Address

Source Address
Labs

1.2.5 Lab Exercise: Decimal to Binary Conversion ­ In this lab, the 
student will learn and practice to convert decimal values to binary 
values.
1.2.6 Lab Exercise: Binary to Decimal Conversion ­ In this lab, the 
student will learn and practice the process of converting binary values 
to decimal values.
1.2.8 Lab Exercise: Hexadecimal Conversions ­ In this lab, the 
student will learn the process to convert hexadecimal values to 
decimal and binary values.
Communicating over the
Network

Network Fundamentals – Chapter 2

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 1


Objectives
 Describe the structure of a network, including the
devices and media that are necessary for successful
communications.
 Explain the function of protocols in network
communications.
 Explain the advantages of using a layered model to
describe network functionality.
 Describe the role of each layer in two recognized
network models: The TCP/IP model and the OSI
model.
 Describe the importance of addressing and naming
schemes in network communications.
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 2
Network Structure
 Define the elements of communication
–3 common elements of communication
• message source
• the channel
• message destination

 Define a network
data or information networks capable of carrying many different
types of communications
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 3
Network Structure
 Describe how messages are communicated
Data is sent across a network in small “chunks” called
segments

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 4


Network Structure
 Define the components of a network
–Network components
• hardware
• software

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 5


Network Structure
 End Devices and their Role in the Network
–End devices form interface with human network &
communications network
–Role of end devices:
• client
• server
• both client and server

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 6


Network Structure
 Identify the role of an intermediary device in a data
network and be able to contrast that role with the role of
an end device
–Role of an intermediary device
• provides connectivity and ensures data flows
across network

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 7


Network Structure
 Define network media and criteria for making a network
media choice
Network media
this is the channel over which a message travels

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 8


Network Types
 Define Local Area Networks (LANs)
- A network serving a home, building or campus is considered a
Local Area Network (LAN)

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 9


Network Types
 Define Wide Area Networks (WANs)
- LANs separated by geographic distance are connected by a
network known as a Wide Area Network (WAN)

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 10


Network Types
 Define the Internet
The internet is defined as a
global mesh of interconnected networks

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 11


Network Types
 Describe network representations

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 12


Function of Protocol in Network
Communication
 The importance of protocols and how they are used to
facilitate communication over data networks
A protocol is a set of predetermined rules

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 13


Function of Protocol in Network
Communication
 Explain network protocols
Network protocols are used
to allow devices to
communicate
successfully

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 14


Function of Protocol in Network
Communication
 Describe Protocol suites and industry standards

A standard is
a process or protocol that has been endorsed by the
networking industry and ratified by a standards organization

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 15


Function of Protocol in Network
Communication
 Define different protocols and how they interact

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 16


Function of Protocol in Network
Communication
 Technology independent Protocols
-Many diverse types of devices can communicate using the
same sets of protocols. This is because protocols specify
network functionality, not the underlying technology to support
this functionality.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 17


Layers with TCP/IP and OSI Model
 Explain the benefits of using a layered model
–Benefits include
• assists in protocol design
• fosters competition
• changes in one layer do not affect other layers
• provides a common language

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 18


Layers with TCP/IP and OSI Model
 Describe TCP/IP Mode

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 19


Layers with TCP/IP and OSI Model
 Describe the Communication Process

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 20


Layers with TCP/IP and OSI Model
 Explain protocol data units (PDU) and encapsulation

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 21


Layers with TCP/IP and OSI Model
 Describe the process of sending and receiving
messages

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 22


Layers with TCP/IP and OSI Model
 Explain protocol and
reference models
A protocol model
provides a model that
closely matches the
structure of a particular
protocol suite.

A reference model
provides a common
reference for
maintaining
consistency within all
types of network
protocols and services.
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 23
Layers with TCP/IP and OSI Model
 Define OSI

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 24


Layers with TCP/IP and OSI Model
 Compare OSI and TCP/IP model

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 25


Addressing and Naming Schemes
 Explain how labels in encapsulation headers are used
to manage communication in data networks

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 26


Addressing and Naming Schemes
 Describe examples of Ethernet MAC Addresses, IP
Addresses, and TCP/UDP Port numbers

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 27


Addressing and Naming Schemes
 Explain how labels in encapsulation headers are used
to manage communication in data networks

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 28


Addressing and Naming Schemes
 Describe how information in the encapsulation header
is used to identify the source and destination processes
for data communication

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 29


Summary

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 30


© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 31
Ethernet

CCNA Exploration Semester 1


Chapter 9

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 1


Ethernet

 OSI model layers 1 (physical) and 2 (data link)


 TCP/IP model Network Access layer

Application
Presentation Application
Session
Transport Transport
Network Internet
Data link Network Access
Physical
Ethernet

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 2


Ethernet

 The most common LAN technology

 Different media (copper cable, optical fibre)


 Different bandwidths (10, 100Mbps, Gbps, +)

 Same addressing scheme


 Same basic frame format

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 3


Ethernet history

 First LAN was Ethernet, designed at Xerox


 1980 Ethernet standard published by DIX (Digital, Intel, Xerox)
 1985 IEEE modified Ethernet standard and published as 802.3

LLC
MAC
802.2
802.3 Ethernet

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 4


Sublayers

 Logical Link control sublayer links to


upper layers, is independent of
equipment.
 Media Access Control sublayer provides
LLC addressing, frame format, error detection,
MAC CSMA/CD.
 Physical layer handles bits, puts signals
on the medium, detects signals.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 5


Advantages of Ethernet

 Simplicity and ease of maintenance


 Ability to incorporate new technologies (e.g. fibre optic,
higher bandwidths)
 Reliability
 Low cost of installation and upgrade

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 6


Shared medium

 Physical bus topology


10Base5 (thick coaxial cable up to
500m)
10Base2 (thin coaxial cable up to
185m)
 Physical star topology
10BaseT (UTP cable up to 100m)
 Collisions happen – managed with
CSMA/CD

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 7


Hubs and switches

 “Legacy Ethernet”, 10Base5, 10Base2 or 10BaseT with


hubs is designed to work with collisions, when devices
transmit at the same time. Collisions are managed by
CSMA/CD.
 Performance is poor if there is a lot of traffic and
therefore a lot of collisions.
 Collisions can be avoided by using switches and full
duplex operation.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 8


Hubs and switches

Switch forwards
Hub forwards frames frames only to the
through all ports destination once the
except incoming port. address is known.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 9


Half duplex

 One-way traffic. Necessary on


a shared medium.
 If PC1 is transmitting but also
detects incoming signals then
there is a collision.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 10


Full duplex

 Two way traffic


 PC can transmit and receive at
the same time
 Not on shared medium – must
have dedicated link from
switch
 No collisions

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 11


Fast Ethernet, Gigabit Ethernet

 Along with the move to switches came higher


bandwidth: 100 Mbps or Fast Ethernet.
 Later came 1000 Mbps, Gigabit Ethernet.
 Gigabit Ethernet requires fully switched and full duplex
operation. Collisions are no longer defined and cannot
be managed.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 12


LAN, MAN, WAN

 Ethernet was developed for local area networks


confined to a single building or group of buildings on
one site.
 Using fibre optics and Gigabit speeds, Ethernet can be
used for Metropolitan Area Networks – throughout a
town or city.
 Ethernet can even be used over larger areas so the
distinction between LAN and WAN is no longer clear.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 13


Ethernet Frame
Packet from
Packet
Network layer is
encapsulated
Frame header Packet Trailer

Preamble Start of Destination Source Length Packet Frame


frame address address /type Data Check
delimiter Seq.

7 1 6 6 2 46-1500 4
Field size in bytes. Preamble and SFD are not counted in
frame size. Frame is 64-1518 (later 1522) bytes.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 14


Frame fields

 Preamble and start of frame delimiter: act as a wake-up


call, help synchronisation, show where frame starts.
 Destination Address: MAC address of destination, 6
bytes hold 12 hex digits.
 Source Address: MAC address of sender, 6 bytes hold
12 hex digits.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 15


Frame fields

 Length/type field: DIX used this for type, the original


IEEE 802.3 standard used it for length. The later IEEE
standard allows it to be used for either.
 A value less than 0x0600 hex (1536 decimal) is length.
A greater value is the type, a code showing which
higher layer protocol is in use.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 16


Frame fields

 Data field: This contains the layer 3 protocol data unit,


usually an IP packet.
 If the packet is less than 46 bytes then the field length
is made up to 46 bytes with a “pad”.
 The frame trailer contains the Frame Check Sequence
field, used for the cyclic redundancy check to detect
corrupt frames.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 17


Ethernet MAC address

 A unique identification for a device (or NIC).


 Burned into the ROM but copied to RAM.
 First 3 bytes identify the manufacturer (Organizationally
Unique Identifier)
 A device reads the destination MAC address to see if it
should process the frame.
 A switch reads the destination MAC address to see
where it should forward the frame.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 18


Writing a MAC address

 The 12 hex digits are written in different ways


 00-05-9A-3C-78-00
 00:05:9A:3C:78:00
 0005.9A3C.7800
 This is the same address
 00-05-9A is the manufacturer’s ID
assigned by IEEE
 3C-78-00 is assigned by the manufacturer

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 19


Different addresses

 MAC addresses are used to identify devices within a


network. They are layer 2 addresses in the frame
header.
 IP addresses are used to pass data between networks.
They are layer 3 addresses in the packet header. They
identify the network as well as the device.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 20


On a long journey…

 The packet header with IP addresses is created by the


source host and stays the same throughout the journey.
 The frame header is stripped off and replaced by each
router, so the MAC addresses are different for every
step of the journey. If parts of the journey are not over
Ethernet then there will be a different addressing
system – not MAC.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 21


Unicast, multicast, broadcast

 Unicast: a message sent to one particular host. It must


contain the destination host’s IP address and MAC
address.
 Broadcast: message for all hosts on a network. “Host”
part of IP address is all binary 1s. E.g. 192.168.1.255
MAC address is all binary 1s, FF:FF:FF:FF:FF:FF in
hex.
 Multicast: message for a group of devices.
IP address 224.0.0.0 to 239.255.255.255

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 22


Collisions

 Ethernet originally used shared coaxial cable.


 If hosts transmit at the same time, there is a collision.
 Later networks used hubs and UTP cable but the medium
is still shared and collisions occur.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 23


Hubs and Collision Domains

 Collision domain – area where collisions occur.


 Add more hubs and PCs – collision domain gets bigger,
more traffic, more collisions.
 Hosts connected by hubs share bandwidth.

 Only one PC
can send

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 24


CSMA/CD

 Carrier Sense: ‘Listen’ to see if there are signals on the


cable
 Multiple Access: Hosts share the same cable and all
have access to it
 Collision Detection: Detect and manage any collisions
of signals when they occur
 This is the ‘first come, first served’ method of letting
hosts put signals on the medium

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 25


Listen for signals

Are there signals on


the cable?
Yes.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 26


Wait if there are signals

Wait until there are


no more signals

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 27


Listen for signals

Are there signals on


the cable now?
No.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 28


Put signals on cable

Put my signals on the


cable.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 29


Listen for collisions: no

No collision.
All is well.
My message was
sent.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 30


Listen for collisions: yes

There is a collision.
Stop sending signals.
Send jamming signal.
My message is lost.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 31


Listen again

No signals now.
Wait for a random
length of time.
Send message again.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 32


CSMA/CD

 Collisions happen if a host transmits when there is a


signal on the cable but the host does not yet know
about it.
 Latency is the time a signal takes to travel to the far
end of a cable. The longer the cable and the more
intermediate devices, the more latency.

All clear

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 33


CSMA/CD

 If a host detects a collision while it is sending the first 64


bits of a frame then CSMA/CD works and the frame will
get resent later.
 If the host has sent 64 bits and then detects a collision, it
is too late. It will not resend.
 Latency must be small enough so that all collisions are
detected in time.
 This limits cable length and the number of intermediate
devices.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 34


Definitions

 Latency or propagation delay: the time it takes for a


signal to pass from source to destination.
 Bit time: the time it takes for a device to put one bit on
the cable. (Or for the receiving device to read it.)
 Slot time: the time for a signal to travel to the far end of
the largest allowed network and return.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 35


Interframe spacing

 The time between the end of one frame and the start of
the next frame.
 Gives the medium a chance to stabilise.
 Gives devices time to process the frame.
 Devices wait a minimum of 96 bit times after a frame
has arrived before they can send.
 9.6 microseconds for 10 Mbps Ethernet
 0.96 microseconds for 100 Mbps Ethernet

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 36


Different bandwidths

 Change from 10 Mbps to 100 Mbps


 The sender puts the bits on the cable 10 times as fast, but
they still travel at the same speed along the cable.
 Collision detected at the same time as before.

Still sending frame

Frame gone – too late

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 37


So… for CSMA/CD to work

 The greater the bandwidth, the closer a collision must


be in order to detect it in time.
 The greater the bandwidth, the shorter the possible
cable length from one end of the collision domain to the
other.
 10 Mbps can have reasonable lengths.
 100 Mbps can just manage 100 metres.
 1 Gbps needs special arrangements
 10 Gbps – not a chance. Can’t do collisions.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 38


Get rid of collisions

 Replace all hubs with switches.


 Each device has a private cable and gets the full
bandwidth.
 Use full duplex on each link.
 No collisions.
 Can use higher bandwidths.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 39


Legacy Ethernet

 10 Base-T – 10 Mbps, uses UTP cables


Transmits on wires 1/2, Receives on 3/6
Uses Manchester encoding.
 10 Base-2 and 10 Base-5 used coaxial cable. They are
obsolete and are no longer recognised by the
standards.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 40


Fast Ethernet

 100 Base-TX – 100 Mbps, uses UTP cables


Transmits on wires 1/2, Receives on 3/6
Uses 4B/5B encoding
 100 Base-FX – 100 Mbps, uses multimode fibre optic
cables.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 41


Gigabit Ethernet

 1000 base-T – 1Gbps uses UTP cables. Uses all 4 wire


pairs, transmitting and receiving at the same time on
the same wire.
Complex encoding and detection system.
 1000 Base-SX – uses multimode fibre, shorter
wavelength.
 1000 Base-LX – uses single or multimode fibre, longer
wavelength.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 42


10 Gbps Ethernet

 Still evolving
 Potential for operating over longer distances – MANs
and WANs
 Still uses same basic frame format as other Ethernet
versions.
 Higher bandwidths are planned.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 43


Hub and Switch

 Shared medium
Hub
 Shared bandwidth
 Collisions

 Point to point links


Switch
 Dedicated bandwidth
 Use full duplex – no collisions

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 44


Switching table

 Switch builds a switching table


matching its port numbers to the MAC
addresses of devices connected to
them.
 When a frame arrives, it reads the
destination MAC address, looks it up in
the table, finds the right port and
forwards the frame.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 45


Flooding

 If the switch does not find the destination address in its


table then it floods the frame through all ports except
the incoming port.
 Broadcast messages are flooded.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 46


Learning addresses

 The switch learns addresses by looking at the source


MAC address of an incoming frame.
 It then matches the address to the port where the frame
came in and puts the information in its table.
 Entries are time stamped and removed from the table
when the time runs out.
 They can be refreshed when another frame comes in
from the same host.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 47


ARP table

 A host wants to send a message.


 It knows the destination IP address and puts it in the
packet header.
 It looks in its ARP table and finds the corresponding
MAC address.
 It puts the MAC address in the frame header.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 48


Address resolution protocol

 A host wants to send a message.


 It knows the destination IP address.
 The destination MAC address is not in its ARP table.
 Host broadcasts “Calling 192.168.1.7, what is your MAC
address?”
 192.168.1.7 replies “My MAC address is…”
 Host sends message and updates ARP table.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 49


Remote addresses

 Host can see that destination IP address is on another


network
 It finds the IP address of the default gateway
 It sends an ARP request for the matching MAC address
of the default gateway
 Default gateway router replies and gives its own MAC
address
 Host sends message via router and updates ARP table.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 50


Proxy ARP

 If a host cannot tell that the destination IP address is on


another network, it will send an ARP request asking for
the matching MAC address
 The router will reply, giving its own MAC address
 The host will send the message via the router

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 51


Labs & Activities

Type Detail
PT 1.2.4 Mandatory*
Lab 1.3.1 Mandatory
PT 1.3.2 Mandatory
Lab 1.3.3 Review carefully

* If no previous Packet Tracer experience, else strongly recommended

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 52


© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 53
Planning and cabling

CCNA Exploration Semester 1 – Chapter 10

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 1


Chapter 10 topics

 Identify media for a LAN.


 Identify cables, connections and standards for a LAN.
 Compare straight through and crossover UTP cables
 Identify cables, connections and standards for a WAN.
 Make and use a console connection to a Cisco device.
 Design an addressing scheme for an internetwork.
 Compare and contrast network designs.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 2


Within a LAN

 Hubs and switches link hosts

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 3


Between networks

 Routers link networks together and act as gateways


between them.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 4


Hub

 Frame comes in. Hub regenerates it


and forwards it through all ports except
incoming port.
 Shared medium, shared bandwidth.
Hosts are in the same collision
domain.
 Cheap.
 For small LANs only.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 5


Switch

 Frame comes in. Switch regenerates


it and forwards it to destination only.
 Segments network into separate
collision domains.
 More expensive but better
performance than hub

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 6


Arranging switches

Star for Extended Star for Mesh to give


small larger networks, redundancy –
networks perhaps on several fault tolerance.
floors

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 7


Choice of switch ports

 10 Mbps?
 100 Mbps?
 10/100 Mbps?
 1Gbps?
 UTP or fibre optic?
 Allow for growth.
 Modular switch?
 What have our switches got?

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 8


Choice of router

 Expandability – will you want to add extra modules?


 Media – serial ports, Ethernet ports, UTP or fibre optic,
how many of each?
 Operating System Features – what do you want the
router to do? Will you have enough memory to upgrade
the operating system?
 What ports have our routers got?

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 9


Router interfaces

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 10


Rollover cable - console

 Our rollover cables a DB9 connector at one end and do


not need an adaptor.
 Rollover cables with RJ45 connectors both ends need
an adaptor.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 11


Hyperterminal

 You run a terminal emulator program such as


Hyperterminal on the PC in order to configure the
router.
 Windows has a built in Hyperterminal program.
 We usually use Hilgraeve Hyperterminal.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 12


Hyperterminal

 You set up the PC’s serial port as follows:


Bits per second: 9600 bps
Data bits: 8
Parity: None
Stop bits: 1
Flow control: None

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 13


Total length of cable allowed for
UTP connection?
Distance to allow between host and
switch or hub?
Distribution facility or
Horizontal cable Telecommunications room
Length?
Wall socket Patch panel

Patch cable
Patch cable Length? Length?

Host Switch

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 14


Total length of cable allowed for
UTP connection? 100 metres
Distance to allow between host and
switch or hub? 50 metres (cable runs
are not straight)
Distribution facility or
Horizontal cable Telecommunications room
90 metres
Wall socket Patch panel
Patch cable
Patch cable 5 metres 5 metres

Host Switch

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 15


Horizontal and vertical cable

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 16


Which cable?

 Length: UTP up to 100m, fibre optic longer


 UTP inside building. Fibre optic in or out.
 Cost: UTP cheaper than fibre optic
 Bandwidth: is it enough to meet requirements?
 Ease of installation: UTP is easier.
 EMI/RFI noise: may need fibre optic.
 High capacity link: may need fibre optic.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 17


Attenuation

 As a signal propagates (travels) it becomes weaker. This is


attenuation
 If a signal becomes too weak then the receiving host cannot
tell if it is meant to be a 0 or a 1.
 This limits cable length.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 18


UTP cable reminder

 Straight through cable –


same both ends

 Crossover cable – 1 swaps


with 3, 2 swaps with 6

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 19


Why cross over?

 Transmit needs to connect to receive

1
Transmit 2
Transmit
3
Receive 6
Receive

 The crossing over can happen in the cable or inside a


device.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 20


Where is the cross over?

 Switches and hubs have ports  PCs and routers have ports
that manage the cross over where there is no crossover
inside inside

 Straight through cable needed if you link a device in one group to


a device in the other group
 Crossover cable needed if you link devices in the same group

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 21


Switch ports

 Most switch ports are normally the MDIX type. They


manage the crossing over internally.
 Some switch ports can be changed between MDI and
MDIX either with a switch or in the configuration.
 Some switches can detect which sort of port is needed
and change automatically.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 22


WAN connection
V35 cable or
EIA/TIA-232
EIA/TIA-449
X21, V24,
HSSI
Supplier’s network

Supplier’s device on
customer’s premises Customer’s router
provides clocking

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 23


Simulating WAN in the lab

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 24


Split network into subnets

 To cut down the number of broadcasts. Splitting the


network into subnets also splits it into separate
broadcast domains.
 To provide different facilities for different groups of
users.
 For security. Traffic between subnets can be controlled.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 25


Addressing the network(s) 1

 Start with a topology diagram.


 All on one network, or will it be split into subnets?
 How many subnets?
 How many network bits do we need?
 n bits can provide 2n addresses
 How many bits are left for hosts?

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 26


Addressing the network(s) 2

On each subnet, count the number of:


 Router interfaces
 Switches
 Servers
 Admin workstations
 General workstations
 Printers
 IP phones

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 27


Addressing the network(s) 2

 How many host bits do we need?


 n bits can provide 2n addresses
 One for network, one for broadcast
 So 2n – 2 host addresses.
 2n – 2 could be 2, 6, 14, 30, 62, 126, 254, 510, 1022,
2046 and so on.
 Go for a number big enough to give us enough
addresses.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 28


How many subnets?

Include point to point


links.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 29


Bits to borrow

 n bits borrowed for subnetting gives you 2n subnets.


 So 1 bit gives 2 subnets, 2 bits give 4 subnets, 3 bits
give 8 subnets and so on.
 If you need 5 subnets, how many bits do you borrow?
 If you need 10 subnets, how many bits do you borrow?
3

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 30


Addressing example

 The example given in the curriculum shows subnetting


without VLSM using 172.16.0.0/22. (172.16.0.0 –
172.16.3.255)
 They produce 4 subnets each with 510 addresses.
 This is impossible. It will be corrected.
 You can do it if you start with 172.16.0.0/21 (172.16.0.0
– 172.16.7.255)

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 31


Addressing example no VLSM

172.16.0.0/21

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 32


What we have and need

 Given IP address 172.16.0.0/21


 That’s 172.16.0.0 to 172.16.7.255
 4 subnets needed:
Student LAN has 481 hosts
Instructor LAN has 69 hosts
Administrator LAN has 23 hosts
WAN has 2 hosts

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 33


Without VLSM – same size subnets
 Biggest subnet has 481 hosts.
 Formula for hosts is 2n – 2
 n = 9 gives 510 hosts (n = 8 gives only 254)
 So 9 host bits needed.
 That means 32 – 9 = 23 network bits
 /23 or subnet mask 255.255.254.0

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 34


Network addresses

 /23 so subnet mask in binary is


 11111111 11111111 11111110.00000000
 Octet 3 is the interesting one.
 Value of last network bit in octet 3 is 2
 So network numbers go up in 2s
172.16.0.0
172.16.2.0
172.16.4.0
172.16.6.0

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 35


Subnet with no VLSM

Network Subnet address Host range Broadcast


address

Student 172.16.0.0/23 172.16.0.1 - 172.16.1.255


172.16.1.254

Instructor 172.16.2.0/23 172.16.2.1 - 172.16.3.255


172.16.3.254

Admin 172.16.4.0/23 172.16.4.1 - 172.16.5.255


172.16.5.254

WAN 172.16.6.0/23 172.16.6.1 - 172.16.7.255


172.16.7.254

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 36


Addressing example with VLSM

172.16.0.0/22 is OK

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 37


What we have and need

 Given IP address 172.16.0.0/22


 That’s 172.16.0.0 to 172.16.3.255
 4 subnets needed:
Student LAN has 481 hosts
Instructor LAN has 69 hosts
Administrator LAN has 23 hosts
WAN has 2 hosts

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 38


With VLSM
 Student subnet has 481 hosts.
 Formula for hosts is 2n – 2
 n = 9 gives 510 hosts (n = 8 gives only 254)
 So 9 host bits needed.
 That means 32 – 9 = 23 network bits
 /23 or subnet mask 255.255.254.0
 Network address 172.16.0.0
 Broadcast address 172.16.1.255

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 39


With VLSM
 Instructor subnet has 69 hosts.
 Formula for hosts is 2n – 2
 n = 7 gives 126 hosts (n = 6 gives only 62)
 So 7 host bits needed.
 That means 32 – 7 = 25 network bits
 /25 or subnet mask 255.255.255.128
 Network address 172.16.2.0
 Broadcast address 172.16.2.127

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 40


With VLSM
 Admin subnet has 23 hosts.
 Formula for hosts is 2n – 2
 n = 5 gives 30 hosts (n = 4 gives only 14)
 So 5 host bits needed.
 That means 32 – 5 = 27 network bits
 /27 or subnet mask 255.255.255.224
 Network address 172.16.2.128
 Broadcast address 172.16.2.159

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 41


With VLSM
 WAN subnet has 2 hosts.
 Formula for hosts is 2n – 2
 n = 2 gives 2 hosts
 So 2 host bits needed.
 That means 32 – 2 = 30 network bits
 /30 or subnet mask 255.255.255.252
 Network address 172.16.2.160
 Broadcast address 172.16.2.163

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 42


Visually with VLSM
172.16.0.0 172.16.1.0 172.16.2.0 172.16.3.0

Instructor

Student
Admin

WAN
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 43
Case 2. Given 192.168.1.0/24

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 44


Subnet 192.168.1.0/24

 2 subnets with 28 hosts each (largest)


 5 host bits 25 - 2 = 30 would be just enough
 But allow for expansion: 6 host bits give 62
 Network bits 32 - 6 = 26
 so /26 or subnet mask 255.255.255.192
Network Subnet address Host range Broadcast address
B 192.168.1.0/26 192.168.1.1 192.168.1.63
- 192.168.1.62
E 192.168.1.64/26 192.168.1.65 - 192.168.1.127
192.168.1.126

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 45


Subnet 192.168.1.1/24

 1 subnets with 14 hosts


 4 host bits 24 - 2 = 14 would be just enough
 But allow for expansion: 5 host bits give 30
 Network bits 32 - 5 = 27
 so /27 or subnet mask 255.255.255.224
 0-127 range already used
Network Subnet address Host range Broadcast address
A 192.168.1.128/27 192.168.1.129 - 192.168.1.159
192.168.1.158

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 46


Subnet 192.168.1.1/24

 1 subnets with 7 hosts


 4 host bits 24 - 2 = 14 is enough
 Network bits 32 - 4 = 28
 so /28 or subnet mask 255.255.255.240
 0-159 range already used

Network Subnet address Host range Broadcast address


D 192.168.1.160/28 192.168.1.161 - 192.168.1.175
192.168.1.174

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 47


Subnet 192.168.1.1/24

 1 subnets with 2 hosts


 2 host bits 22 - 2 = 2 is enough
 Network bits 32 - 2 = 30
 so /30 or subnet mask 255.255.255.252
 0-175 range already used

Network Subnet address Host range Broadcast address


C 192.168.1.176/30 192.168.1.177 - 192.168.1.179
192.168.1.178

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 48


Subnet plan with VLSM
Network Subnet address Host range Broadcast address

B 192.168.1.0/26 192.168.1.1 192.168.1.63


- 192.168.1.62
E 192.168.1.64/26 192.168.1.65 - 192.168.1.127
192.168.1.126

A 192.168.1.128/27 192.168.1.129 - 192.168.1.159


192.168.1.158

D 192.168.1.160/28 192.168.1.161 - 192.168.1.175


192.168.1.174

C 192.168.1.176/30 192.168.1.177 - 192.168.1.179


192.168.1.178

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 49


Visual
B

One octet
available E

A
D

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 50


Summary
 Hierarchical Design model addresses performance,
scalability, maintainability & manageability issues.
 Traffic Analysis is used to monitor network
performance.
 Hierarchical Design Model is composed of 3 layers:
Access
Distribution
Core

 Switches selected for each layer must meet the needs


of each hierarchical layer as well as the needs of the
business.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 51


© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 52
Semester 2 Module 6
Routing and Routing
Protocols

1
Outline
 Introduction to Routing
 Static Routing Overview
 Dynamic Routing Overview

2
Introducing routing

 Routing is the process that a router uses to


forward packets toward the destination
network.
 A router makes decisions based upon the
destination IP address of a packet.
 In order to make the correct decisions,
routers must learn the direction to remote
networks.
3
Path determination
 A router determines the path of a packet from
one data link to another, using two basic
functions:
 A path determination function
 A switching function

4
 Path determination occurs at the network layer.
 The path determination function enables a router to
evaluate the paths to a destination and to establish
the preferred handling of a packet.
 The router uses the routing table to determine the
best path and proceeds to forward the packet using
the switching function.

5
 The switching function is the internal process
used by a router to accept a packet on one
interface and forward it to a second interface
on the same router.
 A key responsibility of the switching function
of the router is to encapsulate packets in the
appropriate frame type for the next data link.

6
Types of Routing Protocols
 When routers use dynamic routing, this
information is learned from other routers.
 When static routing is used, a network
administrator configures information about
remote networks manually.

7
Types of Routing Protocols
(cont.)

8
Routing Protocols: How to
determine the best path?
 1st Parameter: the administrative distance
(AD)
 AD is an optional parameter that gives a
measure of the reliability of the route.
 A lower value for the AD indicates the more
reliable route.
 The default AD when using next-hop address
is 1, while the default AD when using the
outgoing interface (connected) is 0.

9
Routing Protocols: How to
determine the best path? (cont.)
 2nd Parameter: Metrics
 Routing metrics are values used in
determining the advantage of one route over
another (often used for dynamic routing).

10
AD & Metrics Table
Classless/
Protocol AD Metrics Routing Algorithm Scalability Ful
Static
Routing Connected 0 Small

Next - hop 1 Small


Dynamic Bandwidth, Delay, Reliability, Hybrid: Distance Vector and
Routing EIGRP 90 Load, MTU Link state Large Classless

OSPF 110 Cost = 108/Bandwidth Link state Large Classless

IS - IS 115 Cost = 108/Bandwidth Link state Large Classless

RIP v1 & v2 120 Hop count Distance vector Small Classful

11
Introduction to routing/routed
protocols
 A routing protocol is the communication used
between routers.
 A routed protocol is used to direct user traffic.
 Examples of routed protocols are:
 Internet Protocol (IP)
 Internetwork Packet Exchange (IPX)

12
13
Autonomous systems
 An autonomous system (AS) is a collection of
networks under a common administration
sharing a common routing strategy.
 To the outside world, an AS is viewed as a
single entity.

14
 Autonomous systems (AS) provide the
division of the global internetwork into smaller
and more manageable networks.
 Each AS has its own set of rules and policies
and an AS number that will uniquely
distinguish it from other autonomous systems
throughout the world.

15
Autonomous systems and IGP
versus EGP
 Interior routing protocols are designed for use
in a network whose parts are under the
control of a single organization.
 Examples: RIP, EIGRP, OSPF
 An exterior routing protocol is designed for
use between two different networks that are
under the control of two different
organizations.
 Example: BGP
16
17
Convergence

 When all routers in an internetwork are


operating with the same knowledge, the
internetwork is said to have converged.
 Fast convergence is desirable because it
reduces the period of time in which routers
would continue to make incorrect routing
decisions.

18
Outline
 Introduction to Routing
 Static Routing Overview
 Dynamic Routing Overview

19
Static route operation

 Static route operations can be divided into these three


parts:
 Network administrator configures the route

 Router installs the route in the routing table

 Packets are routed using the static route

 Since a static route is manually configured, the


administrator must configure the static route on the
router using the ip route command.

20
Configuring static routes
 Use the following steps to configure static routes:
1. Determine all desired destination networks, their subnet
masks, and their gateways. A gateway can be either a
local interface or a next hop address that leads to the
desired destination.
2. Enter global configuration mode.
Router# configure terminal
3. Type the ip route command with a destination network
address (Dest. Net) and subnet mask ( Dest SM)
followed by their corresponding gateway from Step
one. Including an administrative distance (AD) is
optional.
Router(config)# ip route {Dest. Net} {Dest. SM} {Gateway} [AD]
21
22
4. Repeat 3rd Step for as many destination
networks as were defined in 1st Step .
5. Exit global configuration mode.
Router(config)# exit
6. Save the active configuration to NVRAM by
using the copy running-config startup-config
command or write memory command
Router# write memory

23
24
25
 If the router cannot reach the outgoing
interface that is being used in the route, the
route will not be installed in the routing table.
 This means if that interface is down, the route
will not be placed in the routing table.

26
Static Routing: Backup Route
 Sometimes static routes are used for backup
purposes.
 A static route can be configured on a router that will
only be used when the dynamically learned route
has failed.
 To use a static route in this manner, simply set the
administrative distance higher than that of the
dynamic routing protocol being used.

Router(config)#ip route 172.16.3.0 255.255.255.0 172.16.4.1 130

27
28
Configuring default route
forwarding

 Default routes are used to route packets with


destinations that do not match any of the
other routes in the routing table.
 A default route is actually a special static
route that uses this format:
Router(config)# ip route 0.0.0.0 0.0.0.0
[next-hop-address | outgoing interface]

29
30
31
Verifying static route
configuration
 Use the following steps to verify static route
configuration:
 In privileged mode enter the command show running-
config to view the active configuration.
 Verify that the static route has been correctly entered.
 Enter the command show ip route.
 Verify that the route that was configured is in the routing
table.

32
Troubleshooting static route
configuration

33
34
Outline
 Introduction to Routing
 Static Routing Overview
 Dynamic Routing Overview

35
The algorithms of dynamic routing
protocols

 Most routing algorithms can be classified into one of


two categories:
 distance vector (RIP, EIGRP)
 link-state (OSPF, IS - IS)
 The distance vector routing approach determines
the direction (vector) and distance to any link in the
internetwork.
 The link-state approach, also called shortest path
first, recreates the exact topology of the entire
internetwork.
36
Distance vector routing
protocol features

37
38
39
Link-state routing protocol
features

40
41
42
43
Dynamic Routing Configuration

44
Syntax

45
 For example: RIPv1 configuration
GAD(config)#router rip
GAD(config-router)#network 172.16.0.0

46
RIPv1
 Routing Information Protocol (RIP) was originally
specified in RFC 1058.
 Its key characteristics include the following:
 It is a distance vector routing protocol.
 Hop count is used as the metric for path selection.
 If the hop count is greater than 15, the packet is discarded.
 Routing updates are broadcast every 30 seconds, by
default.

47
RIPv1 vs. RIPv2
RIP
Feature
Version 1 Version 2
Algorithm Distance Vector (Bellman – Ford)
Administrative distance 120
Metrics Hop count
Update period 30s
Partial Updates No (sending entire routing table)
Convergence speed Slow due to routing loop
Yes (using the following mechanisms):
 Count to infinity (Max. Count = 16)
Prevent routing loop  Split horizon
 Triggered Updates
 Hold-down timer (180s)

Scalability Small
Transport protocol UDP (port 520)
Authentication No Yes (MD5)
Broadcasting Multicasting
Communication
255.255.255.255 224.0.0.9
VLSM Support No (not send subnet mask) Yes (send subnet mask)
48
RIPv2 configuration example
R1(config)# router rip
R1(config-router)# version 2
R1(config-router)# network 192.168.1.0 //LAN 1
R1(config-router)# network 192.168.1.192 //R1 – R2
R1(config-router)# network 192.168.1.204 //R1 – R4
R1(config-router)# no auto-summary
R1(config-router)# exit
R1(config)#

49
RIPv2 & Default Route
R4(config)# ip route 0.0.0.0 0.0.0.0 6.9.6.9 //default route
R4(config)# router rip
R4(config-router)# version 2
R4(config-router)# network …
R4(config-router)# redistribute static //advertise default
R4(config-router)# no auto-summary
R4(config-router)# end
R4# write memory

50
OSPF
 Open Shortest Path First (OSPF) is a nonproprietary
link-state routing protocol.
 The key characteristics of OSPF are as follows:
 It is a link-state routing protocol.
 Open standard routing protocol described in RFC 2328.
 Uses the SPF algorithm to calculate the lowest cost to a
destination.
 Routing updates are flooded as topology changes occur.

51
EIGRP
 EIGRP is a Cisco proprietary enhanced distance
vector routing protocol.
 The key characteristics of EIGRP are as follows:
 It is an enhanced distance vector routing protocol.
 Uses load balancing.
 Uses a combination of distance vector and link-state
features.
 Uses Diffused Update Algorithm (DUAL) to calculate the
shortest path.
 Routing updates are broadcast every 90 seconds or as
triggered by topology changes.

52
BGP
 Border Gateway Protocol (BGP) is an exterior
routing protocol.
 The key characteristics of BGP are as follows:
 It is a distance vector exterior routing protocol.
 Used between ISPs or ISPs and clients.
 Used to route Internet traffic between autonomous
systems.

53
54
Configuring EIGRP

Introducing EIGRP

BSCI v3.0—2-1
EIGRP Features

• Advanced distance vector • Flexible network design


• Fast convergence • Multicast and unicast instead of broadcast
address
• Support for VLSM and
• Manual summarization at any point
discontiguous subnets
• 100% loop-free classless routing
• Partial updates
• Easy configuration for WANs and LANs
• Support for multiple network-layer
protocols • Load balancing across equal-
and unequal-cost pathways
EIGRP Key Technologies

• Neighbor discovery/recovery
– Uses hello packets between neighbors
• Reliable Transport Protocol (RTP)
– Guaranteed, ordered delivery of EIGRP packets to all neighbors
• DUAL finite-state machine
– Selects lowest-cost, loop free, paths to each destination
• Protocol-dependent modules (PDMs)
– EIGRP supports IP, AppleTalk, and Novell NetWare.
– Each protocol has its own EIGRP module and operates
independently of any of the others that may be running.
EIGRP Neighbor Table
DUAL Terminology

• Selects lowest-cost, loop-free paths to each destination


• AD = cost between the next-hop router and the destination
• FD = cost from local router = AD of next-hop router + cost
between the local router and the next-hop router
• Lowest-cost = lowest FD
• (Current) successor = next-hop router with lowest-cost, loop
free path
• Feasible successor = backup router with loop-free path (AD
of feasible successor must be less than FD of current
successor route)
EIGRP Topology Table
EIGRP IP Routing Table
Example: EIGRP Tables
Router C Tables:
EIGRP Packets

• Hello: Establish neighbor relationships.


• Update: Send routing updates.
• Query: Ask neighbors about routing information.
• Reply: Respond to query about routing information.
• ACK: Acknowledge a reliable packet.
Initial Route Discovery
EIGRP Metric

• Same metric components as IGRP:


– Bandwidth
– Delay
– Reliability
– Loading
– MTU
• EIGRP metric is IGRP metric multiplied by 256.
EIGRP Metric Calculation

• By default, EIGRP metric:


Metric = bandwidth (slowest link) + delay (sum of delays)
• Delay = sum of the delays in the path, in tens of microseconds,
multiplied by 256
• Bandwidth = [107 / (minimum bandwidth link along the path, in kilobits
per second)] * 256
• Formula with default K values (K1 = 1, K2 = 0, K3 = 1, K4 = 0, K5 = 0):
Metric = [K1 * BW + ((K2 * BW) / (256 – load)) + K3 * delay]
• If K5 not equal to 0:
Metric = metric * [K5 / (reliability + K4)]:
EIGRP Metrics Calculation Example

A B C D Least bandwidth 64 kbps Total delay 6,000

A XY Z D Least bandwidth 256 kbps Total delay 8,000


• Delay is the sum of all the delays of the links along the paths:
Delay = [delay in tens of microseconds] x 256
• Bandwidth is the lowest bandwidth of the links along the paths:
Bandwidth = [10,000,000 / (bandwidth in kbps)] x 256
EIGRP Metrics Are Backward-Compatible
with IGRP
Summary

• EIGRP capabilities include fast convergence and support for VLSM,


partial updates, and multiple network layer protocols.
• EIGRP key technologies are neighbor discovery/recovery, RTP,
DUAL finite-state machine, and PDMs.
• EIGRP uses three tables: neighbor table, topology table, and
routing table. The routing table contains the best route to each
destination, called the successor route. A feasible successor route
is a backup route to a destination; it is kept in the topology table.
• EIGRP uses the same metric components as IGRP: delay,
bandwidth, reliability, load, and MTU.
• By default, EIGRP metric equals bandwidth (slowest link) plus delay

(sum of delays).
• EIGRP metrics are backward-compatible with IGRP; the EIGRP-
equivalent metric is the IGRP metric multiplied by 256.
Configuring EIGRP

Implementing and Verifying EIGRP

BSCI v3.0—2-16
Configuring EIGRP

Router(config)#
router eigrp autonomous-system-number
• Defines EIGRP as the IP routing protocol.
• All routers in the internetwork that must exchange EIGRP
routing updates must have the same autonomous system
number.

Router(config-router)#
network network-number [wildcard-mask]
• Identifies attached networks participating in EIGRP.
• The wildcard-mask is an inverse mask used to determine how to
interpret the address. The mask has wildcard bits, where 0 is a
match and 1 is “don’t care.”
Configuring EIGRP (Cont.)

Router(config-if)#
bandwidth kilobits
• Defines the interface’s bandwidth for the purposes of sending
routing update traffic.
Configuring EIGRP for IP

Network 192.168.1.0 is not configured on router A,


because it is not directly connected to router A.
Using the Wildcard Mask in EIGRP
Using and Configuring the ip default-
network Command for EIGRP
Example EIGRP Configuration
R2 EIGRP Configuration

<output omitted>
interface FastEthernet0/0
ip address 172.17.2.2 255.255.255.0

<output omitted>
interface Serial0/0/1
bandwidth 64
ip address 192.168.1.102 255.255.255.224

<output omitted>
router eigrp 100
network 172.17.2.0 0.0.0.255
network 192.168.1.0
Verifying EIGRP: show ip eigrp neighbors

R1#show ip eigrp neighbors


IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 192.168.1.102 Se0/0/1 10 00:07:22 10 2280 0 5
R1#
Verifying EIGRP: show ip route eigrp

R1#show ip route eigrp


D 172.17.0.0/16 [90/40514560] via 192.168.1.102, 00:07:01, Serial0/0/1
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D 172.16.0.0/16 is a summary, 00:05:13, Null0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
D 192.168.1.0/24 is a summary, 00:05:13, Null0

R1#show ip route
<output omitted>
Gateway of last resort is not set
D 172.17.0.0/16 [90/40514560] via 192.168.1.102, 00:06:55, Serial0/0/1
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D 172.16.0.0/16 is a summary, 00:05:07, Null0
C 172.16.1.0/24 is directly connected, FastEthernet0/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.96/27 is directly connected, Serial0/0/1
D 192.168.1.0/24 is a summary, 00:05:07, Null0
Verifying EIGRP: show ip protocols
R1#show ip protocols
Routing Protocol is "eigrp 100"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Default networks flagged in outgoing updates
Default networks accepted from incoming updates
EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
EIGRP maximum hopcount 100
EIGRP maximum metric variance 1
Redistributing: eigrp 100
EIGRP NSF-aware route hold timer is 240s
<output omitted>

Maximum path: 4
Routing for Networks:
172.16.1.0/24
192.168.1.0
Routing Information Sources:
Gateway Distance Last Update
(this router) 90 00:09:38
Gateway Distance Last Update
192.168.1.102 90 00:09:40
Distance: internal 90 external 170
Verifying EIGRP: show ip eigrp interfaces

R1#show ip eigrp interfaces


IP-EIGRP interfaces for process 100
Xmit Queue Mean Pacing Time Multicast Pending
Interface Peers Un/Reliable SRTT Un/Reliable Flow Timer Routes
Fa0/0 0 0/0 0 0/10 0 0
Se0/0/1 1 0/0 10 10/380 424 0
Verifying EIGRP: show ip eigrp topology

R1#show ip eigrp topology


IP-EIGRP Topology Table for AS(100)/ID(192.168.1.101)
Codes: P - Passive, A - Active, U - Update, Q - Query, R -
Reply,
r - reply Status, s - sia Status
P 192.168.1.96/27, 1 successors, FD is 40512000
via Connected, Serial0/0/1
P 192.168.1.0/24, 1 successors, FD is 40512000
via Summary (40512000/0), Null0
P 172.16.0.0/16, 1 successors, FD is 28160
via Summary (28160/0), Null0
P 172.16.1.0/24, 1 successors, FD is 28160
via Connected, FastEthernet0/0
P 172.17.0.0/16, 1 successors, FD is 40514560
via 192.168.1.102 (40514560/28160), Serial0/0/1
Verifying EIGRP: show ip eigrp traffic

R1#show ip eigrp traffic


IP-EIGRP Traffic Statistics for AS 100
Hellos sent/received: 429/192
Updates sent/received: 4/4
Queries sent/received: 1/0
Replies sent/received: 0/1
Acks sent/received: 4/3
Input queue high water mark 1, 0 drops
SIA-Queries sent/received: 0/0
SIA-Replies sent/received: 0/0
Hello Process ID: 113
PDM Process ID: 73
Summary

• The configuration commands for basic EIGRP include:


– router eigrp autonomous-system
– network network-number [wildcard-mask]
– bandwidth kilobits
• The optional wildcard-mask parameter in the network
command is an inverse mask used to determine how to
interpret the network-number parameter. A wildcard bit of 0 is a
match and of 1 is “don’t care.”
• Create and advertise a default route in an EIGRP AS with the
ip default-network network-number command.
Summary (Cont.)

• Use the show ip eigrp neighbors command to verify that the


router recognizes its neighbors. Use the show ip route eigrp
command to verify that the router recognizes routes from its
neighbors.
• Use the show ip protocols, show ip eigrp interfaces, show ip eigrp
neighbors, show ip eigrp topology, and show ip eigrp traffic
commands to verify EIGRP operations.
Configuring EIGRP

Configuring Advanced EIGRP Options

BSCI v3.0—2-32
EIGRP Route Summarization: Automatic

• Purpose: Smaller routing tables, smaller updates


• Automatic summarization:
– On major network boundaries, subnetworks are
summarized to a single classful (major) network.
– Automatic summarization occurs by default.
EIGRP Route Summarization: Manual

Manual summarization has the following characteristics:


• Summarization is configurable on a per-interface basis in any
router within a network.
• When summarization is configured on an interface, the router
immediately creates a route pointing to null0.
– Loop-prevention mechanism
• When the last specific route of the summary goes away, the
summary is deleted.
• The minimum metric of the specific routes is used as the metric
of the summary route.
Configuring Route Summarization

(config-router)#
no auto-summary
• Turns off automatic summarization for the EIGRP process

(config-if)#
ip summary-address eigrp as-number address mask
[admin-distance]

• Creates a summary address that this interface will generate


Manually Summarizing EIGRP Routes
Router C Routing Table

RouterC#show ip route
<output omitted>
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
D 172.16.0.0/16 is a summary, 00:00:04, Null0
D 172.16.1.0/24 [90/156160] via 10.1.1.2, 00:00:04, FastEthernet0/0
D 172.16.2.0/24 [90/20640000] via 10.2.2.2, 00:00:04, Serial0/0/1
C 192.168.4.0/24 is directly connected, Serial0/0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.2.2.0/24 is directly connected, Serial0/0/1
C 10.1.1.0/24 is directly connected, FastEthernet0/0
D 10.0.0.0/8 is a summary, 00:00:05, Null0
RouterC#
EIGRP Load Balancing

• Routes with a metric equal to the minimum metric are


installed in the routing table (equal-cost load balancing).
• There can be up to six entries in the routing table for the
same destination:
– The number of entries is configurable.
– The default is four.
– Set to 1 to disable load balancing.
EIGRP Unequal-Cost Load Balancing
Router(config-router)#
variance multiplier
• Allows the router to include routes with a metric smaller than the
multiplier value times the minimum metric route to that
destination
Variance Example

• Router E chooses router C to get to network Z, because it has


lowest FD of 20.
• With a variance of 2, router E chooses router B to get to network Z
(20 + 10 = 30) < [2 * (FD) = 40].
• Router D is never considered to get to network Z
(because 25 > 20).
Configuring WAN Links

• EIGRP supports different WAN links:


– Point-to-point links
– NBMA
• Multipoint links
• Point-to-point links
• EIGRP uses up to 50% of
bandwidth by default; this
bandwidth utilization can
be changed.
Bandwidth Utilization over WAN Interfaces

• Bandwidth utilization over point-to-point subinterfaces using


Frame Relay:
– Treats bandwidth as T1 by default
– Should manually configure bandwidth as the CIR of
the PVC
• Bandwidth utilization over multipoint Frame Relay, ATM, and
ISDN PRI:
– EIGRP uses the bandwidth on the physical interface
divided by the number of neighbors on that interface to
calculate the bandwidth attributed per neighbor.
Bandwidth Utilization over WAN Interfaces
(Cont.)

• Each PVC can have a different CIR, creating an EIGRP


packet-pacing problem.
• Multipoint interfaces:
– Convert these to point-to-point configuration or
manually configure bandwidth by multiplying the
lowest CIR by the number of PVCs.
EIGRP WAN Configuration:
Frame Relay Hub-and-Spoke Topology

• Configure each virtual Circuit as point-to-point, specify bandwidth = 1/10 of link capacity
• Increase EIGRP utilization to 50% of actual VC capacity
EIGRP WAN Configuration:
Hybrid Multipoint

• Configure lowest CIR virtual circuit as point-to-point, specify


bandwidth = CIR.
• Configure higher CIR virtual circuits as multipoint, combine CIRs.
Summary

• EIGRP performs automatic network-boundary summarization, but


administrators can disable automatic summarization and perform
manual route summarization on an interface-by-interface basis.
Summarizing routes creates smaller routing tables.
• Use the no auto-summary command to disable automatic
summarization. Use the ip summary-address eigrp command to
create a summary address.
• EIGRP performs equal-cost load balancing by default for up to
four paths (up to six paths can be supported).
• Use the variance command to configure unequal-cost load
balancing.
Summary (Cont.)

• EIGRP uses up to 50 percent of the bandwidth of an interface


by default. Because of the inherent differences in the
operational characteristics of WAN links, this default may not
be the best option for all WAN links.
• Use the ip bandwidth-percent eigrp command to configure
EIGRP bandwidth use across WAN links.
Configuring EIGRP

Configuring EIGRP Authentication

BSCI v3.0—2-48
Router Authentication

• Many routing protocols support authentication such that a router


authenticates the source of each routing update packet that it receives.
• Simple password authentication is supported by:
– IS-IS
– OSPF
– RIPv2
• MD5 authentication is supported by:
– OSPF
– RIPv2
– BGP
– EIGRP
Simple Password vs. MD5 Authentication

• Simple password authentication:


– Router sends packet and key.
– Neighbor checks whether key matches its key.
– Process not secure.
• MD5 authentication:
– Configure a key (password) and key ID; router generates a
message digest, or hash, of the key, key ID and message.
– Message digest is sent with packet; key is not sent.
– Process OS secure.
EIGRP MD5 Authentication

• EIGRP supports MD5 authentication.


• Router generates and checks every EIGRP packet. Router
authenticates the source of each routing update packet that
it receives.
• Configure a key (password) and key ID; each participating
neighbor must have same key configured.
MD5 Authentication

EIGRP MD5 authentication:


• Router generates a message digest, or hash, of the key,
key ID, and message.
• EIGRP allows keys to be managed using key chains.
• Specify key ID (number), key, and lifetime of key.
• First valid activated key, in order of key numbers, is used.
Configuring EIGRP MD5 Authentication

Router(config-if)#
ip authentication mode eigrp autonomous-system md5

• Specifies MD5 authentication for EIGRP packets

Router(config-if)#
ip authentication key-chain eigrp autonomous-system
name-of-chain

• Enables authentication of EIGRP packets using key in the


keychain
Configuring EIGRP MD5 Authentication
(Cont.)

Router(config)#
key chain name-of-chain

• Enters configuration mode for the keychain


Router(config-keychain)#
key key-id

• Identifies key and enters configuration mode for the keyid


Configuring EIGRP MD5 Authentication
(Cont.)
Router(config-keychain-key)#
key-string text

• Identifies key string (password)


Router(config-keychain-key)#
accept-lifetime start-time {infinite | end-time | duration
seconds}

• Optional: Specifies when key will be accepted for received


packets
Router(config-keychain-key)#
send-lifetime start-time {infinite | end-time | duration
seconds}

• Optional: Specifies when key can be used for sending packets


Example MD5 Authentication Configuration
R1 Configuration for MD5 Authentication
<output omitted>
key chain R1chain
key 1
key-string firstkey
accept-lifetime 04:00:00 Jan 1 2006 infinite
send-lifetime 04:00:00 Jan 1 2006 04:01:00 Jan 1 2006
key 2
key-string secondkey
accept-lifetime 04:00:00 Jan 1 2006 infinite
send-lifetime 04:00:00 Jan 1 2006 infinite
<output omitted>
interface FastEthernet0/0
ip address 172.16.1.1 255.255.255.0
!
interface Serial0/0/1
bandwidth 64
ip address 192.168.1.101 255.255.255.224
ip authentication mode eigrp 100 md5
ip authentication key-chain eigrp 100 R1chain
!
router eigrp 100
network 172.16.1.0 0.0.0.255
network 192.168.1.0
auto-summary
R2 Configuration for MD5 Authentication
<output omitted>
key chain R2chain
key 1
key-string firstkey
accept-lifetime 04:00:00 Jan 1 2006 infinite
send-lifetime 04:00:00 Jan 1 2006 infinite
key 2
key-string secondkey
accept-lifetime 04:00:00 Jan 1 2006 infinite
send-lifetime 04:00:00 Jan 1 2006 infinite
<output omitted>
interface FastEthernet0/0
ip address 172.17.2.2 255.255.255.0
!
interface Serial0/0/1
bandwidth 64
ip address 192.168.1.102 255.255.255.224
ip authentication mode eigrp 100 md5
ip authentication key-chain eigrp 100 R2chain
!
router eigrp 100
network 172.17.2.0 0.0.0.255
network 192.168.1.0
auto-summary
Verifying MD5 Authentication
R1#
*Jan 21 16:23:30.517: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor
192.168.1.102 (Serial0/0/1) is up: new adjacency

R1#show ip eigrp neighbors


IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 192.168.1.102 Se0/0/1 12 00:03:10 17 2280 0 14
R1#show ip route
<output omitted>
Gateway of last resort is not set
D 172.17.0.0/16 [90/40514560] via 192.168.1.102, 00:02:22, Serial0/0/1
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D 172.16.0.0/16 is a summary, 00:31:31, Null0
C 172.16.1.0/24 is directly connected, FastEthernet0/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.96/27 is directly connected, Serial0/0/1
D 192.168.1.0/24 is a summary, 00:31:31, Null0
R1#ping 172.17.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.17.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/15/16 ms
Troubleshooting MD5 Authentication

R1#debug eigrp packets


EIGRP Packets debugging is on
(UPDATE, REQUEST, QUERY, REPLY, HELLO, IPXSAP, PROBE, ACK, STUB, SIAQUERY,
SIAREPLY)
*Jan 21 16:38:51.745: EIGRP: received packet with MD5 authentication, key id = 1
*Jan 21 16:38:51.745: EIGRP: Received HELLO on Serial0/0/1 nbr 192.168.1.102
*Jan 21 16:38:51.745: AS 100, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0 pe
erQ un/rely 0/0

R2#debug eigrp packets


EIGRP Packets debugging is on
(UPDATE, REQUEST, QUERY, REPLY, HELLO, IPXSAP, PROBE, ACK, STUB, SIAQUERY,
SIAREPLY)
R2#
*Jan 21 16:38:38.321: EIGRP: received packet with MD5 authentication, key id = 2
*Jan 21 16:38:38.321: EIGRP: Received HELLO on Serial0/0/1 nbr 192.168.1.101
*Jan 21 16:38:38.321: AS 100, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0 pe
erQ un/rely 0/0
Troubleshooting MD5 Authentication
Problem
MD5 authentication on both R1 and R2, but R1 key 2 (that it uses when
sending) changed
R1(config-if)#key chain R1chain
R1(config-keychain)#key 2
R1(config-keychain-key)#key-string wrongkey

R2#debug eigrp packets


EIGRP Packets debugging is on
(UPDATE, REQUEST, QUERY, REPLY, HELLO, IPXSAP, PROBE, ACK, STUB, SIAQUERY,
SIAREPLY)
R2#
*Jan 21 16:50:18.749: EIGRP: pkt key id = 2, authentication mismatch
*Jan 21 16:50:18.749: EIGRP: Serial0/0/1: ignored packet from 192.168.1.101, opc
ode = 5 (invalid authentication)
*Jan 21 16:50:18.749: EIGRP: Dropping peer, invalid authentication
*Jan 21 16:50:18.749: EIGRP: Sending HELLO on Serial0/0/1
*Jan 21 16:50:18.749: AS 100, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0
*Jan 21 16:50:18.753: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 192.168.1.101
(Serial0/0/1) is down: Auth failure

R2#show ip eigrp neighbors


IP-EIGRP neighbors for process 100
R2#
Summary

• There are two types of router authentication: simple password and


MD5.
• When EIGRP authentication is configured, the router generates and
checks every EIGRP packet and authenticates the source of each
routing update packet that it receives. EIGRP supports MD5
authentication.
• To configure MD5 authentication, use the ip authentication mode eigrp
and ip authentication key-chain interface commands. The key chain
must also be configured, starting with the key chain command.
• Use debug eigrp packets to verify and troubleshoot MD5
authentication.
Configuring EIGRP

Using EIGRP in an Enterprise Network

BSCI v3.0—2-63
Factors That Influence EIGRP Scalability

• Quantity of routing information exchanged between peers;


without proper route summarization, this can be excessive.
• Number of routers that must be involved when a topology
change occurs.
• Depth of topology: the number of hops that information must
travel to reach all routers.
• Number of alternate paths through the network.
EIGRP Query Process

• Queries are sent when a route is lost and no feasible


successor is available.
• The lost route is now in active state.
• Queries are sent to all neighboring routers on all interfaces
except the interface to the successor.
• If the neighbors do not have the lost-route information,
queries are sent to their neighbors.
• If a router has an alternate route, it answers the query; this
stops the query from spreading in that branch of the
network.
Updates and Queries in Hub-and-Spoke
Topology

You do not want to use these paths!


EIGRP Stub

• The EIGRP stub routing feature improves network stability,


reduces resource utilization, and simplifies remote router
(spoke) configuration.
• Stub routing is commonly used in a hub-and-spoke topology.
• A stub router sends a special peer information
packet to all neighboring routers to report its status
as a stub router.
• A neighbor that receives a packet informing it of the stub
status does not query the stub router for any routes.
Configuring EIGRP Stub

Router(config-router)#
eigrp stub [receive-only|connected|static|summary]

• receive-only: Prevents the stub from sending any type of


route.
• connected: Permits stub to send connected routes
(may still need to redistribute).
• static: Permits stub to send static routes
(must still redistribute).
• summary: Permits stub to send summary routes.
• Default is connected and summary.
Limiting Updates and Queries:
Using EIGRP Stub
Example: eigrp stub Parameters

If stub connected is
configured:
• B will advertise
10.1.2.0/24 to A.
• B will not advertise
10.1.2.0/23, 10.1.3.0/23, or
10.1.4.0/24.
If stub summary is
configured:
• B will advertise
10.1.2.0/23 to A.
• B will not advertise
10.1.2.0/24, 10.1.3.0/24,
or 10.1.4.0/24.
Example: eigrp stub Parameters (Cont.)

If stub static is configured:


• B will advertise
10.1.4.0/24 to A.
• B will not advertise
10.1.2.0/24, 10.1.2.0/23,
or 10.1.3.0/24.
If stub receive-only is
configured:
• B will not advertise anything
to A, so A needs to have a
static route to the networks
behind B to reach them.
EIGRP Query Process Stuck in Active

• The router has to get all the replies from the neighbors with
an outstanding query before the router calculates the
successor information.
• If any neighbor fails to reply to the query within 3 minutes by
default, the route is SIA, and the router resets the neighbor
relationship with the neighbor that fails to reply.
Active Process Enhancement

Before After
Router A resets relationship to router B Router A sends an SIA-Query at half of the
normal active timer. Router B acknowledges
when the normal active timer expires. the query there by keeping the relationship up.
However, the problem is the link between
router B and C.
Graceful Shutdown
Summary

• Factors that affect network scalability include these:


– Amount of information exchanged between neighbors
– Number of routers
– Depth of the topology
– Number of alternate paths through the network
• When a route is lost and no feasible successor is available,
queries are sent to all neighboring routers on all interfaces.
• The eigrp stub command is used to enable the stub routing
feature, which improves network stability, reduces resource
utilization, and simplifies stub router configuration.
Summary (Cont.)

• After a route goes active and the query sequence is initiated, it


can only come out of the active state and move to passive state
when it receives a reply for every generated query. If the router
does not receive a reply to all the outstanding queries within 3
minutes (the default time), the route goes to the SIA state.
• The active process enhancement feature enables an EIGRP
router to monitor the progression of the search for a successor
route so that neighbor relationships are not reset unnecessarily.
• With graceful shutdown, a goodbye message is broadcast when
an EIGRP routing process is shut down, to inform adjacent
peers about the impending topology change.
Module Summary

• EIGRP starts by building a table of adjacent neighbors. Route


exchanges with these neighbors result in an EIGRP topology
table. The best EIGRP routes are moved into the IP routing
table.
• The configuration commands for basic EIGRP include these:
– router eigrp autonomous-system
– network network-number [wildcard-mask]
• Use the no auto-summary command to disable automatic
summarization. Use the ip summary-address eigrp command
to create a summary address. Use the variance command to
configure unequal-cost load balancing.
Module Summary (Cont.)

• To configure EIGRP MD5 authentication, use the ip


authentication mode eigrp and ip authentication key-chain
interface commands. The key chain must also be configured,
starting with the key chain command.
• Features such as stub routing, active process enhancement,
and graceful shutdown help improve network stability and
performance.
CCNA 3 v3.1 Module 2
Single-Area OSPF

© 2004, Cisco Systems, Inc. All rights reserved. 1


Objectives

© 2004, Cisco Systems, Inc. All rights reserved. 2


Overview of Link-State and Distance Vector
Routing

© 2004, Cisco Systems, Inc. All rights reserved. 3


Link-State Routing Features

© 2004, Cisco Systems, Inc. All rights reserved. 4


How Routing Information Is Maintained

© 2004, Cisco Systems, Inc. All rights reserved. 5


Link-State Routing Protocol Algorithms

© 2004, Cisco Systems, Inc. All rights reserved. 6


Advantages and Disadvantages of Link-
State Routing

© 2004, Cisco Systems, Inc. All rights reserved. 7


Comparing Distance Vector and Link-State
Routing

© 2004, Cisco Systems, Inc. All rights reserved. 8


OSPF Overview

OSPF is becoming the preferred IGP


protocol when compared with RIPv1 and
RIPv2 because it is scalable.
© 2004, Cisco Systems, Inc. All rights reserved. 9
OSPF Terminology

© 2004, Cisco Systems, Inc. All rights reserved. 10


More OSPF Terminology

© 2004, Cisco Systems, Inc. All rights reserved. 11


Comparing OSPF Link State with Distance
Vector Routing Protocols

© 2004, Cisco Systems, Inc. All rights reserved. 12


Shortest Path Algorithm

The best path is the lowest-cost path.


© 2004, Cisco Systems, Inc. All rights reserved. 13
OSPF Network Types

© 2004, Cisco Systems, Inc. All rights reserved. 14


OSPF Hello Protocol

© 2004, Cisco Systems, Inc. All rights reserved. 15


Steps in the Operation of OSPF

Discover neighbors

© 2004, Cisco Systems, Inc. All rights reserved. 16


Steps in the Operation of OSPF

Elect DR and BDR on Multi Access Network

© 2004, Cisco Systems, Inc. All rights reserved. 17


Steps in the Operation of OSPF

Selecting the Best Route

© 2004, Cisco Systems, Inc. All rights reserved. 18


Basic OSPF Configuration

© 2004, Cisco Systems, Inc. All rights reserved. 19


Basic OSPF Configuration

© 2004, Cisco Systems, Inc. All rights reserved. 20


Configuring OSPF Loopback Address and
Router Priority

© 2004, Cisco Systems, Inc. All rights reserved. 21


Setting OSPF Priority

The priorities can be set to any value from 0 to 255. A value


of 0 prevents that router from being elected. A router with
the highest OSPF priority will win the election for DR.
© 2004, Cisco Systems, Inc. All rights reserved. 22
Modifying OSPF Cost Metric

© 2004, Cisco Systems, Inc. All rights reserved. 23


Configuring OSPF Authentication

© 2004, Cisco Systems, Inc. All rights reserved. 24


Configuring OSPF Timers

© 2004, Cisco Systems, Inc. All rights reserved. 25


OSPF - Propagating a Default Route

© 2004, Cisco Systems, Inc. All rights reserved. 26


Common OSPF Configuration Issues

© 2004, Cisco Systems, Inc. All rights reserved. 27


Verifying OSPF Configuration

• show ip protocol
• show ip route
• show ip ospf interface
• shop ip ospf
• show ip ospf neighbor detail
• show ip ospf database

© 2004, Cisco Systems, Inc. All rights reserved. 28


The debug and clear Commands for OSPF
Verification

© 2004, Cisco Systems, Inc. All rights reserved. 29


Summary

© 2004, Cisco Systems, Inc. All rights reserved. 30


CCNA 3 v3.1 Module 5
LAN Design & Switches

© 2004, Cisco Systems, Inc. All rights reserved. 1


Objectives

© 2004, Cisco Systems, Inc. All rights reserved. 2


LAN Design Goals

© 2004, Cisco Systems, Inc. All rights reserved. 3


LAN Design Considerations

• The function and placement of servers


• Collision-detection issues
• Segmentation issues
• Broadcast domain issues

© 2004, Cisco Systems, Inc. All rights reserved. 4


Some terminologies while reading LAN Scheme

• MDF stands for Main Distribution Frame and IDF stands for
Intermediate Distribution Frame.The MDF is the main computer
room for servers, switches, routers, modems, etc. to reside.
• The IDF is a remote room or closet connected to the MDF by fiber
optic cable. In the IDF you can expect to find hubs, switches and
patch panels.
• HCC stands for Horizontal cross-connect and VCC stands for
Vertical Cross Connect. The HCC is a term in networks for a wiring
closet where the horizontal cabling connects to a patch panel
which is connected by backbone cabling to the MDF.
• The VCC is a term in networks for connection from MDF to IDF.

© 2004, Cisco Systems, Inc. All rights reserved. 5


Server Placement

© 2004, Cisco Systems, Inc. All rights reserved. 6


Collision Domain: Basic Shared Access

© 2004, Cisco Systems, Inc. All rights reserved. 7


Ethernet Technology: Segmentation

© 2004, Cisco Systems, Inc. All rights reserved. 8


Broadcast Domain

© 2004, Cisco Systems, Inc. All rights reserved. 9


LAN Design Methodology

• Gather requirements and expectations


• Analyze requirements and data
• Design the Layer 1, 2, and 3 LAN structure,
or topology
• Document the logical and physical
network implementation

© 2004, Cisco Systems, Inc. All rights reserved. 10


Gather Requirements and Expectations

© 2004, Cisco Systems, Inc. All rights reserved. 11


Analyze Requirements and Data

© 2004, Cisco Systems, Inc. All rights reserved. 12


Develop LAN Topology

© 2004, Cisco Systems, Inc. All rights reserved. 13


Developing a LAN Topology

© 2004, Cisco Systems, Inc. All rights reserved. 14


Documentation Logical Diagram

© 2004, Cisco Systems, Inc. All rights reserved. 15


Extended Star Topology in a Multi-Building
Campus

© 2004, Cisco Systems, Inc. All rights reserved. 16


Cut Sheet

© 2004, Cisco Systems, Inc. All rights reserved. 17


Setting Up VLAN Implementation

© 2004, Cisco Systems, Inc. All rights reserved. 18


Use Routers to Impose Logical Structure

© 2004, Cisco Systems, Inc. All rights reserved. 19


Addressing Maps

© 2004, Cisco Systems, Inc. All rights reserved. 20


Developing a Layer 1 LAN Topology

© 2004, Cisco Systems, Inc. All rights reserved. 21


Cable Characteristics and IEEE 802.3 Values

© 2004, Cisco Systems, Inc. All rights reserved. 22


Star Topology Using CAT 5 UTP

© 2004, Cisco Systems, Inc. All rights reserved. 23


Typical MDF in Star Topology

© 2004, Cisco Systems, Inc. All rights reserved. 24


Multi-Building Campus

© 2004, Cisco Systems, Inc. All rights reserved. 25


Extended Star Topology in a Multi-Building
Campus

© 2004, Cisco Systems, Inc. All rights reserved. 26


Extended Star Topology

© 2004, Cisco Systems, Inc. All rights reserved. 27


Documentation Logical Diagram

© 2004, Cisco Systems, Inc. All rights reserved. 28


Cut Sheet

© 2004, Cisco Systems, Inc. All rights reserved. 29


Developing a Layer 2 LAN Topology

© 2004, Cisco Systems, Inc. All rights reserved. 30


Microsegmentation of the Network

© 2004, Cisco Systems, Inc. All rights reserved. 31


Asymmetric Switching

© 2004, Cisco Systems, Inc. All rights reserved. 32


Collision Domain Size with Hubs

© 2004, Cisco Systems, Inc. All rights reserved. 33


Layer 2 Switch Collision Domains

© 2004, Cisco Systems, Inc. All rights reserved. 34


Layer 2 Switch with Hubs

© 2004, Cisco Systems, Inc. All rights reserved. 35


Layer 2 Migrate to Higher Bandwidth

© 2004, Cisco Systems, Inc. All rights reserved. 36


Layer 3 Router Implementation

© 2004, Cisco Systems, Inc. All rights reserved. 37


Use Routers to Impose Logical Structure

Routers provide scalability because they serve as


firewalls for broadcasts. They can also provide
scalability by dividing networks into subnetworks,
or subnets, based on Layer 3 addresses.
© 2004, Cisco Systems, Inc. All rights reserved. 38
Layer 3 Router for Segmentation

© 2004, Cisco Systems, Inc. All rights reserved. 39


Logical Addressing Mapped to Physical Network

© 2004, Cisco Systems, Inc. All rights reserved. 40


Addressing Maps

© 2004, Cisco Systems, Inc. All rights reserved. 41


Logical Network Maps and Addressing Maps

© 2004, Cisco Systems, Inc. All rights reserved. 42


Physical Network Maps

© 2004, Cisco Systems, Inc. All rights reserved. 43


Setting Up VLAN Implementation

© 2004, Cisco Systems, Inc. All rights reserved. 44


VLAN Communication

© 2004, Cisco Systems, Inc. All rights reserved. 45


Hierarchical Design Model: Access Layer

© 2004, Cisco Systems, Inc. All rights reserved. 46


Access Layer

© 2004, Cisco Systems, Inc. All rights reserved. 47


Functions of the Access Layer

© 2004, Cisco Systems, Inc. All rights reserved. 48


Features of Access Layer Switches

© 2004, Cisco Systems, Inc. All rights reserved. 49


Access Layer Switches

• Catalyst 1900 series


• Catalyst 2820 series
• Catalyst 2950 series
• Catalyst 4000 series
• Catalyst 5000 series

© 2004, Cisco Systems, Inc. All rights reserved. 50


Distribution Layer

© 2004, Cisco Systems, Inc. All rights reserved. 51


Distribution Layer

• In a switched network, the distribution layer


includes several functions such as the following:
Aggregation of the wiring-closet connections
Broadcast/multicast domain definition
VLAN routing
Any media transitions that need to occur
Security

© 2004, Cisco Systems, Inc. All rights reserved. 52


Distribution Layer Switches

Cisco Catalyst 2926G

<not pictured>
Cisco Catalyst 6000 Family
Cisco Catalyst 5000 Family

© 2004, Cisco Systems, Inc. All rights reserved. 53


Core Layer

The core layer is a high-speed switching


backbone. The core layer should be designed
to switch packets as fast as possible.
© 2004, Cisco Systems, Inc. All rights reserved. 54
Core Layer Switches

<not pictured>
Catalyst 6500 series

IGX 8400 series

Lightstream 1010

Catalyst 8500 series


© 2004, Cisco Systems, Inc. All rights reserved. 55
Summary

© 2004, Cisco Systems, Inc. All rights reserved. 56


CCNA 3 v3.1 Module 8
Virtual LANs

© 2004, Cisco Systems, Inc. All rights reserved. 1


Objectives

© 2004, Cisco Systems, Inc. All rights reserved. 2


Introduction to VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 3


VLANs

VLANs logically segment switched networks


based on an organization's functions, project
teams, or applications as opposed to a
physical or geographical basis.
© 2004, Cisco Systems, Inc. All rights reserved. 4
Broadcast Domains

© 2004, Cisco Systems, Inc. All rights reserved. 5


Example with 3 Broadcast Domains,
3 VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 6


Static VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 7


Dynamic VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 8


Port-Centric VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 9


VLAN Configuration

© 2004, Cisco Systems, Inc. All rights reserved. 10


Benefits of VLANs

• Easily move workstations on the LAN


• Easily add workstations to the LAN
• Easily change the LAN configuration
• Easily control network traffic
• Improve security

© 2004, Cisco Systems, Inc. All rights reserved. 11


Communicating Between VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 12


VLAN Types

© 2004, Cisco Systems, Inc. All rights reserved. 13


Inter-Switch Link

© 2004, Cisco Systems, Inc. All rights reserved. 14


Concurrent Transmissions in a Switch

© 2004, Cisco Systems, Inc. All rights reserved. 15


End-to-End VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 16


Static VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 17


Verifying VLAN Configuration

© 2004, Cisco Systems, Inc. All rights reserved. 18


Saving VLAN Configuration

Back up using the copy running-config


tftp command, or you can use the
HyperTerminal Capture Text feature to store
the configuration settings.
© 2004, Cisco Systems, Inc. All rights reserved. 19
VLAN Problem Isolation

© 2004, Cisco Systems, Inc. All rights reserved. 20


Problem Isolation in Catalyst Networks

© 2004, Cisco Systems, Inc. All rights reserved. 21


Preventing Broadcast Storms

© 2004, Cisco Systems, Inc. All rights reserved. 22


Common Problems in Troubleshooting
VLANs

© 2004, Cisco Systems, Inc. All rights reserved. 23


Catalyst IOS show vlan Command

© 2004, Cisco Systems, Inc. All rights reserved. 24


Catalyst IOS Keyword Syntax Description

© 2004, Cisco Systems, Inc. All rights reserved. 25


Catalyst IOS show spanning-tree
Command

© 2004, Cisco Systems, Inc. All rights reserved. 26


VLAN Troubleshooting Scenarios

A trunk link cannot be established between


a switch and a router
© 2004, Cisco Systems, Inc. All rights reserved. 27
VLAN Troubleshooting Scenarios

VTP is not properly propagating VLAN


configuration changes.
© 2004, Cisco Systems, Inc. All rights reserved. 28
VLAN Troubleshooting Scenarios

Dropped packets and loops


© 2004, Cisco Systems, Inc. All rights reserved. 29
Summary

© 2004, Cisco Systems, Inc. All rights reserved. 30


CCNA 3 v3.1 Module 9
Virtual Trunking Protocol

© 2004, Cisco Systems, Inc. All rights reserved. 1


Objectives

© 2004, Cisco Systems, Inc. All rights reserved. 2


History of Trunking

© 2004, Cisco Systems, Inc. All rights reserved. 3


Trunking Concepts

© 2004, Cisco Systems, Inc. All rights reserved. 4


Frame Filtering

© 2004, Cisco Systems, Inc. All rights reserved. 5


Frame Tagging

© 2004, Cisco Systems, Inc. All rights reserved. 6


Inter-Switch Link Protocol

© 2004, Cisco Systems, Inc. All rights reserved. 7


VLANs and Trunking

© 2004, Cisco Systems, Inc. All rights reserved. 8


Frame Tagging and Encapsulation Methods

© 2004, Cisco Systems, Inc. All rights reserved. 9


VTP Benefits

© 2004, Cisco Systems, Inc. All rights reserved. 10


VTP Concepts

The role of VTP is to maintain VLAN


configuration consistency across a
common network administration domain.
© 2004, Cisco Systems, Inc. All rights reserved. 11
VTP Mode Comparison

© 2004, Cisco Systems, Inc. All rights reserved. 12


VTP Operation

© 2004, Cisco Systems, Inc. All rights reserved. 13


VTP Implementation

• There are two types of VTP


advertisements:
Requests from clients that want information at
bootup
Responses from servers
• There are three types of VTP messages:
Advertisement requests
Summary advertisements
Subset advertisements

© 2004, Cisco Systems, Inc. All rights reserved. 14


VTP Basic Configuration Steps

© 2004, Cisco Systems, Inc. All rights reserved. 15


Inter-VLAN Routing

© 2004, Cisco Systems, Inc. All rights reserved. 16


Inter-VLAN Issues and Solutions

Two of the most common issues that arise


in a multiple-VLAN environment are as
follows:
– The need for end-user devices to
reach nonlocal hosts
– The need for hosts on different VLANs
to communicate

© 2004, Cisco Systems, Inc. All rights reserved. 17


VLAN Components

© 2004, Cisco Systems, Inc. All rights reserved. 18


Router on a Stick

© 2004, Cisco Systems, Inc. All rights reserved. 19


Physical and Logical Interfaces

© 2004, Cisco Systems, Inc. All rights reserved. 20


Dividing Physical Interfaces into
Subinterfaces

© 2004, Cisco Systems, Inc. All rights reserved. 21


Summary

© 2004, Cisco Systems, Inc. All rights reserved. 22


Manipulating Routing Updates

Operating a Network Using Multiple IP


Routing Protocols
Using Multiple IP Routing Protocols
Using Multiple Routing Protocols

• Interim during conversion


• Application-specific protocols
– One size does not always fit all.
• Political boundaries
– Groups that do not work well with others
• Mismatch between devices
– Multivendor interoperability
– Host-based routers
Redistributing Route Information
Using Seed Metrics

• Use the default-metric command to establish the seed metric


for the route or specify the metric when redistributing.
• Once a compatible metric is established, the metric will
increase in increments just like any other route.
Redistribution with Seed Metric
Summary

• Using multiple IP routing protocols can be a result of


migrating to a more advanced routing protocol, a
multivendor environment, political boundaries, or device
mismatch.
• The way that redistributed routes will appear in the routing
table will vary depending on the protocols being
redistributed and how they are redistributed.
• The seed metric is the metric associated with the
redistributed route and should make the route appear worse
than any internal route.
Manipulating Routing Updates

Configuring and Verifying Route Redistribution


Redistribution Supports All Protocols

RtrA(config)#router rip
RtrA(config-router)#redistribute ?
bgp Border Gateway Protocol (BGP)
connected Connected
eigrp Enhanced Interior Gateway Routing Protocol (EIGRP)
isis ISO IS-IS
iso-igrp IGRP for OSI networks
metric Metric for redistributed routes
mobile Mobile routes
odr On Demand stub Routes
ospf Open Shortest Path First (OSPF)
rip Routing Information Protocol (RIP)
route-map Route map reference
static Static routes
<cr>
Configuring Redistribution into RIP

RtrA(config)# router rip


RtrA(config-router)# redistribute ospf ?

<1-65535> Process ID
RtrA(config-router)# redistribute ospf 1 ?

match Redistribution of OSPF routes


metric Metric for redistributed routes
route-map Route map reference

<cr>

Default metric is infinity.


Redistributing into RIP
Configuring Redistribution into OSPF

RtrA(config)# router ospf 1


RtrA(config-router)# redistribute eigrp ?

<1-65535> Autonomous system number


RtrA(config-router)# redistribute eigrp 100 ?

metric Metric for redistributed routes


metric-type OSPF/IS-IS exterior metric type for redistributed routes
route-map Route map reference
subnets Consider subnets for redistribution into OSPF
tag Set tag for routes redistributed into OSPF

<cr>

• Default metric is 20.


• Default metric type is 2.
• Subnets do not redistribute by default.
Redistributing into OSPF
Configuring Redistribution into EIGRP

RtrA(config)# router eigrp 100


RtrA(config-router)# redistribute ospf ?

<1-65535> Process ID
RtrA(config-router)# redistribute ospf 1 ?

match Redistribution of OSPF routes


metric Metric for redistributed routes
route-map Route map reference

<cr>

• Default metric is infinity.


Redistributing into EIGRP

• Bandwidth in kilobytes = 10000


• Delay in tens of microseconds = 100
• Reliability = 255 (maximum)
• Load = 1 (minimum)
• MTU = 1500 bytes
Configuring Redistribution into IS-IS

RtrA(config)# router isis


RtrA(config-router)# redistribute eigrp 100 ?

level-1 IS-IS level-1 routes only


level-1-2 IS-IS level-1 and level-2 routes
level-2 IS-IS level-2 routes only
metric Metric for redistributed routes
metric-type OSPF/IS-IS exterior metric type for redistributed routes
route-map Route map reference
..
Output Omitted

Routes are introduced as Level 2 with a metric of 0 by default.


Redistributing into IS-IS
Example: Before Redistribution
Example: Before Redistribution (Cont.)
Example: Configuring Redistribution at
Router B
Example: Routing Tables After Route
Redistribution
Example: Routing Tables After
Summarizing Routes and Redistributions
Summary

• Several steps must be followed for accurate IP route


redistribution to occur.
• All IP routing protocols can be redistributed into RIP.
• When IP routing protocols are redistributed into OSPF,
additional commands are required.
• When IP routing protocols are redistributed into EIGRP,
a seed metric is required.
• IP routing protocols are usually redistributed into IS-IS
as Level 2 routes.
• There are several techniques for verifying IP route
redistribution.
Manipulating Routing Updates

Controlling Routing Update Traffic


Using the passive-interface Command
Controlling Routing Update Traffic
Configuring distribute-list

For outbound updates:


Router(config-router)#
distribute-list {access–list-number | name} out
[interface–name | routing–process [routing-process
parameter]]

For inbound updates:


Router(config-router)#
distribute-list [access–list-number | name] | [route-map
map-tag] in [interface-type interface-number]]

• Use an access list (or route map) to permit or deny routes.


• Can be applied to transmitted, received, or redistributed
routing updates.
Filtering Routing Updates with a
Distribute List

• Hides network 10.0.0.0 using interface filtering


Controlling Redistribution with
Distribute Lists
Route Maps

Route maps are similar to a scripting language for


these reasons:
• They work like a more sophisticated access list.
– They offer top-down processing.
– Once there is a match, leave the route map.
• Lines are sequence-numbered for easier editing.
– Insertion of lines
– Deletion of lines
• Route maps are named rather than numbered for easier
documentation.
• Match criteria and set criteria can be used, similar to the “if,
then” logic in a scripting language.
Route Map Applications

The common uses of route maps are as follows:


• Redistribution route filtering: a more sophisticated
alternative to distribute lists
• Policy-based routing: the ability to determine routing policy
based on criteria other than the destination network
• BGP policy implementation: the primary tool for defining
BGP routing policies
Route Map Operation

• A list of statements constitutes a route map.


• The list is processed top-down like an access list.
• The first match found for a route is applied.
• The sequence number is used for inserting or deleting
specific route map statements.
route-map my_bgp permit 10
{ match statements }
{ match statements }
{ set statements }
{ set statements }
route-map my_bgp deny 20
:: :: ::
:: :: ::
route-map my_bgp permit 30
:: :: ::
:: :: ::
Route Map Operation (Cont.)

• The match statement may contain multiple references.


• Multiple match criteria in the same line use a logical OR.
• At least one reference must permit the route for it to be a
candidate for redistribution.

• Each vertical match uses a logical AND.


• All match statements must permit the route for it to remain a
candidate for redistribution.
• Route map permit or deny determines if the candidate
will be redistributed.
route-map Commands
router(config)#
route-map map-tag [permit | deny] [sequence-number]
• Defines the route map conditions
router(config-route-map)#
match {conditions}

• Defines the conditions to match


router(config-route-map)#
set {actions}

• Defines the action to be taken on a match


router(config-router)#
redistribute protocol [process id] route-map map-tag
• Allows for detailed control of routes being redistributed into a
routing protocol
The match Command

router(config-route-map)#

• The match commands specify criteria to be matched.


• The associated route map statement permits or denies the
matching routes.
Match {options}
options :
ip address ip-access-list
ip route-source ip-access-list
ip next-hop ip-access-list
interface type number
metric metric-value
route-type [external | internal | level-1 | level-2 |local]

The set Command
router(config-route-map)#

• The set commands modify matching routes.


• The command modifies parameters in redistributed routes.
set {options}
options :
metric metric-value
metric-type [type-1 | type-2 | internal | external]
level [level-1 | level-2 | level-1-2 |stub-area | backbone]
ip next-hop next-hop-address
Route Maps and Redistribution Commands
Router(config)# router ospf 10
Router(config-router)# redistribute rip route-map redis-rip

• Routes matching either access list 23 or 29 are redistributed with an


OSPF cost of 500, external type 1.
• Routes permitted by access list 37 are not redistributed.
• All other routes are redistributed with an OSPF cost metric of 5000,
external type 2.
Router(config)# Router(config)#
route-map redis-rip permit 10 access-list 23 permit 10.1.0.0 0.0.255.255
match ip address 23 29 access-list 29 permit 172.16.1.0 0.0.0.255
set metric 500 access-list 37 permit 10.0.0.0 0.255.255.255
set metric-type type-1

route-map redis-rip deny 20


match ip address 37

route-map redis-rip permit 30


set metric 5000
set metric-type type-2
Administrative Distance

Route Source Default Distance


Connected interface 0
Static route 1
EIGRP summary route 5
External BGP 20
Internal EIGRP 90
IGRP 100
OSPF 110
IS-IS 115
RIPv1, RIPv2 120
External EIGRP 170
Internal BGP 200
Unknown 255
Administrative Distance (Cont.)
Modifying Administrative Distance

Router(config-router)#
distance administrative distance [address wildcard-mask
[access-list-number | name]]
• Used for all protocols except EIGRP and BGP redistribution

Router(config-router)#
distance eigrp internal-distance external-distance
• Used for EIGRP
Example: Redistribution Using
Administrative Distance
Example: Redistribution Using
Administrative Distance (Cont.)
Router P3R1
router ospf 1
redistribute rip metric 10000 metric-type 1 subnets
network 172.31.0.0 0.0.255.255 area 0
!
router rip
version 2
redistribute ospf 1 metric 5
network 10.0.0.0
no auto-summary

Router P3R2
router ospf 1
redistribute rip metric 10000 metric-type 1 subnets
network 172.31.3.2 0.0.0.0 area 0
!
router rip
version 2
redistribute ospf 1 metric 5
network 10.0.0.0
no auto-summary
Example: Redistribution Using
Administrative Distance (Cont.)
Example: Redistribution Using
Administrative Distance (Cont.)

hostname P3R1 hostname P3R2


! !
router ospf 1 router ospf 1
redistribute rip metric 10000 metric-type 1 redistribute rip metric 10000 metric-type 1
subnets subnets
network 172.31.0.0 0.0.255.255 area 0 network 172.31.3.2 0.0.0.0 area 0
distance 125 0.0.0.0 255.255.255.255 64 distance 125 0.0.0.0 255.255.255.255 64
! !
router rip router rip
version 2 version 2
redistribute ospf 1 metric 5 redistribute ospf 1 metric 5
network 10.0.0.0 network 10.0.0.0
no auto-summary no auto-summary
! !
access-list 64 permit 10.3.1.0 0.0.0.255 access-list 64 permit 10.3.1.0 0.0.0.255
access-list 64 permit 10.3.3.0 0.0.0.255 access-list 64 permit 10.3.3.0 0.0.0.255
access-list 64 permit 10.3.2.0 0.0.0.255 access-list 64 permit 10.3.2.0 0.0.0.255
access-list 64 permit 10.200.200.31 access-list 64 permit 10.200.200.31
access-list 64 permit 10.200.200.34 access-list 64 permit 10.200.200.34
access-list 64 permit 10.200.200.32 access-list 64 permit 10.200.200.32
access-list 64 permit 10.200.200.33 access-list 64 permit 10.200.200.33
Example: Redistribution Using
Administrative Distance (Cont.)
Summary

• The passive-interface command allows control of routing updates.


• A distribute list uses an ACL to control routing updates.
• A distribute list may be applied to an interface or to redistribute
routes.
• A route map is a complex tool used for manipulating and filtering
routes and uses match–set or if–then logic.
• A route-map can be used to streamline the route redistribution
process.
• Administrative distance is a value used by routers to evaluate the
route received from more than one routing protocol.
• Each IP routing protocol is assigned a value by Cisco, which can be
changed with Cisco IOS software commands.
• During route redistribution, administrative distance must be
manipulated at times to maintain routing accuracy.
Manipulating Routing Updates

Implementing Advanced Cisco IOS Features:


Configuring DHCP
DHCP in an Enterprise Network
Dynamic Host Configuration Protocol
Configuring a DHCP Server

Router(config)#ip dhcp pool [pool name]

• Enables a DHCP pool for use by hosts

Router(config-dhcp)#import all

• Imports DNS and WINS information from IPCP

Router(config-dhcp)#network [network address][subnet mask]

• Specifies the network and subnet mask of the pool

Router(config-dhcp)#default-router [host address]

• Specifies the default router for the pool to use


DHCP Server Configuration Example

ipdhcp database ftp://user:passwords@172.16.4.253/router-dhcp write-delay 120

ip dhcp excluded-address 172.16.1.100 172.16.1.103

ip dhcp excluded-address 172.16.2.100 172.16.2.103

ip dhcp pool 0

network 172.16.0.0/16

domain-name global.com

dns-server 172.16.1.102 172.16.2.102

netbios-name-server 172.16.2.103 172.16.2.103

default-router 172.16.1.100
Importing and Autoconfiguration
DHCP Client

Router (config-if)#

ip address dhcp

Enables a Cisco IOS device to obtain an IP address dynamically


from a DHCP server
Helper Addressing Overview

• Routers do not forward broadcasts, by default.


• Helper address provides selective connectivity.
Why Use a Helper Address?

• Sometimes clients do not know the server address.


• Helpers change broadcast to unicast to reach server.
IP Helper Address Commands

Router(config-if)#
ip helper-address address

• Enables forwarding and specifies destination address for main


UDP broadcast packets
• Changes destination address from broadcast to unicast or
directed broadcast address

Router(config)#
ip forward-protocol { udp [ port ] }

• Specifies which protocols will be forwarded


Multiple Servers: Remote Networks
Relay Agent Option Support
DHCP Verification Commands
router#
show ip dhcp database
• Displays recent activity on the DHCP database
router#
show ip dhcp server statistics
• Shows count information about statistics and messages sent
and received
router#
show ip route dhcp
• Displays routes added to the routing table by DHCP
router#
debug ip dhcp server {events | packets | linkage}
• Enables debugging on the DHCP server
Summary

• DHCP functions may be configured with Cisco IOS software.


• DHCP server can be configured.
• DHCP options can be configured.
• DHCP client can be configured.
• The IP helper address activates the DHCP relay agent in the
Cisco IOS device.
• DHCP relay services are supported.
Module Summary

• Using multiple IP routing protocols can be a result of


migrating to a more advanced routing protocol, a
multivendor environment, political boundaries, or device
mismatch.
• Route redistribution is possible between any two IP routing
protocols.
• It is necessary to use filters and modify administrative
distance during redistribution.
• A Cisco IOS device can be configured as a DHCP server,
relay agent, or client.
OSI transport layer

CCNA Exploration Semester 1 – Chapter 4

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 1


OSI transport layer

 OSI model layer 4


 TCP/IP model Transport layer

Application HTTP, FTP,


TFTP, SMTP
Presentation Data
stream etc
Application
Session
Transport Segment TCP, UDP Transport
Network Packet IP Internet
Data link Frame Ethernet,
Network Access
WAN
Physical Bits
technologies

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 2


Transport layer topics

 Roles of the transport layer


 TCP: Transport Control Protocol
 UDP: User Datagram Protocol

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 3


Purpose of transport layer

Responsible for the overall end-to-end transfer


of application data.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 4


Transport layer

 Enables multiple applications on the same device to


send data over the network at the same time
 Provides “reliability” and error handling if required.
(Checks if data has arrived and re-sends if it has not.)

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 5


Transport Layer TCP and UDP

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 6


Why two transport protocols?

 Some applications need their data to be complete with


no errors or gaps and they can accept a slight delay to
ensure this.
They use TCP. Reliable
 Some applications can accept occasional errors or
gaps in the data but they cannot accept any delay.
They use UDP.

Fast

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 7


TCP

 Sets up a connection with the receiving host before


sending data.
 Checks if segments have arrived and resends if they
were lost. (Reliability)
 Sorts segments into the right order before reassembling
the data.
 Sends at a speed to suit the receiving host. (Flow control)
 But – this takes time and resources.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 8


UDP

 Connectionless. Does not contact receiving host before


sending data.
 Does not check if data arrived and does not re-send.
 Does not sort into the right order.
 “Best effort”.
 Low overhead.
 Used for VoIP, streaming video, DNS, TFTP

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 9


TCP and UDP headers

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 10


Port numbers

 Used by TCP and UDP as a form of addressing.


 Identifies the application and the conversation.
 Common application protocols have default port
numbers e.g.
80 for HTTP 110 for POP3 mail
20/21 for FTP 23 for Telnet

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 11


Port numbers

Client PC uses port 49152. Client PC uses port 80.


Chosen at random. Identifies HTTP as
Remembers this to identify application.
application and conversation. Requesting a web page.

Port + IP address = socket. E.g. 192.168.2.12:80

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 12


Port numbers

 The Internet Assigned Numbers Authority (IANA) assigns port


numbers.
 Well Known Ports (0 to 1023) - Reserved for common services and
applications such as HTTP, FTP, Telnet, POP3, SMTP.
 Registered Ports (1024 to 49151) - Assigned to user processes or
applications. Can be dynamically selected by a client as its source
port.
 Dynamic or Private or Ephemeral Ports (49152 to 65535) – Can be
assigned dynamically to client applications when initiating a
connection.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 13


Netstat

Shows protocol, local address and port number,


foreign address and port number.
Unexpected connections may mean there is a
security problem.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 14


Segment and sequence

 Both TCP and UDP split application data into suitably


sized pieces for transport and re-assemble them on
arrival.
 TCP has sequence numbers in the segment headers. It
re-assembles segments in the right order.
 UDP has no sequence numbers. It assembles
datagrams in the order they arrive.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 15


Connection oriented

 TCP sets up a connection between end hosts before


sending data
 The two hosts go through a synchronization process to
ensure that both hosts are ready and know the initial
sequence numbers.
 This process is the Three-way handshake
 When data transfer is finished, the hosts send signals to
end the session.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 16


Three way handshake

Send SYN Receive SYN


seq = x seq = x
Send SYN
Receive SYN ack = y
ack = y seq = x+1
seq = x+1
Send ACK Receive ACK
ack = y+1 ack = y+1

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 17


Terminating connection

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 18


Expectational acknowledgement

 TCP checks that data has been received.


 The receiving host sends an acknowledgement giving
the sequence number of the byte that it expects next.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 19


Window size

 Controls how many bytes are sent before an acknowledgement is


expected.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 20


Lost segments

 Send bytes 1 to 2999


 Receive 1 to 2999, send ACK 3000
 Send bytes 3000 to 4999
 Receive 3000 to 3999, send ACK 4000
(bytes 4000 to 4999 were lost)
 Send bytes 4000 to 5999
 Lost segments are re-sent.
 If no ACK – send them all again

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 21


Flow control

 The initial window size is agreed during the three-way


handshake.
 If this is too much for the receiver and it loses data (e.g.
buffer overflow) then it can decrease the window size.
 If all is well then the receiver will increase the window
size.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 22


Comparison of TCP and UDP

 Both TCP and UDP use port numbers


 Both split up application data if necessary
 TCP sets up a connection
 TCP uses acknowledgements and re-sends
 TCP uses flow control
 TCP can re-assemble segments in the right order if
they arrive out of sequence
 UDP has less overhead so is faster

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 23


Summary
 Hierarchical Design model addresses performance,
scalability, maintainability & manageability issues.
 Traffic Analysis is used to monitor network
performance.
 Hierarchical Design Model is composed of 3 layers:
Access
Distribution
Core

 Switches selected for each layer must meet the needs


of each hierarchical layer as well as the needs of the
business.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 24


Labs & Activities

Type Detail
PT 1.2.4 Mandatory*
Lab 1.3.1 Mandatory
PT 1.3.2 Mandatory
Lab 1.3.3 Review carefully

* If no previous Packet Tracer experience, else strongly recommended

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 25


© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 26
Ch. 1 – Scaling IP Addresses
NAT/PAT and DHCP

CCNA 4 version 3.0


Rick Graziani
Cabrillo College
Note to instructors

• If you have downloaded this presentation from the Cisco Networking


Academy Community FTP Center, this may not be my latest version of
this PowerPoint.
• For the latest PowerPoints for all my CCNA, CCNP, and Wireless
classes, please go to my web site:
http://www.cabrillo.edu/~rgraziani/
• The username is cisco and the password is perlman for all of
my materials.
• If you have any questions on any of my materials or the curriculum,
please feel free to email me at graziani@cabrillo.edu (I really don’t
mind helping.) Also, if you run across any typos or errors in my
presentations, please let me know.
• I will add “(Updated – date)” next to each presentation on my web site
that has been updated since these have been uploaded to the FTP
center.
Thanks! Rick
Rick Graziani graziani@cabrillo.edu 2
Overview

• Identify private IP addresses as described in RFC 1918


• Discuss characteristics of NAT and PAT
• Explain the benefits of NAT
• Explain how to configure NAT and PAT, including static translation,
dynamic translation, and overloading
• Identify the commands used to verify NAT and PAT configuration
• List the steps used to troubleshoot NAT and PAT configuration
• Discuss the advantages and disadvantages of NAT
• Describe the characteristics of DHCP
• Explain the differences between BOOTP and DHCP
• Explain the DHCP client configuration process
• Configure a DHCP server
• Verify DHCP operation
• Troubleshoot a DHCP configuration
• Explain DHCP relay requests

Rick Graziani graziani@cabrillo.edu 3


Private addressing

• 172.16.0.0 – 172.31.255.255: 172.16.0.0/12


– Where does the /12 come from?

12 bits in common
10101100 . 00010000 . 00000000 . 00000000 – 172.16.0.0
10101100 . 00011111 . 11111111 . 11111111 – 172.31.255.255
-------------------------------------------------------------
10101100 . 00010000 . 00000000 . 00000000 – 172.16.0.0/12

Rick Graziani graziani@cabrillo.edu 4


Introducing NAT
and PAT

• NAT is designed to conserve IP addresses and enable networks to use


private IP addresses on internal networks.
• These private, internal addresses are translated to routable, public
addresses.
• NAT, as defined by RFC 1631, is the process of swapping one address for
another in the IP packet header.
• In practice, NAT is used to allow hosts that are privately addressed to access
the Internet.
• NAT translations can occur dynamically or statically.
• The most powerful feature of NAT routers is their capability to use port
address translation (PAT), which allows multiple inside addresses to map to
the same global address.
• This is sometimes called a many-to-one NAT.
Rick Graziani graziani@cabrillo.edu 5
NAT Example

• Inside local address – The IP address assigned to a host on the


inside network. This address is likely to be an RFC 1918 private
address.
• Inside global address – A legitimate (Internet routable or public) IP
address assigned the service provider that represents one or more
inside local IP addresses to the outside world.
• Outside local address – The IP address of an outside host as it is
known to the hosts on the inside network.
Rick Graziani graziani@cabrillo.edu 6
NAT Example

1 2

DA SA DA SA

128.23.2.2 10.0.0.3 .... Data 128.23.2.2 179.9.8.80 .... Data

IP Header IP Header
1 2
• The translation from Private source IP address to Public source IP
address.
Rick Graziani graziani@cabrillo.edu 7
NAT Example

1 2

• Inside local address – The IP address assigned to a host on the


inside network.
• Inside global address – A legitimate (Internet routable or public) IP
address assigned the service provider.
• Outside global address – The IP address assigned to a host on the
outside network. The owner of the host assigns this address.
Rick Graziani graziani@cabrillo.edu 8
NAT Example

4 3

DA SA DA SA

10.0.0.3 128.23.2.2 .... Data 179.9.8.80 128.23.2.2 .... Data

4 IP Header 3 IP Header

• Translation back, from Public destination IP address to Private


destination IP address.
Rick Graziani graziani@cabrillo.edu 9
NAT Example

• NAT allows you to have more than your allocated number of IP


addresses by using RFC 1918 address space with smaller mask.
• However, because you have to use your Public IP addresses for the
Internet, NAT still limits the number of hosts you can have access the
Internet at any one time (depending upon the number of hosts in your
public network mask.)
Rick Graziani graziani@cabrillo.edu 10
PAT – Port Address Translation

• PAT (Port Address Translation) allows you to use a single Public IP


address and assign it up to 65,536 inside hosts (4,000 is more
realistic).
• PAT modifies the TCP/UDP source port to track inside Host addresses.
• Tracks and translates SA, DA and SP (which uniquely identifies each
connection) for each stream of traffic.
Rick Graziani graziani@cabrillo.edu 11
PAT Example

NAT/PAT table
maintains translation
of:
DA, SA, SP
DA SA DP SP DA SA DP SP

128.23.2.2 10.0.0.3 80 1331 Data 128.23.2.2 179.9.8.80 80 3333 Data

IP Header TCP/UDP IP Header TCP/UDP


1 Header 2 Header

DA SA DP SP DA SA DP SP

128.23.2.2 10.0.0.2 80 1555 Data 128.23.2.2 179.9.8.80 80 2222 Data

IP Header TCP/UDP IP Header TCP/UDP


Header Header

Rick Graziani graziani@cabrillo.edu 12


PAT Example

NAT/PAT table maintains


translation of:
SA (DA), DA (SA), DP (SP)
DA SA DP SP DA SA DP SP

10.0.0.3 128.23.2.2 1331 80 Data 179.9.8.80 128.23.2.2 3333 80 Data

IP Header TCP/UDP IP Header TCP/UDP


4 Header 3 Header

DA SA DP SP DA SA DP SP

10.0.0.2 128.23.2.2 1555 80 Data 179.9.8.80 128.23.2.2 2222 80 Data

IP Header TCP/UDP IP Header TCP/UDP


Header Header

Rick Graziani graziani@cabrillo.edu 13


PAT – Port Address Translation

• With PAT a multiple private IP addresses can be translated by a single


public address (many-to-one translation).
• This solves the limitation of NAT which is one-to-one translation.

Rick Graziani graziani@cabrillo.edu 14


PAT – Port Address Translation

DA SA DP SP DA SA DP SP

128.23.2.2 10.0.0.3 80 1331 Data 128.23.2.2 179.9.8.80 80 3333 Data

IP Header TCP/UDP IP Header TCP/UDP


1 Header 2 Header

DA SA DP SP DA SA DP SP

128.23.2.2 10.0.0.2 80 1555 Data 128.23.2.2 179.9.8.80 80 2222 Data

IP Header TCP/UDP IP Header TCP/UDP


Header Header

From CCNP 2 curriculum”


• “As long as the inside global port numbers are unique for each inside
local host, NAT overload will work. For example, if the host at 10.1.1.5
and 10.1.1.6 both use TCP port 1234, the NAT router can create the
extended table entries mapping 10.1.1.5:1234 to 171.70.2.2:1234 and
10.1.1.6:1234 to 171.70.2.2:1235. In fact, NAT implementations do
not necessarily try to preserve the original port number.”
Rick Graziani graziani@cabrillo.edu 15
Configuring Static NAT

Rick Graziani graziani@cabrillo.edu 16


Configuring Dynamic NAT

Translate to these
outside addresses

Start
here

Source IP address
must match here

Rick Graziani graziani@cabrillo.edu 17


Configure PAT – Overload

• In this example a single Public IP addresses is used, using PAT, source


ports, to differentiate between connection streams.
Rick Graziani graziani@cabrillo.edu 18
Configure PAT – Overload

This is a different
example, using the IP
address of the outside
interface instead
specifying an IP
address

Rick Graziani graziani@cabrillo.edu 19


NAT/PAT Clear Commands

Rick Graziani graziani@cabrillo.edu 20


Verifying NAT/PAT

Rick Graziani graziani@cabrillo.edu 21


Troubleshooting NAT/PAT

Rick Graziani graziani@cabrillo.edu 22


Issues with NAT/PAT

• NAT also forces some applications that use IP addressing to stop functioning because it
hides end-to-end IP addresses.
• Applications that use physical addresses instead of a qualified domain name will not
reach destinations that are translated across the NAT router.
• Sometimes, this problem can be avoided by implementing static NAT mappings.

Rick Graziani graziani@cabrillo.edu 23


DHCP
Dynamic Host Configuration Protocol

The first several slides should be a review of DHCP


from CCNA 1.
We will start with the discussion of configuring DHCP on
a Cisco router.
Please read the online curriculum if you need a review.
Introducing DHCP

Rick Graziani graziani@cabrillo.edu 25


BOOTP and DHCP differences

There are two primary differences between DHCP and BOOTP:

• DHCP defines mechanisms through which clients can be assigned an


IP address for a finite lease period.
– This lease period allows for reassignment of the IP address to
another client later, or for the client to get another assignment, if
the client moves to another subnet.
– Clients may also renew leases and keep the same IP address.
• DHCP provides the mechanism for a client to gather other IP
configuration parameters, such as WINS and domain name.

Rick Graziani graziani@cabrillo.edu 26


Major DHCP features

Rick Graziani graziani@cabrillo.edu 27


DHCP Operation

Rick Graziani graziani@cabrillo.edu 28


Configuring DHCP

• Note: The network statement enables DHCP on any router


interfaces belonging to that network.
– The router will act as a DHCP server on that interface.
– It is also the pool of addresses that the DHCP server will
use.
Rick Graziani graziani@cabrillo.edu 29
Configuring DHCP

• The ip dhcp excluded-address command configures the router to


exclude an individual address or range of addresses when assigning
addresses to clients.
• Other IP configuration values such as the default gateway can be set from the
DHCP configuration mode.
• The DHCP service is enabled by default on versions of Cisco IOS that support
it. To disable the service, use the no service dhcp command.
• Use the service dhcp global configuration command to re-enable the DHCP
server process.
Rick Graziani graziani@cabrillo.edu 30
Configuring DHCP

• DHCP options

Rick Graziani graziani@cabrillo.edu 31


Verifying and Troubleshooting DHCP

Rick Graziani graziani@cabrillo.edu 32


DHCP Relay

• DHCP clients use IP broadcasts to find the DHCP server on the


segment.
• What happens when the server and the client are not on the same
segment and are separated by a router?
– Routers do not forward these broadcasts.
• When possible, administrators should use the ip helper-address
command to relay broadcast requests for these key UDP services.
Rick Graziani graziani@cabrillo.edu 33
Using helper addresses

Rick Graziani graziani@cabrillo.edu 34


Configuring IP helper addresses

By default, the ip helper-address command forwards the eight UDPs services.

Rick Graziani graziani@cabrillo.edu 35


Configuring IP helper addresses

Broadcast Unicast
To configure RTA e0, the interface that receives the Host A broadcasts, to
relay DHCP broadcasts as a unicast to the DHCP server, use the
following commands:
RTA(config)#interface e0
RTA(config-if)#ip helper-address 172.24.1.9
Rick Graziani graziani@cabrillo.edu 36
Configuring IP helper addresses

Broadcast Unicast
Helper address configuration that relays broadcasts to all servers on the
segment.
RTA(config)#interface e0
RTA(config-if)#ip helper-address 172.24.1.255
But will RTA forward the broadcast?
Rick Graziani graziani@cabrillo.edu 37
Directed Broadcast

• Notice that the RTA interface e3, which connects to the server farm, is not
configured with helper addresses.
• However, the output shows that for this interface, directed broadcast
forwarding is disabled.
• This means that the router will not convert the logical broadcast 172.24.1.255
into a physical broadcast with a Layer 2 address of FF-FF-FF-FF-FF-FF.
• To allow all the nodes in the server farm to receive the broadcasts at Layer 2,
e3 will need to be configured to forward directed broadcasts with the following
command:
RTA(config)#interface e3
RTA(config-if)#ip
Rick Graziani graziani@cabrillo.edu
directed-broadcast 38
Configuring IP helper addresses

L3 Broadcast L2 Broadcast

Helper address configuration that relays broadcasts to all servers on the


segment.
RTA(config)#interface e0
RTA(config-if)#ip helper-address 172.24.1.255
RTA(config)#interface e3
RTA(config-if)#ip directed-broadcast
Rick Graziani graziani@cabrillo.edu 39
Ch. 1 – Scaling IP Addresses
NAT/PAT and DHCP

CCNA 4 version 3.0


Rick Graziani
Cabrillo College
Implementing IPv6

Introducing IPv6
Why Do We Need a Larger Address Space?

• Internet population
– Approximately 973 million users in November 2005
– Emerging population and geopolitical and address space
• Mobile users
– PDA, pen-tablet, notepad, and so on
– Approximately 20 million in 2004
• Mobile phones
– Already 1 billion mobile phones delivered by the industry
• Transportation
– 1 billion automobiles forecast for 2008
– Internet access in planes – Example: Lufthansa
• Consumer devices
– Sony mandated that all its products be IPv6-enabled by 2005
– Billions of home and industrial appliances
IPv6 Advanced Features

Larger address space Simpler header


• Global reachability and • Routing efficiency
flexibility • Performance and forwarding
• Aggregation rate scalability
• Multihoming • No broadcasts
• Autoconfiguration • No checksums
• Plug-and-play • Extension headers
• End to end without NAT • Flow labels
• Renumbering
IPv6 Advanced Features (Cont.)

Mobility and security Transition richness


• Mobile IP RFC-compliant • Dual stack
• IPsec mandatory • 6to4 tunnels
(or native) for IPv6 • Translation
Larger Address Space

IPv4
• 32 bits or 4 bytes long
– ~
= 4,200,000,000 possible addressable nodes
IPv6
• 128 bits or 16 bytes: four times the bits of IPv4
– ~
= 3.4 * 1038 possible addressable nodes
– ~
= 340,282,366,920,938,463,374,607,432,768,211,456
– ~ 28
= 5 * 10 addresses per person
Larger Address Space Enables
Address Aggregation

• Aggregation of prefixes announced in the global routing table


• Efficient and scalable routing
• Improved bandwidth and functionality for user traffic
Summary

• IPv6 is a powerful enhancement to IPv4. Features that offer


functional improvement include a larger address space,
simplified header, and mobility and security.
• IPv6 increases the number of address bits by a factor of four,
from 32 to 128.
Implementing IPv6

Defining IPv6 Addressing


Simple and Efficient Header

A simpler and more efficient header means:


• 64-bit aligned fields and fewer fields
• Hardware-based, efficient processing
• Improved routing efficiency and performance
• Faster forwarding rate with better scalability
IPv4 and IPv6 Header Comparison
IPv6 Extension Headers

Simpler and more efficient header means:


• IPv6 has extension headers.
• It handles the options more efficiently.
• It enables faster forwarding rate and end nodes processing.
IPv6 Address Representation

Format:
• x:x:x:x:x:x:x:x, where x is a 16-bit hexadecimal field
– Case-insensitive for hexadecimal A, B, C, D, E, and F
• Leading zeros in a field are optional:
– 2031:0:130F:0:0:9C0:876A:130B
• Successive fields of 0 can be represented as ::, but only once per address.
Examples:
– 2031:0000:130F:0000:0000:09C0:876A:130B
– 2031:0:130f::9c0:876a:130b
– 2031::130f::9c0:876a:130b—incorrect
– FF01:0:0:0:0:0:0:1 FF01::1
– 0:0:0:0:0:0:0:1 ::1
– 0:0:0:0:0:0:0:0 ::
IPv6 Address Types

IPv6 uses:
• Unicast
– Address is for a single interface.
– IPv6 has several types (for example, global and IPv4 mapped).
• Multicast
– One-to-many
– Enables more efficient use of the network
– Uses a larger address range
• Anycast
– One-to-nearest (allocated from unicast address space).
– Multiple devices share the same address.
– All anycast nodes should provide uniform service.
– Source devices send packets to anycast address.
– Routers decide on closest device to reach that destination.
– Suitable for load balancing and content delivery services.
IPv6 Global Unicast (and Anycast)
Addresses

IPv6 has same address format for global unicast and for anycast.
• Uses a global routing prefix—a structure that enables aggregation upward,
eventually to the ISP.
• A single interface may be assigned multiple addresses of any type (unicast,
anycast, multicast).
• Every IPv6-enabled interface must contain at least one loopback (::1/128) and one
link-local address.
• Optionally, every interface can have multiple unique local and global addresses.
• Anycast address is a global unicast address assigned to a set of interfaces
(typically on different nodes).
• IPv6 anycast is used for a network multihomed to several ISPs that have multiple
connections to each other.
IPv6 Unicast Addressing

• IPv6 addressing rules are covered by multiple RFCs.


– Architecture defined by RFC 4291.
• Unicast: One to one
– Global
– Link local (FE80::/10)
• A single interface may be assigned multiple IPv6 addresses
of any type: unicast, anycast, or multicast.
Summary

• The IPv6 header has 40 octets and is simpler and more


efficient than the IPv4 header.
• IPv6 addresses use 16-bit hexadecimal number fields
separated by colons (:) to represent the 128-bit addressing
format.
• The three types of IPv6 addresses are unicast, multicast, and
anycast.
Implementing IPv6

Implementing Dynamic IPv6 Addresses


Aggregatable Global Unicast Addresses

• Cisco uses the extended universal identifier (EUI)-64 format


to do stateless autoconfiguration.
• This format expands the 48-bit MAC address to 64 bits by
inserting “FFFE” into the middle 16 bits.
• To make sure that the chosen address is from a unique
Ethernet MAC address, the universal/local (U/L bit) is set to 1
for global scope (0 for local scope).
Link-Local Address

• Link-local addresses have a scope limited to the link and are dynamically
created on all IPv6 interfaces by using a specific link-local prefix FE80::/10
and a 64-bit interface identifier.
• Link-local addresses are used for automatic address configuration, neighbor
discovery, and router discovery. Link-local addresses are also used by many
routing protocols.
• Link-local addresses can serve as a way to connect devices on the same
local network without needing global addresses.
• When communicating with a link-local address, you must specify the
outgoing interface because every interface is connected to FE80::/10.
EUI-64 to IPv6 Interface Identifier

A modified EUI-64 address is formed by inserting “FFFE” and


“complementing” a bit identifying the uniqueness of the MAC
address.
EUI-64 to IPv6 Interface Identifier (Cont.)

• A modified EUI-64 address is formed by inserting “FFFE” and


“complementing” a bit identifying the uniqueness of the MAC
address.
EUI-64 to IPv6 Interface Identifier (Cont.)

• A modified EUI-64 address is formed by inserting “FFFE” and


“complementing” a bit identifying the uniqueness of the MAC
address.
Multicasting
Examples of Permanent Multicast
Addresses
Anycast

• An IPv6 anycast address is a global unicast address that is


assigned to more than one interface.
Stateless Autoconfiguration
A Standard Stateless Autoconfiguration

• Stage 1: The PC sends a router solicitation to request a prefix


for stateless autoconfiguration.
A Standard Stateless Autoconfiguration
(Cont.)

• Stage 2: The router replies with a router advertisement.


IPv6 Mobility
Summary

• The MAC address may form a portion of the IPv6 system ID.
• IPv6 multicast addresses are defined by the prefix FF00::/8.
Multicast is frequently used in IPv6 and replaces broadcast.
• IPv6 provides an efficient means to implement mobile IP,
which has not been possible with IPv4.
Implementing IPv6

Using IPv6 with OSPF and Other Routing Protocols


IPv6 Routing Protocols

• IPv6 routing types


– Static
– RIPng (RFC 2080)
– OSPFv3 (RFC 2740)
– IS-IS for IPv6
– MP-BGP4 (RFC 2545/2858)
– EIGRP for IPv6
• The ipv6 unicast-routing command is required to enable IPv6 before
any routing protocol configured.
RIPng

Same as IPv4
• Distance vector, radius of 15 hops, split horizon, and poison
reverse
• Based on RIPv2
Updated features for IPv6
• IPv6 prefix, next-hop IPv6 address
• Uses the multicast group FF02::9, the all-rip-routers multicast
group, as the destination address for RIP updates
• Uses IPv6 for transport
• Named RIPng
OSPF Version 3 (OSPFv3) (RFC 2740)

Similar to IPv4
• Same mechanisms, but a major rewrite of the internals of the
protocol
Updated features for IPv6
• Every IPv4-specific semantic removed
• Carry IPv6 addresses
• Link-local addresses used as source
• IPv6 transport
• OSPF for IPv6 currently an IETF proposed standard
Integrated Intermediate
System-to-Intermediate System (IS-IS)

• Same as for IPv4


• Extensions for IPv6:
– Two new Type, Length, Value (TLV) attributes:
• IPv6 reachability (with 128-bit prefix)
• IPv6 interface address (with 128 bits)
– New protocol identifier
– Not yet an IETF standard
Multiprotocol Border Gateway Protocol
(MP-BGP) (RFC 2858)

Multiprotocol extensions for BGP4:


• Enables protocols other than IPv4
• New identifier for the address family
IPv6 specific extensions:
• Scoped addresses: NEXT_HOP contains a global IPv6
address and potentially a link-local address
(only when there is a link-local reachability with the peer).
• NEXT_HOP and Network Layer Reachability Information
(NLRI) are expressed as IPv6 addresses and prefix in the
multiprotocol attributes.
OSPFv3—Hierarchical Structure

• Topology of an area is invisible


from outside of the area:
– LSA flooding is bounded by
area.
– SPF calculation is performed
separately for each area.
• Backbones must be
contiguous.
• All areas must have
a connection to
the backbone:
– Otherwise a virtual
link must be used to
connect to the
backbone.
OSPFv3—Similarities with OSPFv2

• OSPFv3 is OSPF for IPv6 (RFC 2740)


– Based on OSPFv2, with enhancements
– Distributes IPv6 prefixes
– Runs directly over IPv6
• OSPFv3 and OSPFv2 can be run concurrently, because each
address family has a separate SPF (ships in the night).
• OSPFv3 uses the same basic packet types as OSPFv2:
– Hello
– Database description (DBD)
– Link state request (LSR)
– Link state update (LSU)
– Link state acknowledgment (ACK)
OSPFv3—Similarities with OSPFv2

• Neighbor discovery and adjacency formation mechanism are


identical.
• RFC-compliant NBMA and point-to-multipoint topology
modes are supported. Also supports other modes from
Cisco, such as point-to-point and broadcast, including the
interface.
• LSA flooding and aging mechanisms are identical.
Enhanced Routing Protocol Support
Differences from OSPFv2
• OSPF packet type
– OSPFv3 has the same five packet types, but some fields have
been changed.

• All OSPFv3 packets have a 16-byte header vs. the 24-byte header in
OSPFv2.
OSPFv3 Differences from OSPFv2

OSPFv3 protocol processing is per link, not per


subnet
• IPv6 connects interfaces to links.
• Multiple IPv6 subnets can be assigned to a single link.
• Two nodes can talk directly over a single link, even though
they do not share a common subnet.
• The terms “network” and “subnet” are being replaced with
“link.”
• An OSPF interface now connects to a link instead of to a
subnet.
OSPFv3 Differences from OSPFv2 (Cont.)

Multiple OSPFv3 protocol instances can now run


over a single link
• This structure allows separate autonomous systems, each
running OSPF, to use a common link. A single link could
belong to multiple areas.
• Instance ID is a new field that is used to allow multiple
OSPFv3 protocol instances per link.
• In order to have two instances talk to each other, they need
to have the same instance ID. By default, it is 0, and for any
additional instance it is increased.
OSPFv3 Differences from OSPFv2 (Cont.)

Multicast addresses:
• FF02::5—Represents all SPF routers on the link-local scope; equivalent to
224.0.0.5 in OSPFv2
• FF02::6—Represents all DR routers on the link-local scope; equivalent to
224.0.0.6 in OSPFv2
Removal of address semantics
• IPv6 addresses are no longer present in OSPF packet header (part of
payload information).
• Router LSA and network LSA do not carry IPv6 addresses.
• Router ID, area ID, and link-state ID remain at 32 bits.
• DR and BDR are now identified by their router ID and not by their IP address.
Security
• OSPFv3 uses IPv6 AH and ESP extension headers instead of variety of the
mechanisms defined in OSPFv2.
LSA Overview

LSA Function
LSA Type
Code
Router LSA 1 0x2001
Network LSA 2 0x2002
Interarea prefix LSA 3 0x2003
Interarea router LSA 4 0x2004
AS external LSA 5 0x2005
Group membership LSA 6 0x2006
Type 7 LSA 7 0x2007
Link-LSA 8 0x2008
Intra-area prefix LSA 9 0x2009
Larger Address Space Enables
Address Aggregation

• Aggregation of prefixes announced in the global routing table


• Efficient and scalable routing
• Improved bandwidth and functionality for user traffic
Configuring OSPFv3 in Cisco IOS Software

• Similar to OSPFv2
– Prefixes existing interface and EXEC mode commands
with “ipv6”
• Interfaces configured directly
– Replaces network command
• “Native” IPv6 router mode
– Not a submode of router ospf command
Enabling OSPFv3 Globally

ipv6 unicast-routing
!
ipv6 router ospf 1
router-id 2.2.2.2
Enabling OSPFv3 on an Interface

interface Ethernet0/0
ipv6 address 3FFE:FFFF:1::1/64
ipv6 ospf 1 area 0
ipv6 ospf priority 20
ipv6 ospf cost 20
Cisco IOS OSPFv3-Specific Attributes

• Configuring area range:


– area area-id range prefix/prefix length [advertise | not-
advertise] [cost cost]
• Showing new LSAs:
– show ipv6 ospf [process-id] database link
– show ipv6 ospf [process-id] database prefix
OSPFv3 Configuration Example
Router1#
interface S1/1
ipv6 address
2001:410:FFFF:1::1/64
ipv6 ospf 100 area 0

interface S2/0
ipv6 address
3FFE:B00:FFFF:1::2/64
ipv6 ospf 100 area 1

ipv6 router ospf 100


router-id 10.1.1.3

Router2#
interface S3/0
ipv6 address
3FFE:B00:FFFF:1::1/64
ipv6 ospf 100 area 1

ipv6 router ospf 100


router-id 10.1.1.4
Verifying Cisco IOS OSPFv3

Router2#show ipv6 ospf int s 3/0


S3/0 is up, line protocol is up
Link Local Address 3FFE:B00:FFFF:1::1, Interface ID 7
Area 1, Process ID 100, Instance ID 0, Router ID 10.1.1.4
Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:02
Index 1/1/1, flood queue length 0
Next 0x0(0)/0x0(0)/0x0(0)
Last flood scan length is 3, maximum is 3
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 10.1.1.3
Suppress hello for 0 neighbor(s)
show ipv6 ospf

R7#show ipv6 ospf


Routing Process “ospfv3 1” with ID 75.0.7.1
It is an area border and autonomous system boundary router
Redistributing External Routes from, connected
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
LSA group pacing timer 240 secs
Interface floor pacing timer 33 msecs
Retransmission pacing timer 33 msecs
Number of external LSA 3. Checksum Sum 0x12B75
show ipv6 ospf (Cont.)
Number of areas in this router is 2. 1 normal 0 stub 1 nssa
Area BACKBONE(0)
Number of interfaces in this area is 1
SPF algorithm executed 23 times
Number of LSA 14. Checksum Sum 0x760AA
Number of DCbitless LSA 0
Number of Indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Area 2
Number of interfaces in this area is 1
It is a NSSA area
Perform type-7/type-5 LSA translation
SPF algorithm executed 17 times
Number of LSA 25. Checksum Sum 0xE3BF0
Number of DCbitless LSA 0
Number of Indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
show ipv6 ospf neighbor detail

Router2#show ipv6 ospf neighbor detail


Neighbor 10.1.1.3
In the area 0 via interface S2/0
Neighbor: interface-id 14, link-local address 3FFE:B00:FFFF:1::2
Neighbor priority is 1, State is FULL, 6 state changes
Options is 0x63AD1B0D
Dead timer due in 00:00:33
Neighbor is up for 00:48:56
Index 1/1/1, retransmission queue length 0, number of retransmission 1
First 0x0(0)/0x0(0)/0x0(0) Next 0x0(0)/0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec
show ipv6 ospf database
Router Link States (Area 1)
ADV Router Age Seq# Fragment ID Link count Bits
26.50.0.1 1812 0x80000048 0 1 None
26.50.0.2 1901 0x80000006 0 1 B

Net Link States (Area 1)


ADV Router Age Seq# Link ID Rtr count
26.50.0.1 57 0x8000003B 3 4

Inter-Area Prefix Link States (Area 1)


ADV Router Age Seq# Prefix
26.50.0.2 139 0x80000003 3FFE:FFFF:26::/64
26.50.0.2 719 0x80000001 3FFE:FFF:26::/64

Inter-Area Router Link States (Area 1)


ADV Router Age Seq# Link ID Dest RtrID
26.50.0.2 772 0x80000001 1207959556 72.0.0.4
26.50.0.4 5 0x80000003 1258292993 75.0.7.1
show ipv6 ospf database (Cont.)
Link (Type-8) Link States (Area 1)
ADV Router Age Seq# Link ID Interface
26.50.0.1 1412 0x80000031 3 Fa0/0
26.50.0.2 238 0x80000003 3 Fa0/0

Intra-Area Prefix Link States (Area 1)


ADV Router Age Seq# Link ID Ref-Istype Ref-LSID
26.50.0.1 1691 0x8000002E 0 0x2001 0
26.50.0.1 702 0x80000031 1003 0x2002 3
26.50.0.2 1797 0x80000002 0 0x2001 0

Type-5 AS External Link States


ADV Router Age Seq# Prefix
72.0.0.4 287 0x80000028 3FFE:FFFF:A::/64
72.0.0.4 38 0x80000027 3FFE:FFFF:78::/64
75.0.7.1 162 0x80000007 3FFE:FFFF:8::/64
show ipv6 ospf database
database-summary
R3#show ipv6 ospf database database-summary
Area 0 database summary
LSA Type Count Delete Maxage
Router 3 0 0
Network 0 0 0
Link 3 0 0
Prefix 3 0 0
Inter-area Prefix 6 0 0
Inter-area Router 0 0 0
Type-7 External 0 0 0
Subtotal 15 0 0

Process 1 database summary


LSA Type Count Delete Maxage
Router 7 0 0
Network 1 0 0
Link 7 0 0
Prefix 8 0 0
Inter-area Prefix 14 0 0
Inter-area Router 2 0 0
Type-7 External 0 0 0
Type-5 Ext 3 0 0
Total 42 0 0
Summary

• RIP, EIGRP, IS-IS, BGP, and OSPF all have new versions to
support IPv6.
• OSPFv3 is OSPF for IPv6.
• Most of the algorithms of OSPFv2 are the same in OSPFv3.
Some changes have been made in OSPFv3, particularly to
handle the increased address size in IPv6 the fact that OSPF
runs directly over IP and all of the OSPF for IPv4 optional
capabilities, including on-demand circuit support and NSSA
areas. The multicast extensions to OSPF (MOSPF) are also
supported in OSPF for IPv6.
Summary (Cont.)

• There are two new LSAs in IPv6: LSA type 8 and LSA type 9.
The router LSA and the network LSA do not carry IPv6
addresses.
• Configuring OSPFv3 requires a good background
understanding of IPv6.
• There are Cisco IOS software configuration commands for
OSPFv3 to support all of the new and old capabilities of
OSPFv3.
• Numerous OSPFv3 IOS show commands support the
verification of OSPFv3 configurations.
Implementing IPv6

Using IPv6 with IPv4


IPv4-to-IPv6 Transition

Transition richness means:


– No fixed day to convert; no need to convert all at once.
– Different transition mechanisms are available:
• Smooth integration of IPv4 and IPv6.
• Use of dual stack or 6to4 tunnels.
– Different compatibility mechanisms:
• IPv4 and IPv6 nodes can communicate.
Cisco IOS Software Is IPV6-Ready:
Cisco IOS Dual Stack

• If both IPv4 and IPv6 are configured on an interface, this


interface is dual-stacked.
Dual Stack

• Dual stack is an integration method where a node has


implementation and connectivity to both an IPv4 and IPv6
network.
Cisco IOS Software Is IPv6-Ready:
Overlay Tunnels

• Tunneling encapsulates the IPv6 packet in the IPv4 packet.


Tunneling

Tunneling is an integration method where an IPv6 packet is


encapsulated within another protocol, such as IPv4. This
method of encapsulation is IPv4 protocol 41:
• This method includes a 20-byte IPv4 header with no options and an
IPv6 header and payload.
• This method is considered dual stacking.
“Isolated” Dual-Stack Host

Encapsulation can be done by edge routers between


hosts or between a host and a router.
Cisco IOS Software Is IPv6-Ready:
Configured Tunnel

Configured tunnels require:


• Dual-stack endpoints
• IPv4 and IPv6 addresses configured at each end
Example: Cisco IOS Tunnel Configuration
Cisco IOS Software Is IPv6-Ready:
6to4 Tunneling

6to4
• Is an automatic tunnel method
• Gives a prefix to the attached IPv6 network
Translation—NAT-PT

• NAT-Protocol Translation (NAT-PT) is a translation mechanism that


sits between an IPv6 network and an IPv4 network.
• The job of the translator is to translate IPv6 packets into IPv4
packets and vice versa.
Summary

• The two most common techniques to make the transition


from IPv4 to IPv6 are dual stack and IPv6-to-IPv4 (6-to-4)
tunnels.
• Tunneling IPv6 traffic over an IPv4 network requires one
edge router to encapsulate the IPv6 packet inside an IPv4
packet and another router to decapsulate it. Transition
methods from IPv4 to IPv6 include dual-stack operation,
protocol translation, and 6to4 tunnels.
Module Summary

• IPv6 has numerous features and functions that make it a


superior alternative to IPv4.
• IPv6 provides a larger address space in a hexadecimal
format.
• The IPv6 addresses can be obtained by IPv6 hosts
dynamically utilizing autoconfiguration.
• IPv6 will require new versions of RIP, EIGRP, IS-IS, BGP,
and OSPF.
• IPv4-to-IPv6 transition methodologies will include dual stack
and tunneling, with 6to4 tunneling being prevalent.
Cisco Networking Academy Program
Address Resolution Protocol

ARP

The Address Resolution Protocol

• Who are we ARPing for?


or
• Who for ARP thou?
Cisco Networking Academy Program

Note to Reader
Address Resolution Protocol

• The information explained in this section is a


simplification and extrapolation of the actual ARP
determination process.
• Although conceptually accurate, the actual
process is slightly different and more complex.
• However, for the purposes of this curriculum, the
explanation contained in this section provide a
good basis of understanding.
Cisco Networking Academy Program
Address Resolution Protocol

First, a quick review...

The TCP/IP Suite of Protocols

File Transfer: FTP, TFTP, NFS, HTTP


Application Email: SMTP
Remote Login: Telnet, rlogin
Network Management: SNMP, BootP
Name Management: DNS, DHCP
Transport TCP, UDP
Internet/Network IP, ICMP, IGMP, ARP, RARP
Network Interface Not Specified: Ethernet, 802.3, Token Ring,
(Link Layer) 802.5, FDDI, ATM,

ARP is a layer 3 protocol, one of many protocols within the


TCP/IP suite of protocols.
Cisco Networking Academy Program

Why do devices need to map a MAC Address to an IP Address?


Address Resolution Protocol

Destination MAC Address???

ARP Table
IP Address MAC Address
172.16.10.3 00-0C-04-32-14-A1
172.16.10.19 00-0C-14-02-00-19
172.16.10.33 00-0C-A6-19-46-C1

Host Stevens Host Cerf


172.16.10.10 172.16.10.25
255.255.255.0 255.255.255.0
MAC 00-0C-04-17-91-CC MAC 00-0C-04-38-44-AA

Source
Destination

172.16.10.0/24
Router A
Ethernet 0
172.16.10.1
255.255.255.0
MAC 03-0D-17-8A-F1-32
Cisco Networking Academy Program

• Devices, (hosts, routers, servers, etc.) use IP


Address Resolution Protocol

addresses to reach other devices within their own


network/subnet or across different
networks/subnets.
• Layer 3 addresses such as IP addresses, include
a source address of the sending device and the
destination address of the intended recipient.
• In other words the IP addresses consist of the
original source address and final destination
address.
Cisco Networking Academy Program

• Data Link addresses, such as Ethernet MAC


Address Resolution Protocol

addresses are used to get the IP packet from


one hop to the next.
• You may wish to review the section on
Encapsulation and Routers for more
clarification.
Cisco Networking Academy Program

Why do devices need to map a MAC Address to


Address Resolution Protocol

an IP Address?
• The simple answer is deliver the IP packet inside
an Ethernet frame to the next hop along the way.
The next hop may very well be the final
destination.
• To better explain this, lets use a couple of
examples.
Cisco Networking Academy Program

Example 1: Two devices (hosts) are on the same subnet


Address Resolution Protocol

Host Stevens Host Cerf


172.16.10.10 172.16.10.25
255.255.255.0 255.255.255.0
MAC 00-0C-04-17-91-CC MAC 00-0C-04-38-44-AA

Source
Destination

172.16.10.0/24
Router A
Ethernet 0
172.16.10.1
Here we have an example of Host 255.255.255.0
MAC 03-0D-17-8A-F1-32
Stevens at IP address 172.16.10.10
wanting to send an IP packet to Host
Cerf at IP address 172.16.10.25.
Cisco Networking Academy Program

Host Stevens needs to send this packet either:


Address Resolution Protocol

a) directly to the final destination, Host Cerf


or
b) the default gateway, the router, so it can forward it
onward

• How does Host Stevens know where it needs to


send this packet?
Cisco Networking Academy Program

• Depending upon the answer, Host Stevens will


Address Resolution Protocol

either look for Host Cerf’s IP address of


172.16.10.25 in its ARP table or that of the default
gateway, Router A’s IP address of 172.16.10.1

• This is the “big question!”


Cisco Networking Academy Program

The BIG Question


Address Resolution Protocol

Which IP address does the sending host (Stevens)


look for in its ARP table? And if that IP address is
not there, which IP Address does it send an ARP
Request for?

Is it:
• The IP Address of the destination host?
• The IP Address of the default gateway (the
router)?
Cisco Networking Academy Program

The Answer
Address Resolution Protocol

• It depends on whether the final destination


address is on its same subnet or that of a
different subnet or network.
• The sending host must determine whether the
final destination IP address is on the same
subnet as itself.
Cisco Networking Academy Program

Same Subnet
Address Resolution Protocol

• If the final destination is on the same subnet as


the sender, then it knows it can send the packet
directly to the final destination.
• It will look up the final destination IP address in
its ARP table for the MAC address.
• If the IP address is in the ARP table it will
encapsulate the IP packet into the Ethernet
frame.
• The sender will use the MAC address it got from
the ARP table for the Destination MAC address
in the Ethernet frame.
Cisco Networking Academy Program

• If the IP address is not in the ARP table the


Address Resolution Protocol

sender will need to send out an ARP Request in


order to get the MAC address.
Cisco Networking Academy Program

Example 1: Two hosts are on the same subnet


Address Resolution Protocol

Host Stevens Host Cerf


172.16.10.10 172.16.10.25
255.255.255.0 255.255.255.0
MAC 00-0C-04-17-91-CC MAC 00-0C-04-38-44-AA

Source Destination

172.16.10.0/24
Router A
Ethernet 0
Host Stevens at IP address 172.16.10.1
255.255.255.0
172.16.10.10 wants to send an IP MAC 03-0D-17-8A-F1-32
packet to Host Cerf at IP address
172.16.10.25.
Cisco Networking Academy Program

• The sender, Host Stevens, compares its IP


Address Resolution Protocol

Address with the destination host’s IP Address,


using the sender’s (Host Stevens’) subnet mask
to extract the network portion for both IP
Addresses.
• By doing AND operations on both IP Addresses,
host Stevens determines whether or not both
hosts are on the same network/subnet.
Cisco Networking Academy Program

Host Stevens IP Address 172.16.10.10


Address Resolution Protocol

Host Stevens Subnet Mask 255.255.255.0


------------------------- --------------
Host Stevens Network 172.16.10.0

Host Cerf IP Address 172.16.10.25


Host Stevens Subnet Mask 255.255.255.0
------------------------- --------------
Host Cerf Network 172.16.10.0
Cisco Networking Academy Program

• Notice that Host Stevens uses its own subnet


Address Resolution Protocol

mask which defines which subnet it is directly


connected to.
• So, when doing the AND operation, it uses its
own subnet mask for both AND operations.
Cisco Networking Academy Program

• Host Stevens determines that it belongs to the


Address Resolution Protocol

172.16.10.0 subnet and that Host Cerf is also


on the 172.16.10.0 subnet.
• Same subnet!
• This means that Host Stevens can send the
packet directly to Host Cerf.
• Now, that Host Stevens knows that Host Cerf is
on its same subnet, all that is left is for Host
Stevens to look up Host Cerf’s IP address in its
ARP table, in order to get the Host Cerf’s MAC
address, so it can encapsulate the IP packet in
the Ethernet frame and send it directly to Host
Cerf.
Cisco Networking Academy Program

Host Stevens checking its ARP table for Host


Address Resolution Protocol

Cerf’s MAC address...


Destination MAC Address???

ARP Table
IP Address MAC Address
172.16.10.3 00-0C-04-32-14-A1
172.16.10.19 00-0C-14-02-00-19
172.16.10.33 00-0C-A6-19-46-C1

Host Stevens Host Cerf


172.16.10.10 172.16.10.25
255.255.255.0 255.255.255.0
MAC 00-0C-04-17-91-CC MAC 00-0C-04-38-44-AA

Source Destination

172.16.10.0/24
Router A
Ethernet 0
172.16.10.1
255.255.255.0
MAC 03-0D-17-8A-F1-32
Cisco Networking Academy Program

• In the example above, Host Cerf’s IP Address


Address Resolution Protocol

does not appear in Host Stevens’ ARP Table.


• Host Stevens must send out an ARP Request for
the IP address 172.16.10.25, Host Cerf’s IP
address.
• Once again, Host Stevens knows it can do an
ARP request directly for Host Cerf, because it had
determined they are both on the same subnet.
Cisco Networking Academy Program

Let’s do the ARP Request


Address Resolution Protocol

So, what does an ARP packet look like?

Ethernet Header Ethernet Data – 28 byte ARP request/reply


Ethernet Ethernet Fram ARP Sender’s Sender’s Target’s Target’s
Destinatio Source e header Ethernet IP Address Ethernet IP Address
n Address Address Type s, i.e. Address (MAC) Address (MAC)
(MAC) (MAC) op field

Note: You may wish to skip this part if you do not


need the review.
Cisco Networking Academy Program

ARP Request from Host Stevens at 172.16.10.10


Address Resolution Protocol

“Hey everyone! I have this IP Address and I need


the host this belongs to, to send me their MAC
address.”

ARP Request from 172.16.10.10


Ethernet Header Ethernet Data – 28 byte ARP request/reply
Ethernet Ethernet Fram ARP Sender’s Sender’s Target’s Target’s
Destinatio Source e header Ethernet IP Address Ethernet IP Address
n Address Address Type s, i.e. Address Address
(MAC) (MAC) op field (MAC) (MAC)
FF-FF- 00-0C- 0x806 op = 1 00-0C- 172.16.10.10 172.16.10.25
FF-FF- 04-17- 04-17-
FF-FF 91-CC 91-CC

op field – ARP request = 1


ARP reply = 2
RARP request = 3
RARP reply = 4
Cisco Networking Academy Program

ARP Reply from Host Cerf at 172.16.10.25


Address Resolution Protocol

“Hey sender of ARP Request! Here is my MAC


address that you wanted for that IP address.”

ARP Reply from 172.16.10.25


Ethernet Header Ethernet Data – 28 byte ARP request/reply
Ethernet Ethernet Fram ARP Sender’s Sender’s Target’s Target’s
Destinatio Source e header Ethernet IP Address Ethernet IP Address
n Address Address Type s, i.e. Address Address
(MAC) (MAC) op field (MAC) (MAC)
00-0C- 00-0C- 0x806 op = 2 00-0C- 172.16.10.25 00-0C- 172.16.10.10
04-17- 04-38- 04-38- 04-17-
91-CC 44-AA 44-AA 91-CC

Here it is!
Cisco Networking Academy Program

• Host Stevens receives the ARP Reply and enters


Address Resolution Protocol

Host Cerf’s IP address and MAC address into its


ARP Table.
• Host Stevens now has all it needs to encapsulate
the IP packet into the Ethernet frame and send
that packet directly to Host Cerf.

Ethernet Frame
Ethernet Header IP Datagram from above Ethern
et
Trailer
MAC MAC Other IP IP Original IP Final Data FCS
Destination Source Address Heade Header Source Destination
Address r Info Address Address
Info
00-0C- 00-0C-
04-38- 04-17-
172.17.10.10 172.16.10.25
44-AA 91-CC
Cisco Networking Academy Program

Example 2: Two hosts are on different subnets


Address Resolution Protocol

Host Perlman
Host Stevens
172.16.20.12
172.16.10.10
255.255.255.0
255.255.255.0
MAC 00-0C-22-A3-14-01
MAC 00-0C-04-17-91-CC

Source Destination

172.16.10.0/24 172.16.20.0/24
Router A
Ethernet 0
172.16.10.1
255.255.255.0
MAC 03-0D-17-8A-F1-32

Here we have an example of Host Stevens at IP


address 172.16.10.10 wanting to send an IP
packet to Host Perlman at IP address
172.16.20.12
Cisco Networking Academy Program

Host Stevens needs to send this packet either:


Address Resolution Protocol

a) directly to the final destination, Host Perlman


or
b) the default gateway, the router, so it can forward it
onward

• How does Host Stevens know where it needs to


send this packet?
Cisco Networking Academy Program

• Depending upon the answer, Host Stevens will


Address Resolution Protocol

either look for Host Perlman’s IP address of


172.16.20.12 in its ARP table or that of the default
gateway, Router A’s IP address of 172.16.10.1

• This is the “big question!”


Cisco Networking Academy Program

The BIG Question


Address Resolution Protocol

Which IP address does the sending host (Stevens)


look for in its ARP table? And if that IP address is
not there, what IP Address does it send an ARP
Request for?
Is it:
• The IP Address of the destination host?
• The IP Address of the default gateway (the
router)?
Cisco Networking Academy Program

The Answer
Address Resolution Protocol

• It depends on whether the final destination


address is on its same subnet or that of a different
subnet or network.
• The sending host must determine whether the
final destination IP address is on the same subnet
as itself.
Cisco Networking Academy Program

Different Subnet
Address Resolution Protocol

• If the final destination is on a different subnet


then the sender knows it can not send the
packet directly to the final destination.
• Instead, the sender will look up the IP address
of the default gateway.
• This is why hosts normally have not only an IP
address and subnet mask, but also an IP
address of a default gateway.
Cisco Networking Academy Program

• The default gateway is usually a router, which


Address Resolution Protocol

hosts send packets to when the destination IP


address is on a different subnet or network.
• The sender will look up the default gateway’s IP
address in its ARP table for the MAC address of
the default gateway.
• If the IP address is in the sender’s ARP table it will
encapsulate the IP packet into the Ethernet frame
and send the packet to the default gateway (i.e.
the router).
Cisco Networking Academy Program

• If the IP address is not in the ARP table the


Address Resolution Protocol

sender will send an ARP Request for the MAC


address of the default gateway (i.e. the router).
Cisco Networking Academy Program

Lets see how it does this by using our


Address Resolution Protocol

example.
Host Perlman
Host Stevens
172.16.20.12
172.16.10.10
255.255.255.0
255.255.255.0
MAC 00-0C-22-A3-14-01
MAC 00-0C-04-17-91-CC

Source Destination

172.16.10.0/24 172.16.20.0/24
Router A
Ethernet 0
172.16.10.1
255.255.255.0
MAC 03-0D-17-8A-F1-32

Here we have an example of Host Stevens at IP address


172.16.10.10 wanting to send an IP packet to Host
Perlman at IP address 172.16.20.12
Cisco Networking Academy Program

1. The sender, Host Stevens, compares its IP


Address Resolution Protocol

Address with the destination host’s IP Address,


using the sender’s (Host Stevens’) subnet mask
to extract the network portion for both IP
Addresses.

2. By doing AND operations on both IP Addresses,


host Stevens determines whether or not both
hosts are on the same network/subnet.
Cisco Networking Academy Program

Host Stevens IP Address 172.16.10.10


Address Resolution Protocol

Host Stevens Subnet Mask 255.255.255.0


------------------------- --------------
Host Stevens Network 172.16.10.0

Host Perlman’s IP Address 172.16.20.12


Host Stevens Subnet Mask 255.255.255.0
------------------------- --------------
Host Perlman’s Network 172.16.20.0
Cisco Networking Academy Program

• Notice that Host Stevens uses its own subnet


Address Resolution Protocol

mask which defines which subnet it is directly


connected to.
• So, when doing the AND operation, it uses its own
subnet mask for both AND operations.
Cisco Networking Academy Program

• Host Stevens determines that it belongs to the


Address Resolution Protocol

172.16.10.0 subnet and that Host Perlman is on


the 172.16.20.0 subnet.
• Different subnets!
• This means that Host Stevens can not send the
packet directly to Host Perlman.
• Now, that Host Stevens knows that Host Cerf is
on a different subnet, it knows that it must send
the packet to the default gateway, the router.
• Host Stevens will look up the default gateway’s
IP address (which has been entered by the user
or received by a DHCP server), in its ARP Table.
Cisco Networking Academy Program

Host Stevens checking its ARP table for the router’s


Address Resolution Protocol

MAC address...
Default Gateway's (the router's)
MAC Address???

ARP Table
IP Address MAC Address
172.16.10.3 00-0C-04-32-14-A1
172.16.10.19 00-0C-14-02-00-19
172.16.10.33 00-0C-A6-19-46-C1

Host Perlman
Host Stevens
172.16.20.12
172.16.10.10
255.255.255.0
255.255.255.0
MAC 00-0C-22-A3-14-01
MAC 00-0C-04-17-91-CC

Source Destination

172.16.10.0/24 172.16.20.0/24
Router A
Ethernet 0
172.16.10.1
255.255.255.0
MAC 03-0D-17-8A-F1-32
Cisco Networking Academy Program

• In the example above, Host Perlman’s IP Address


Address Resolution Protocol

does not appear in Host Stevens’ ARP Table.


• Host Stevens must send out an ARP Request for
the IP address 172.16.10.1, Router A’s IP address.
• Host Stevens can not do an ARP request directly
for Host Perlman, because it had determined they
are on different subnets.
Cisco Networking Academy Program

Let’s do the ARP Request


Address Resolution Protocol

So, what does an ARP packet look like?

Ethernet Header Ethernet Data – 28 byte ARP request/reply


Ethernet Ethernet Fram ARP Sender’s Sender’s Target’s Target’s
Destinatio Source e header Ethernet IP Address Ethernet IP Address
n Address Address Type s, i.e. Address (MAC) Address (MAC)
(MAC) (MAC) op field

Note: You may wish to skip this part if you do not need the
review.
Cisco Networking Academy Program

ARP Request from Host Stevens at 172.16.10.10


Address Resolution Protocol

“Hey everyone! I have this IP Address, 172.16.10.1,


and I need the device this belongs to, to send me
their MAC address.”

ARP Request from 172.16.10.10


Ethernet Header Ethernet Data – 28 byte ARP request/reply
Ethernet Ethernet Fram ARP Sender’s Sender’s Target’s Target’s
Destinatio Source e header Ethernet IP Address Ethernet IP Address
n Address Address Type s, i.e. Address Address
(MAC) (MAC) op field (MAC) (MAC)
FF-FF- 00-0C- 0x806 op = 1 00-0C- 172.16.10.10 172.16.10.1
FF-FF- 04-17- 04-17-
FF-FF 91-CC 91-CC

op field – ARP request = 1


ARP reply = 2
RARP request = 3
RARP reply = 4
Cisco Networking Academy Program

ARP Reply from Router A at 172.16.10.1


Address Resolution Protocol

“Hey sender of ARP Request! Here is my MAC


address that you wanted for that IP address.”

ARP Reply from 172.16.10.1


Ethernet Header Ethernet Data – 28 byte ARP request/reply
Ethernet Ethernet Fram ARP Sender’s Sender’s Target’s Target’s
Destinatio Source e header Ethernet IP Address Ethernet IP Address
n Address Address Type s, i.e. Address Address
(MAC) (MAC) op field (MAC) (MAC)
00-0C- 03-0D- 0x806 op = 2 03-0D- 172.16.10.1 00-0C- 172.16.10.10
04-17- 17-8A- 17-8A- 04-17-
91-CC F1-32 F1-32 91-CC

Here it is!
Cisco Networking Academy Program

• Host Stevens receives the ARP Reply and enters


Address Resolution Protocol

Router A’s IP address and MAC address into its


ARP Table.
• Host Stevens now has all it needs to encapsulate
the IP packet into the Ethernet frame and send
that packet to Router A.

Ethernet Frame
Ethernet Header IP Datagram from above Ethern
et
Trailer
MAC MAC Other IP IP Original IP Final Data FCS
Destination Source Address Heade Header Source Destination
Address r Info Address Address
Info
03-0D- 00-0C-
17-8A- 04-17-
172.17.10.10 172.16.10.1
F1-32 91-CC
Cisco Networking Academy Program

• It is now up to Router A to forward the packet


Address Resolution Protocol

onward.
Cisco Networking Academy Program
Address Resolution Protocol
RFC 1034 & RFC 1035
Introduction

1. What is the IP
address of
udel.edu ?

It is 128.175.13.92

1. What is the
host name of
128.175.13.74

It is strauss.udel.edu

2
Real Life Analogy: Telephone Example

Telephone connection

Source: Destination: Dad


Child
Udel-Newark, DE
Newark, DE

Information Child Needs: Dad’s Phone #

3
Calls dad
Child
(What is Dad’s Phone#?)
Dad’s phone is 1
302-831-1949

8 Dials 0: (what is
Dad’s phone is Newark’s area code?)
7 302-831-1949

2
University Older sister operator
operator
3
Dials 302-831-4567: (Newark’s area code is
(what is Dad phone #?) 302)

6
(University number: 302-831- Dials 302-731-1212:
4567) 5 4 (What is University # ?)

Directory
assist 4
DNS Components

There are 3 components:


• Name Space:
Specifications for a structured name space and data
associated with the names
• Resolvers:
Client programs that extract information from Name
Servers.
• Name Servers:
Server programs which hold information about the structure
and the names.

5
Name Space

6
Resolvers

A Resolver maps a name to an address and vice


versa.

Query

Response

Resolver Name Server

7
Iterative Resolution
a.root
server

a3.nstl a.gtld-
d.com server
5
udel ns1.goo
server gle.com
3 iterative response (referral)7
“I don't know. Try a.root-servers.net.”
iterative response (referral) 9
“I don't know. Try a.gtld-servers.net.”
1 iterative response (referral)
“I don't know. Try a3.nstld.com.”
iterative response (referral)
2 4 “I don't know. Try ns1.google.com.”
6 iterative response
8 “The IP address of www.google.com
client 10 is 216.239.37.99.”
iterative request
“What is the IP address of 8
www.google.com?”
Recursive Resolution
root
server
edu 3 com
server server
7 4
udel 2 8 google
serve server
6 5
r
9

1
10 recursive request
“What is the IP address of
www.google.com?”
client recursive response
“The IP address of www.google.com is
216.239.37.99.” 9
Name Server

Architecture: Zone
From data
Name Server Process
disk file
Authoritative Data Master
Zone transfer server
(primary master and
slave zones)
Cache Data
(responses from
other name servers)
Agent
(looks up queries
on behalf of resolvers)
10
Name Server (cont’d)

Authoritative Data:
Name Server Process
Authoritative Data
(primary master and
slave zones) Response

Cache Data
(responses from
other name servers)
Agent
(looks up queries Resolver
Query
on behalf of resolvers)
11
Name Server (cont’d)

Using Other Name Servers:

Name Server Process


Authoritative Data
(primary master and
slave zones)
Response
Cache Data
Response
(responses from
Arbitrary
other name servers)
name
Agent Query server
(looks up queries Resolver
Query
on behalf of resolvers)
12
Name Server (cont’d)

Cached Data :
Name Server Process
Authoritative Data
(primary master and
slave zones) Response

Cache Data
(responses from
other name servers)
Agent
(looks up queries Query Resolver

on behalf of resolvers)
13
Block Diagram

Query Query

Foreign
User Name
Resolver
Program Server
Response
Response

Reference
Addition

Cache

14
DNS Messages

Messages

Query Response

15
DNS Message Format
Header (12 bytes) Header (12 bytes)
Question section Question section

2 bytes 2 bytes Answer section


Identification Flags Authoritative section

Number of
Number of Additional section
Answer Records
Question Records
(zeroed in query) 0 no error
1 format error
2 problem at name server
Number of Auth- Number of 3 domain reference problem
oritative Records Additional Records 4 query type not supported
(Zeroed in query) (zeroed in query)
5 administratively prohibited
6-15 reserved
0 = query,
1 = response QR OpCode AA TC RD RA 0 0 0 rCode
0 = standard, 1 = inverse, Authoritative Recursion Available flag
16
2 = server status request Answer flag Truncated flag Recursion Desired flag
Question Record Format

sent in query;
repeated in response

Query name
(variable length) class of network (1 = Internet)

Query type Query class 1 A Address – IPv4


(16 bits) (16 bits) 2 NS Name Server (authoritative)
5 CNAME Canonical Name (alias)
12 PTR Pointer – reverse lookup
15 MX Mail Exchange
28 AAAA Address - IPv6
252 AXFR Zone Transfer

3 r e n 5 e e c i s 4 u d e l 3 e d u 0

counts
17
Resource Record Format

answer, authoritative, and


additional sections in response

name of host/domain that this


Domain Name record provides information for
(variable length)
type of data in resource record
Domain type Domain class (same types as used in question record)
(16 bits) (16 bits) same as in question record
Time to Live number of seconds this
(32 bits) record may be cached

data length length of resource data


(16 bits) the “payload” of the
resource record

Resource data
(variable length)

18
Compression

bytes 0-11
Header (12 bytes)
Query name byte 12
Question

(variable length)
Section

Query type Query Class 3 r e n 5 e e c i s


(16 bits) (16 bits) 4 u d e l 3 e d u 0
Domain Name
(variable length)
C0 0C
Answer
Section

1100000000001100 = 1210

19
Example forward query/response
“What is the IP address “www.udel.edu's IP address
of www.udel.edu?” is 128.175.13.63.”
Hdr ident 0x0100 same ident 0x8180 Hdr
0x0001 0x0000 0x0001 0x0001
0x0000 0x0000 0x0004 0x0004
Qry 3 'w' 'w' 'w' 3 'w' 'w' 'w' Qry
4 'u' 'd' 'e' 4 'u' 'd' 'e'
'l' 3 'e' 'd' 'l' 3 'e' 'd'
'u' 0 0x0001(A) 'u' 0 0x0001(A)
0x0001(IN) 0x0001(IN)
flags: recursion desired (RD) 0xC00C 0x0001(A) Ans
0x0001(IN) 0x0000...
flags: query response (QR),
recursion desired (RD), ...0xB2F5 0x0004
recursion available (RA) 0x80AF0D3F
TTL: 45301 seconds ≈ 12.6 hours (128.175.13.63)
20
...
Example inverse query/response
“What is the name of the “The host at 128.175.13.63
host at 128.175.13.63?” is named www.udel.edu.”
Hdr ident 0x0100 same ident 0x8180 Hdr
0x0001 0x0000 0x0001 0x0001
0x0000 0x0000 0x0004 0x0004
Qr 2 '6' '3' 2 2 '6' '3' 2 Qry
y '1' '3' 3 '1' '1' '3' 3 '1'
'7' '5' 3 '1' '7' '5' 3 '1'
'2' '8' 7 'i' '2' '8' 7 'i'
'n' '-' 'a' 'd' 'n' '-' 'a' 'd'
'd' 'r' 4 'a' 'd' 'r' 4 'a'
'r' 'p' 'a' 0 'r' 'p' 'a' 0
0x000C(PTR) 0x0001(IN)
0x000C(PTR) 0x0001(IN) 0xC00C 0x000C(PTR) Ans
0x0001(IN) 0x0000...
...0xB003 0x000E
3 'w' 'w' 'w'
4 'u' 'd' 'e'
TTL: 45056 seconds ≈ 12.5 hours 'l' 3 'e' 'd'
'u' 0 21
...
Resource Record Sections
• Resource Record sections:
– answer = record(s) sent in response to query(s).
– authoritative = DNS servers which are authoritative for answer
record(s).
– additional = any other related information.
• MX records:
– mail exchange (MX) records provide mail addressing info.
– MX query asks “What hosts will accept mail for domain X?”
– MX resource records say “You can send mail for domain X to host
Y.”

MX Resource Data
preference (2 bytes) delivery priority (lower value = higher priority)

exchange domain name of host that will accept mail


(variable length) 22
Example MX response
...
Hdr ident 0x8180 0xC00C 0x0002(NS) Auth
0x0001 0x0002 0x0001(IN) 0x0000...
0x0004 0x0006 ...0x19FA 0x0007
Qry 4 'u' 'd' 'e' 4 'D' 'N' 'S'
'l' 3 'e' 'd' '1' 0xC00C
'u' 0 0x000F(MX) 0xC00C 0x0002(NS) Auth
0x0001(IN) 0x0001(IN) 0x0000...
Ans 0xC00C 0x000F(MX) ...0x19FA 0x0007
0x0001(IN) 0x0001... 4 'D' 'N' 'S'
...0x28F6 0x000C '2' 0XC00C
0x000A 7 'c' ...
'o' 'p' 'l' 'a' 0xC028 0x0001(A) Adtl
'n' 'd' 0xC00C 0x0001(IN) 0x0001...
Ans 0xC00C 0x000F(MX) ...0x2FB4 0x0004
0x0001(IN) 0x0001... 128.175.13.74
...0x28F6 0x000C 0xC040 0x0001(A) Adtl
0x0014 7 's' 0x0001(IN) 0x0001...
't' 'r' 'a' 'u' ...0x0D5D 0x0004 23
's' 's' 0xC00C 128.175.13.92
... ...
Transport
IP UDP
DNS message
header header

max. 512 bytes

● DNS messages are encapsulated in UDP by default.


● If the resolver expects the response to exceed 512 bytes, the
resolver encapsulates the query in TCP instead.
● If a request is sent over UDP and the response is longer than 512
bytes, the server sends the first 512 bytes of the response using
UDP and sets the TC (truncated) flag. The resolver then re-sends
the query using TCP. no limit (up to max. TCP payload size)

IP TCP 2-byte
DNS msg. DNS message
header header length 24
Dynamic DNS

DHCP
Server

Update

Client
Zone File
Primary DNS Server

25
Acknowledgements

Many thanks to :

• Behrouz A. Forouzan
http://www.mhhe.com/engcs/compsci/forouzan/tcpipppt.mhtml
• David Conrad
www.itu.int/osg/spu/enum/workshopjan01/annex2-conrad.ppt
• Greg Forte
http://www.cis.udel.edu/~amer/856/dns.03f.ppt

26
Questions

27
TCP/IP Suite Error and Control
Messages (ICMP)
Overview

• Knowledge of ICMP control messages is an essential part


of network troubleshooting and is a key to a full
understanding of IP networks.
• This module will:
– Describe ICMP
– Describe the ICMP message format
– Identify ICMP error message types
– Identify potential causes of specific ICMP error
messages
– Describe ICMP control messages
– Identify a variety of ICMP control messages used in
networks today
– Determine the causes for ICMP control messages

2
Overview

IP is a best effort delivery system.


• Data may fail to reach its destination for a variety of reasons, such
as hardware failure, improper configuration or incorrect routing
information.
• IP does not have a built-in mechanism for sending error and control
messages.
• IP also lack a mechanism for host and management queries.
Internet Control Message Protocol (ICMP) was designed to handle
these issues.
3
ICMP

• ICMP messages can be divided into categories (depending


upon the author.
• The Cisco curriculum divides it into:
– Error-Reporting Messages
– Suite Control Messages
4
Internet Control Message Protocol (ICMP)

• IP is an unreliable method for delivery of network data.


• Nothing in its basic design allows IP to notify the sender that a data
transmission has failed.
• Internet Control Message Protocol (ICMP) is the component of the
TCP/IP protocol stack that addresses this basic limitation of IP.
• ICMP does not overcome the unreliability issues in IP.
• Reliability must be provided by upper layer protocols (TCP or the
application) if it is needed. .
5
Error reporting and error
correction
• When datagram delivery errors
occur, ICMP is used to report
these errors back to the source
ICMP X
of the datagram. msg
source
destination

Example
• Workstation 1 is sending a datagram to Workstation 6
• Fa0/0 on Router C goes down
• Router C then utilizes ICMP to send a message back to Workstation 1
indicating that the datagram could not be delivered.
• ICMP does not correct the encountered network problem.
• Router C knows only the source and destination IP addresses of the
datagram, not know about the exact path the datagram took to Router
C, therefore, Router C can only notify Workstation 1 of the failure
• ICMP reports on the status of the delivered packet only to the source
device.
6
Format of an ICMP
Message
http://www.iana.org/assignments/icmp-parameters

Type Field
Type Name Type Name
---- ------------------------- ---- -------------------------
0 Echo Reply 17 Address Mask Request
1 Unassigned 18 Address Mask Reply
2 Unassigned 19 Reserved (for Security)
3 Destination Unreachable 20-29 Reserved (for Robustness Experiment)
4 Source Quench 30 Traceroute
5 Redirect 31 Datagram Conversion Error
32 Mobile Host Redirect
6 Alternate Host Address
33 IPv6 Where-Are-You
7 Unassigned
34 IPv6 I-Am-Here
8 Echo
35 Mobile Registration Request
9 Router Advertisement 36 Mobile Registration Reply
10 Router Solicitation 37 Domain Name Request
11 Time Exceeded 38 Domain Name Reply
12 Parameter Problem 39 SKIP
13 Timestamp 40 Photuris
14 Timestamp Reply 41-255 Reserved
15 Information Request
16 Information Reply

7
Format of an ICMP
Message
http://www.iana.org/assignments/icmp-parameters

Code Field Many of these ICMP types have a "code"


field.
Type 3: Destination Unreachable Here are the assigned code fields for Type 3
Destination Unreachable.
Codes
0 Net Unreachable Codes 2 and 3 are created only by the
1 Host Unreachable Destination Host, all others are created only
2 Protocol Unreachable by routers.
3 Port Unreachable
4 Fragmentation Needed and Don't Fragment was Set
5 Source Route Failed
6 Destination Network Unknown
7 Destination Host Unknown
8 Source Host Isolated
9 Communication with Destination Network is Administratively Prohibited
10 Communication with Destination Host is Administratively Prohibited
11 Destination Network Unreachable for Type of Service
12 Destination Host Unreachable for Type of Service
13 Communication Administratively Prohibited
14 Host Precedence Violation
15 Precedence cutoff in effect
8
ICMP Error Messages
Unreachable Destinations

• Network Unreachable
– generated by router lacking any route to destination
• Host Unreachable
– last hop router cannot contact destination
• Port Unreachable
– no process bound to port

10
Unreachable
networks

Network communication depends upon certain basic conditions being met:


• Sending and receiving devices must have the TCP/IP protocol stack
properly configured.
 proper configuration of IP address and subnet mask.
 A default gateway must also be configured if datagrams are to travel
outside of the local network.
• A router also must have the TCP/IP protocol properly configured on its
interfaces, and it must use an appropriate routing protocol.
If these conditions are not met, then network communication cannot take
place.
11
Unreachable
networks

Examples of problems:
• Sending device may address the datagram to a non-existent IP
address
• Destination device that is disconnected from its network.
• Router’s connecting interface is down
• Router does not have the information necessary to find the destination
network.

12
Destination unreachable message

ICMP Destination Unreachable


Type = 3

• If datagrams cannot always be forwarded to their destinations,


ICMP delivers back to the sender a destination unreachable
message indicating to the sender that the datagram could not be
properly forwarded.
• A destination unreachable message may also be sent when packet
fragmentation is required in order to forward a packet.
– Fragmentation is usually necessary when a datagram is forwarded
from a Token-Ring network(4500-18000) to an Ethernet network.
– If the datagram does not allow fragmentation, the packet cannot be
forwarded, so a destination unreachable message will be sent.
– More a little later on fragmentation and MTU Path Discovery!
• Destination unreachable messages may also be generated if IP
related services such as FTP or Web services are unavailable.
13
ICMP Echo (Request) and Echo Reply

Echo = Type 8
Echo Reply = Type 0
Notice that the code is 0 for both
Ethernet Header IP Header ICMP Message Ether.
(Layer 2) (Layer 3) (Layer 3) Tr.
Ethernet Ethernet Frame Source IP Add. Type Code Check- ID Seq. Data FCS
Destination Source Type Dest. IP Add. 0 or 8 0 sum Num.
Address Address Protocol field
(MAC) (MAC)

• IP Protocol Field = 1
• The echo request message is typically initiated using the ping
command .
14
Detecting excessively long routes
IP Header
0 15 16 31
4-bit 4-bit 8-bit Type Of
Version Header Service 16-bit Total Length (in bytes)
Length (TOS)
3-bit
16-bit Identification Flags 13-bit Fragment Offset

8 bit Time To Live 8-bit Protocol 16-bit Header Checksum


TTL

32-bit Source IP Address

32-bit Destination IP Address


ICMP Time Exceeded
Options (if any)
Type = 11
Data

• A TTL value is defined in each datagram (IP packet).


• As each router processes the datagram, it decreases the TTL value by
one.
• When the TTL of the datagram value reaches zero, the packet is
discarded.
• ICMP uses a time exceeded message to notify the source device that
the TTL of the datagram has been exceeded.

15
http://www.switch.ch/docs/ttl_default.html
TTL Overview - Disclaimer:
The following list is a best effort overview of some widely used TCP/IP stacks. The
information was provided by vendors and many helpful system administrators. We would
like to thank all these contributors for their precious help ! SWITCH cannot, however,
take any responsibility that the provided information is correct. Furthermore, SWITCH
cannot be made liable for any damage that may arise by the use of this information.

+--------------------+-------+---------+---------+
| OS Version |"safe" | tcp_ttl | udp_ttl |
+--------------------+-------+---------+---------+
AIX n 60 30 Assigned Numbers (RFC
DEC Pathworks V5 n 30 30
1700, J. Reynolds, J.
FreeBSD 2.1R y 64 64
HP/UX 9.0x n 30 30 Postel, October 1994):
HP/UX 10.01 y 64 64
IP TIME TO LIVE
Irix 5.3 y 60 60
Irix 6.x y 60 60 PARAMETER
Linux y 64 64
MacOS/MacTCP 2.0.x y 60 60
The current
OS/2 TCP/IP 3.0 y 64 64 recommended default
OSF/1 V3.2A n 60 30 time to live (TTL)
Solaris 2.x y 255 255 for the Internet
SunOS 4.1.3/4.1.4 y 60 60 Protocol (IP) is 64.
Ultrix V4.1/V4.2A n 60 30
VMS/Multinet y 64 64
VMS/TCPware y 60 64
VMS/Wollongong 1.1.1.1 n 128 30 Safe: TCP and UDP
VMS/UCX (latest rel.) y 128 128 initial TTL values
MS WfW n 32 32
MS Windows 95 n 32 32
should be set to a
MS Windows NT 3.51 n 32 32 "safe" value of at
MS Windows NT 4.0 y 128 128 least 60 today.
16
IP Parameter Problem

ICMP Parameter Problem


Type = 12

• Devices that process datagrams may not be able to forward a


datagram due to some type of error in the header.
• This error does not relate to the state of the destination host or
network but still prevents the datagram from being processed and
delivered.
• An ICMP type 12 parameter problem message is sent to the source of
the datagram.

17
ICMP Control Messages
Introduction to ICMP Control Messages

• Unlike error messages, control messages are not the


results of lost packets or error conditions which occur
during packet transmission.
• Instead, they are used to inform hosts of conditions such
as:
– Network congestion
– Existence of a better gateway to a remote network

19
ICMP Redirect
3

ICMP Redirect 2

Type = 5 Code = 0 to 3 1 2
4

• ICMP Redirect messages can only be sent by routers


• Host H sends a packet to Host 10.1.1.1 on network 10.0.0.0/8.
• Since Host H is not directly connected to the same network, it forwards
the packet to its default gateway, Router R1 at 172.16.1.100.
• Router R1 finds the correct route to network 10.0.0.0/8 by looking in its
route table.
• It determines that the path to the network is back out the same
interface the request to forward the packet came from to Router R2 at
172.16.1.200.
• R1 forwards the packet to R2 and sends an ICMP redirect/change
request to Host H telling it to use Router R2 at 172.16.1.100 as the
gateway to forward all future requests to network 10.0.0.0/8.
20
ICMP Redirects

ICMP Redirect
Type = 5 Code = 0 to 3

• Default gateways only send ICMP redirect/change request messages if


the following conditions are met:
– The interface on which the packet comes into the router is the
same interface on which the packet gets routed out.
– The subnet/network of the source IP address is the same
subnet/network of the next-hop IP address of the routed packet.
– The datagram is not source-routed.
– The route for the redirect is not another ICMP redirect or a default
route.
– The router is configured to send redirects. (By default, Cisco
routers send ICMP redirects. The interface subcommand no ip
redirects will disable ICMP redirects.)

21
Clock synchronization and transit time
estimation Replaced by

ICMP Timestamp Request


Type = 13 or 14

• The TCP/IP protocol suite allows systems to connect to one another


over vast distances through multiple networks.
• Each of these individual networks provides clock synchronization in its
own way.
• As a result, hosts on different networks who are trying to
communicate using software that requires time synchronization
can sometimes encounter problems.
• The ICMP timestamp message type is designed to help alleviate this
problem.
• The ICMP timestamp request message allows a host to ask for the
current time according to the remote host.
• The remote host uses an ICMP timestamp reply message to respond
to the request.
22
Clock synchronization and transit time
estimation Replaced by

ICMP Timestamp
Type = 13 or 14

• All ICMP timestamp reply messages contain the originate, receive and
transmit timestamps.
• Using these three timestamps, the host can estimate transit time across
the network by subtracting the originate time from the transit time.
• It is only an estimate however, as true transit time can vary widely based
on traffic and congestion on the network.
• The host that originated the timestamp request can also estimate the
local time on the remote computer.
• While ICMP timestamp messages provide a simple way to estimate time
on a remote host and total network transit time, this is not the best way
to obtain this information.
• Instead, more robust protocols such as Network Time Protocol (NTP)
at the upper layers of the TCP/IP protocol stack perform clock
synchronization in a more reliable manner.
23
Information requests and reply message
formats
ICMP Information Request/Reply
Type = 15 or 16

Replaced by
• The ICMP information requests and reply
messages were originally intended to
allow a host to determine its network
number.
• This particular ICMP message type is
considered obsolete.
• Other protocols such as BOOTP and
Dynamic Host Configuration Protocol
(DHCP) are now used to allow hosts to
obtain their network numbers.

24
Address Masks

ICMP Address Mask Request/Reply


Type = 17 or 18

• This new subnet mask is crucial in Replaced by


identifying network, subnet, and host bits in
an IP address.
• If a host does not know the subnet mask,
it may send an address mask request to the
local router.
• If the address of the router is known, this
request may be sent directly to the router.
• Otherwise, the request will be broadcast.
• When the router receives the request, it will
respond with an address mask reply.
• Somewhat obsolete, was used with
diskless workstations that used RARP for
the IP address and ICMP for the subnet
mask.
25
Router Solicitation and Advertisement

ICMP Router Solicitation


Type = 10

ICMP Router Advertisement


Type = 9
Replaced by
• When a host on the network boots, and the host
has not been manually configured with a
default gateway, it can learn of available
routers through the process of router discovery.
• This process begins with the host sending a
router solicitation message to all routers,
using the multicast address 224.0.0.2 as the
destination address. (May also be broadcast).
• When a router that supports the discovery
process receives the router discovery
message, a router advertisement is sent in
return.
• Routers may also periodically advertise router
advertisement messages.
26
IRDP

• Some newer IP hosts use ICMP Router Discovery Protocol


(IRDP) (RFC 1256 ) to find a new router when a route
becomes unavailable.
• A host that runs IRDP listens for hello multicast messages
from its configured router and uses an alternate router
when it no longer receives those hello messages.
• The default timer values of IRDP mean that it's not suitable
for detection of failure of the first hop.
• The default advertisement rate is once every 7 to 10
minutes, and the default lifetime is 30 minutes.

27
ICMP source-
quench messages
ICMP Source Quench
Type = 4

• Congestion can also occur for various reasons including when traffic
from a high speed LAN reaches a slower WAN connection.
• Dropped packets occur when there is too much congestion on a
network.
• ICMP source-quench messages are used to reduce the amount of data
lost.
• The source-quench message asks senders to reduce the rate at which
they are transmitting packets.
• In most cases, congestion will subside after a short period of time, and
the source will slowly increase the transmission rate as long as no
other source-quench messages are received.
• Most Cisco routers do not send source-quench messages by
default, because the source-quench message may itself add to the
network congestion. (See TCP)
28
ICMP source-
quench messages
ICMP Source Quench
Type = 4

• IP has no mechanism for flow control


• Some issues with ICMP Source Quench:
– A router or destination host (buffers full) will send one source-
quench message for each discarded packet.
– No mechanism to tell the source that the congestion has been
relieved and source can resume sending at previous rate.
• Remember, TCP/IP uses TCP mechanisms for flow control and
reliability including sliding windows.

29
ICMP Path MTU Discovery

Information from:
Marc Slemko
Path MTU Discovery and Filtering ICMP
http://alive.znep.com/~marcs/mtu/
and
Cisco Systems
Path Maximum Transfer Unit (MTU) Discovery
http://www.cisco.com/en/US/products/sw/iosswrel/ios_abcs_ios_the_abcs_
ip_version_60900aecd800c1126.html
Path MTU
Discovery

Problem:
• How path MTU discovery (PMTU-D) combined with filtering ICMP
messages can result in connectivity problems.
• Path MTU discovery allows a node to dynamically discover and adjust
to differences in the MTU size of every link along a given data path.
• In IPv4, the minimum link MTU size is 68 octets and the recommended
minimum is 576 octets, which is the minimum reassembly buffer size.
• So, any IPv4 packet must be at least 68 octets in length.
• (In IPv6, the minimum link MTU is 1280 octets, but the recommended MTU value for
IPv6 links is 1500 octets. The maximum packet size supported by the basic IPv6 header
is 64,000 octets. Larger packets called jumbograms could be handled using a hop-by-
hop extension header option.)
31
Path MTU Discovery - Terms

• MTU: The maximum transmission unit is a link layer restriction on the


maximum number of bytes of data in a single transmission (ie. frame,
cell, packet, depending on the terminology).
– The table above shows some typical values for MTUs, taken from
RFC-1191.
• Path MTU : The smallest MTU of any link on the current path between
two hosts.
– This may change over time since the route between two hosts,
especially on the Internet, may change over time.
– It is not necessarily symmetric and can even vary for different types
of traffic from the same host.

32
Terms

• Fragmentation: When a packet is too large to be sent across a link as a single


unit, a router can fragment the packet.
– This means that it splits it into multiple parts which contain enough
information for the receiver to glue them together again.
– Note that this is not done on a hop-by-hop basis, but once fragmented a
packet will not be put back together until it reaches its destination.
– Fragmentation is undesirable for numerous reasons, including:
• If any one fragment from a packet is dropped, the entire packet needs
to be retransmitted. This is a very significant problem.
• It imposes extra processing load on the routers that have to split the
packets.
• In some configuration, simpler firewalls will block all fragments
because they don't contain the header information for a higher layer
protocol (eg. TCP) needed for filtering.
33
Terms
3 4

ICMP Destination Unreachable


Fragmentation needed, but DF Set

• DF (Don't Fragment) bit: This is a bit in the IP header that can be set to
indicate that the packet should not be fragmented by routers.
– If the packet needs to be fragmented, an ICMP "can't fragment" error is
returned sent to the sender and the packet is dropped.
• ICMP Can't Fragment Error:
– This error is a type 3 (destination unreachable), code 4 (fragmentation
needed but don't-fragment bit set)
– Returned by a router when it receives a packet that is too large for it to
forward and the DF bit is set.
– The packet is dropped and the ICMP error is sent back to the origin host.
– Normally, this tells the origin host that it needs to reduce the size of its
packets if it wants to get through.
– Recent systems also include the MTU of the next hop in the ICMP
message so the source knows how big its packets can be.
– Note that this error is only sent if the DF bit is set; otherwise, packets are
just fragmented and passed through.
34
Terms

• MSS: The MSS is the maximum segment size.


– It can be announced during the establishment of a TCP
connection to indicate to the other end the largest
amount of data in one packet that should be sent by the
remote system.
– MSS is beyond the scope of this discussion.

35
Path MTU Discovery (PMTU-D)

• Now you know that Path MTUs vary.


• You know that fragmentation is bad.
• The solution?
– Well, one solution is Path MTU Discovery.
– The idea behind it is to send packets that are as large
as possible while still avoiding fragmentation.

36
PMTU-D

• A host does this by starting by sending packets that have a maximum


size of the lesser of the local MTU or the MSS announced by the remote
system.
• These packets are sent with the DF bit set.
• If there is some MTU between the two hosts which is too small to pass
the packet successfully, then an ICMP can't fragment error will be sent
back to the source.
• It will then know to lower the size; if the ICMP message includes the next
hop MTU, it can pick the correct size for that link immediately, otherwise
it has to guess.
37
PMTU-D

• The exact process that systems go through is somewhat more


complicated to account for special circumstances. See, RFC 1191.
• A good indication of if a system is trying to do PMTU-D is to watch the
packets it is sending with something like tcpdump or snoop and see if
they have the DF bit set; if so, it is most likely trying to do PMTU-D.
• Most Windows and Linux/Unix OS’s default to using PMTU-D.
• Adjusting IP MTU, TCP MSS, and PMTUD on Windows and Sun
Systems - http://www.cisco.com/warp/public/105/38.shtml
38
The problem with ICMP filtering and PMTU-D

• Many network administrators have decided to filter ICMP at a router or


firewall.
• There are valid (and many invalid) reasons for doing this, however it
can cause problems.
• ICMP is an integral part of the Internet and can not be filtered without
due consideration for the effects.
• In this case, if the ICMP can't fragment errors can not get back to the
source host due to a filter, the host will never know that the packets it is
sending are too large.
• This means it will keep trying to send the same large packet, and it will
keep being dropped--silently dropped from the view of any system on
the other side of the filter.
• While a small handful of systems that implement PMTU-D also
implement a way to detect such situations, most don't and even for
those that do it has a negative impact on performance and the network.

39
The Symptoms

• If this is happening, typical symptoms include the ability for


small packets (eg. request a very small web page) to get
through, but larger ones (eg. a large web page) will simply
hang.
• This situation can be confusing to the novice administrator
because they obviously have some connectivity to the
host, but it just stops working for no obvious reason on
certain transfers.

40
The Fix

• There is one solution, and several workarounds, for this problem.


• The Fix:

• Fix your filters!


– The real problem here is filtering ICMP messages without
understanding the consequences.
– Many packet filters will allow you to setup filters to only allow
certain types of ICMP messages through.
– If you reconfigure them to let ICMP can't fragment (type 3, code 4)
messages through, the problem should disappear.
– If the filter is somewhere between you and the other end, contact
the administrator of that machine and try to convince them to fix the
problem.
• We will learn how to do this on Router Access Control Lists (ACLs)

41
Recommended Reading

Where Wizards Stay Up Late


TCP/IP Illustrated, Vol. 1 W. Katie Hafner and Matthew Lyon
Richard Stevens Addison-Wesley ISBN 0613181530
Pub Co ISBN: 0201633469
 Very enjoyable reading and you
• Although, published in 1994, written by the do not have to be a networking
late Richard Stevens, it is still regarded as geek to enjoy it!
the definitive book on TCP/IP.  National Bestseller
42
Transitioning from UNIX to Windows Socket Programming

Paul O’Steen

Most applications use Sockets to write application that communicate over the Internet; unfortunately, the
Sockets interface varies slightly between operating systems. This guide provides brief instruction for those
already familiar with UNIX Socket programming who wish to write Socket applications under Microsoft
Windows using WinSock. To explain the differences between Sockets under UNIX and Windows, we
demonstrate the adaptation of the TCP echo client presented in TCP/IP Sockets in C: Practical Guide for
Programmers by Michael J. Donahoo and Kenneth L. Calvert. We begin by showing the setup of a Windows
socket project in Microsoft Visual C++ 6.0 and the execution of a console application. Then we give a side-by-
side comparison between the UNIX and Windows versions of the TCP echo client code, explaining each of the
key differences. This comparison will demonstrate all of the key differences between UNIX and Windows
Socket programming. It is important to understand that our objective is to make UNIX Socket application work
under Windows using WinSock with as few changes as possible. Many other changes are possible to make the
application take maximum advantage of WinSock specific features.

Creating a Windows Socket project

First, let’s create a working version of the Windows adaptation of the TCP echo client. Download the adapted
code from the book website at
http://cs.baylor.edu/~donahoo/practical/CSockets. You will need at least TCPEchoClientWS.c and
DieWithErrorWS.c. Now we can construct an executable using the Visual C++ development environment.

Making the Project


Setting up a project is the first step in working with Windows sockets. There are several important steps in
creating a Windows socket project. First, open Microsoft Visual C++ 6.0 and click on File and then New.

When the New window pops up, do the following:

1) select Projects tab


2) select Win32 Console Application
3) type a name in the project name field
4) pick a location to store your project
5) click OK.

1
A window will now pop up and ask what kind of application you would like to create. Click on An Empty
Project and then click Finish.

2
Adding Windows Sockets to the Project

Now click on Project and then Settings.

When the Settings window pops up, click on the Link tab in the top right corner. Under the
Object/libraries modules heading, add wsock32.dll to the list and click OK.

Adding Files to the Project

Now it is time to add the source files that you will be using for your project. Click on Project and then Add to
Project and then Files.

3
The Insert Files window will pop up and this is where you add the source file(s) to your project.
To add files to your project select the file or files you want to add and click OK. If you want to select multiple
files, hold down the Ctrl key and click on the files you want.

Using the Project from within Visual C++

You may run your application from within Visual C++’s debug environment. First, we need to specify the
parameters of our application to Visual C++. We do this under the Debug tab of the Project Settings dialog
box. Select Settings… from the Project menu, click on the Debug tab, and enter the arguments in the Program
arguments: field.)

Using the Project from the command line

You can run applications from the command line by opening the MS-DOS prompt in Windows.

4
Once you have opened the MS-DOS prompt, you are ready to locate your file. When the project was created
you selected the directory to store your project in the Location: and Project Name fields on the New window
screen. To get to your project directory, you need to type cd\directory where directory is the location\project
name of your project.

The executable is located in the Debug directory of the project directory.

To execute the application, type in the name of the file along with any arguments.

5
UNIX vs. Windows Sockets

To demonstrate the key differences, we perform a side-by-side comparison between the UNIX and adapted
Windows Socket code. We break the programs into separate sections, each of which deals with a specific
difference. Comments have been removed from the programs to allow focus on the key differences.
UNIX Windows
#include <stdio.h> #include <stdio.h>
#include <sys/socket.h> #include <winsock.h>
#include <arpa/inet.h> #include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Header File

Header files needed by Windows socket programs are slightly different than UNIX socket programs. For
windows socket programming you need to add the winsock.h header file to your programs. Since this file
includes all socket definitions and prototypes, several of the header files from the UNIX example are not
needed.
UNIX Windows
#define RCVBUFSIZE 32 #define RCVBUFSIZE 32

void DieWithError(char *errorMessage); void DieWithError(char *errorMessage);

int main(int argc, char *argv[]) void main(int argc, char *argv[])
{ {
int sock; int sock;
struct sockaddr_in echoServAddr; struct sockaddr_in echoServAddr;
unsigned short echoServPort; unsigned short echoServPort;
char *servIP; char *servIP;
char *echoString; char *echoString;
char echoBuffer[RCVBUFSIZE]; char echoBuffer[RCVBUFSIZE];
unsigned int echoStringLen; int echoStringLen;
int bytesRcvd, totalBytesRcvd; int bytesRcvd, totalBytesRcvd;
WSADATA wsaData;

if ((argc < 3) || (argc > 4)) if ((argc < 3) || (argc > 4))
{ {
fprintf(stderr, "Usage: %s fprintf(stderr, "Usage: %s
<Server IP> <Echo Word> <Server IP> <Echo Word>
[<Echo Port>]\n",argv[0]); [<Echo Port>]\n",argv[0]);
exit(1); exit(1);

6
} }

servIP = argv[1]; servIP = argv[1];


echoString = argv[2]; echoString = argv[2];

if (argc == 4) if (argc == 4)
echoServPort = atoi(argv[3]); echoServPort = atoi(argv[3]);
else else
echoServPort = 7; echoServPort = 7;

if (WSAStartup(MAKEWORD(2, 0),
&wsaData) != 0)
{
fprintf(stderr,"WSAStartup()
failed");
exit(1);
}
Application Setup

The setup of the application is identical except for initialization code required by WinSock. The WinSock
library is initialized by WSAStartup( ). The first parameter to the startup function is the version of
WinSock the program wishes to use. We want version 2.0. MAKEWORD(2, 0) returns the version (2.0)
number in the format expected by the startup function. The second parameter is a pointer to a WSADATA
structure that allows the WinSock library to communicate critical information to the program such as limits on
the number of sockets that can be created. WSAStartup( ) fills in the WSADATA structure before
returning.

typedef struct WSAData {


WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char FAR * lpVendorInfo;
} WSADATA;

WSAStartup( ) returns a zero on success or a non-zero number on failure.

7
UNIX and Windows
if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
DieWithError("socket() failed");

memset(&echoServAddr, 0, sizeof(echoServAddr));
echoServAddr.sin_family = AF_INET;
echoServAddr.sin_addr.s_addr = inet_addr(servIP);
echoServAddr.sin_port = htons(echoServPort);

if (connect(sock, (struct sockaddr *) &echoServAddr, sizeof(echoServAddr)) < 0)


DieWithError("connect() failed");

echoStringLen = strlen(echoString);

if (send(sock, echoString, echoStringLen, 0) != echoStringLen)


DieWithError("send() sent a different number of bytes than expected");

totalBytesRcvd = 0;
printf("Received: ");
while (totalBytesRcvd < echoStringLen)
{
if ((bytesRcvd = recv(sock, echoBuffer, RCVBUFSIZE - 1, 0)) <= 0)
DieWithError("recv() failed or connection closed prematurely");
totalBytesRcvd += bytesRcvd;
echoBuffer[bytesRcvd] = '\0';
printf(echoBuffer);
}

printf("\n");
Communication

The communication portion of the UNIX and Windows programs is identical.

UNIX Windows
close(sock); closesocket(sock);
WSACleanup();

exit(0); exit(0);
} }
Application Shutdown

The shutdown of the application differs slightly between UNIX and Windows. Instead of close( ),
WinSock uses closesocket( ); however, the two functions do the same thing so the difference is in name
only. Finally, we must use WSACleanup( ) to deallocate the resources used by Winsock. WSACleanup( )
returns a zero on success and a non-zero number on failure.

WinSock Error Reporting

Windows uses its own error message facility to indicate what went wrong with a Sockets call.
WSAGetLastError( ) returns an integer representing the last error that occurred. If a WinSock
application needs to know why a socket call failed, it should call WSAGetLastError( ) immediately after

8
the failed socket call. As you might expect, our error reporting function, DieWithError( ) must be
changed to work under Windows.

UNIX Windows
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <winsock.h>
#include <stdlib.h>
void DieWithError(char *errorMessage)
{ void DieWithError(char *errorMessage)
perror(errorMessage); {
exit(1); fprintf(stderr,"%s: %d\n",
} errorMessage, WSAGetLastError());
exit(1);
}
DieWithError( )

The Windows version of DieWithError( ) uses WSAGetLastError( ) instead of perror to report


system error messages.

Conclusion

Moving from UNIX sockets to Windows sockets is fairly simple. Windows programs require a different set of
include files, need initialization and deallocation of WinSock resources, use closesocket( ) instead of
close( ), and use a different error reporting facility. However, the meat of the application is identical to
UNIX.

9
Cơ bản về phân chia mạng con trên IPv4

1. Định địa chỉ IPv4 (IP version 4)

Trong môi trường TCP/IP, giao thức vận tải (routed protocol) IP vận chuyển các
gói tin từ mạng nguồn đến đến mạng đích. Do đó, sơ đồ định địa chỉ phải bao gồm định
danh cho cả mạng nguồn lẫn mạng đích. Khi các gói tin đến 1 bộ định tuyến kết nối với
mạng đích, thì giao thức vận tải IP phải định vị được cụ thể máy tính nào sẽ nhận các gói
tin này. Việc này tương tự như cách hệ thống bưu chính phân phối thư từ, bưu kiện. Đầu
tiên, bưu kiện hoặc thư từ phải được chuyển tới bưu điện ở thành phố đích - việc này
thực hiện được là nhờ có mã thư tín (postal code) - sau đó bưu điện đích phải định vị
được nhà nào sẽ nhận được bưu kiện, thư từ - việc này thực hiện được là nhờ số nhà.

Như vậy, mỗi địa chỉ IP bao gồm 2 phần, phần thứ nhất dùng để xác định chính
xác mạng X nào đó mà hệ thống kết nối đến, được gọi là phần mạng (network portion -
N) và phần thứ 2 dùng để xác định chính xác máy tính Y nào đó trên mạng X này – được
gọi là phần thiết bị đầu cuối người sử dụng (host portion - H). Mỗi địa chỉ IP phải là duy
nhất để đảm bảo tính chính xác khi truyền và nhận dữ liệu. Địa chỉ mạng (network
address) X được xác định bằng cách thực hiện phép toán logic AND giữa các bit của địa
chỉ IP và mặt nạ mạng con (subnet mask). Ta có bảng chân lý của AND như sau:

AND 0 1 Để ý rằng 0 AND với bất kỳ bit nào cũng


0 0 0 bằng 0 và bit nào AND với 1 thì bằng chính
1 0 1 bit đó.

Do đó, cấu trúc của 1 địa chỉ IPv4 và subnet mask (SM) là tương tự nhau, gồm 32
bits, được chia thành 4 bộ 8 bits, mỗi bộ được gọi là 1 octet (bộ tám), mỗi octet được
ngăn cách nhau bởi 1 dấu chấm. Lưu ý rằng SM khác IP ở chỗ là các bit 1 phải được
viết trước, khi nào viết xong toàn bộ các bit 1 thì các bit 0 mới được viết. Để cho dễ
viết, dễ đọc và tránh sai sót người ta chuyển các octet nhị phân thành các số thập phân.

Ví dụ:

00001010.00100010.00010111.10000110 (𝐼𝑃) 10.34.24.134


𝐴𝑁𝐷 11111111.11111111.00000000.00000000 (𝑆𝑀) ↔ 𝐴𝑁𝐷 255.255.0.0
00001010.00100010.00000000.00000000 10.34.0.0

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 1
Cơ bản về phân chia mạng con trên IPv4

IP và SM có thể được viết vắn tắt là IP/Tổng số các bit 1 trong SM, đồng thời
cũng xác định tổng số bit dành cho N. Từ ví dụ trên ta thấy rằng tống số các bit 1 trong
SM là 16. Do đó, địa chỉ IP trên được viết lại như sau: 10.34.24.134/16.

Không mất tính tổng quát ta có thể quy định cấu trúc của địa chỉ IPv4 dưới dạng:

𝑥, 𝑦, 𝑧, 𝑡 ∈ [0. .255] 𝑢 𝑥á𝑐 đị𝑛ℎ 𝑆𝑀 𝑣à 𝑠ố 𝑏𝑖𝑡 𝑑à𝑛ℎ 𝑐ℎ𝑜 𝑁


x.y.z.t/u với { ;{
𝑢 ∈ [1. .32] 𝑠ố 𝑏𝑖𝑡 𝑑à𝑛ℎ 𝑐ℎ𝑜 𝐻 = 32 − 𝑢

Ví dụ: 6.9.69.96/19

2. Các lớp địa chỉ IPv4

Nhằm cung cấp các mạng có kích thước khác nhau và giúp phân loại chúng, các
địa chỉ IP được chia thành các nhóm đươc gọi là lớp. Công việc này được gọi là định địa
chỉ có phân lớp (classful addressing).

Người ta quy định bit đầu tiên hoặc chuỗi các bit đầu tiên của mỗi địa chỉ xác định
lớp của địa chỉ đó.

Có 5 lớp địa chỉ IP:

• Lớp A: Network1. Host1. Host2. Host3 hay N1. H1. H2. H3


Hay x.y.z.t/8 với 𝒙 ∈ [𝟏. . 𝟏𝟐𝟔]; 𝒚, 𝒛, 𝒕 ∈ [𝟎. . 𝟐𝟓𝟓]

Từ định nghĩa trên, ta rút ra số bit dành cho N là 8 bit và H là 24 bit. Bit đầu
tiên của địa chỉ lớp A luôn luôn là 0; 7 bits còn lại của N1 có thể là 0 hoặc 1. Do đó,
N1 nhỏ nhất là 000000002 = 010 và lớn nhất là 011111112 = 12710. Tuy nhiên, 0
và 127 đã được dành riêng cho các mục đích chuyên dụng nên không thể sử dụng
làm địa chỉ mạng. Như vậy, bất kỳ giá trị N1 nào nằm trong đoạn từ 1 → 126 đều
là địa chỉ lớp A. H1, H2, H3 nằm trong đoạn từ 0 → 255.

Ví dụ: 10.0.0.1/8 là 1 địa chỉ lớp A.

Tổng số mạng lớp A là 126 (N: 1 → 126).

Tổng số host trên mỗi mạng lớp A là 224 – 2 = 16,777,214.

(2 địa chỉ gồm N1.0.0.0 là địa chỉ mạng và N1.255.255.255 là địa chỉ quảng bá)

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 2
Cơ bản về phân chia mạng con trên IPv4

• Lớp B: N1. N2. H1. H2


hay x.y.z.t/16 với 𝒙 ∈ [𝟏𝟐𝟖. . 𝟏𝟗𝟏]; 𝒚, 𝒛, 𝒕 ∈ [𝟎. . 𝟐𝟓𝟓]
Network portion N1.N2 chiếm 16 bits, Host portion H1.H2 chiếm 16 bits.
2 bit đầu tiên của N1 trong địa chỉ lớp B luôn là 10; 6 bit còn lại của N1 có thể là 0
hoặc 1. Do đó, N1 nhỏ nhất là 100000002=12810 và lớn nhất là 101111112=19110.

Ví dụ: 172.16.0.1/16 là 1 địa chỉ lớp B.

Tổng số mạng lớp B là 216-2 = 214 = 16,384 (trừ đi 2 bit đẩu tiên của N1)

Tổng số host trên mỗi mạng lớp B là 216 – 2 = 65,534.

(2 địa chỉ gồm N1.N2.0.0 là địa chỉ mạng và N1.N2.255.255 là địa chỉ quảng bá)

• Lớp C: N1.N2.N3.H1
Hay x.y.z.t/24 với 𝒙 ∈ [𝟏𝟗𝟐. . 𝟐𝟐𝟑]; 𝒚, 𝒛, 𝒕 ∈ [𝟎. . 𝟐𝟓𝟓]
Network portion N1.N2.N3 chiếm 24 bits, Host portion H1 chiếm 8 bits. 3
bit đầu tiên của N1 trong địa chỉ lớp C luôn luôn là 110; 5 bit còn lại của N1 có thể
là 0 hoặc 1. Do đó, N1 nhỏ nhất là 110000002=19210 và lớn nhất là 110111112=
22310.

Ví dụ: 192.168.0.1/24 là 1 địa chỉ lớp C.

Tổng số mạng lớp C là 224-3 = 221 = 2,097,152 (trừ đi 3 bit đẩu tiên của N1)

Tổng số host trên mỗi mạng lớp C là 28 – 2 = 254

(2 địa chỉ gồm N1.N2.N3.0 là địa chỉ mạng và N1.N2.N3.255 là địa chỉ quảng bá)

• Lớp D: x.y.z.t/32 với 𝒙 ∈ [𝟐𝟐𝟒. . 𝟐𝟑𝟗]; 𝒚, 𝒛, 𝒕 ∈ [𝟎. . 𝟐𝟓𝟓]


Vì u = 32 nên SM = 255.255.255.255, do đó:
(x.y.z.t AND 255.255.255.255) = x.y.z.t
Vậy địa chỉ lớp D có thể viết đơn giản là x.y.z.t, ví dụ: 224.0.0.5.
Lớp này được tạo ra nhằm hỗ trợ cập nhật thông tin giữa các bộ định tuyến
(truyền thông 1 – nhiều: multicasting), địa chỉ trong ví dụ trên được dùng bởi giao
thức định tuyến OSPF. 4 bits đầu tiên của 1 địa chỉ lớp D luôn luôn là 1110. Do đó,
octet đầu tiên của các địa chỉ lớp D sẽ nằm trong đoạn từ 11100000 đến
11101111, hay từ 224 → 239.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 3
Cơ bản về phân chia mạng con trên IPv4

𝑥 ∈ [240. .255]
• Lớp E: x.y.z.t/u với {𝑦, 𝑧, 𝑡 ∈ [0. .255]
𝑢 ∈ [1. .32]
Lớp này được tạo ra để dành riêng cho công tác nghiên cứu của Đội đặc
nhiệm ứng dụng khoa học kỹ thuật vào thiết kế, xây dựng và điều hành Internet
(Internet Engineering Task Force - IETF). 4 bits đẩu tiên của 1 địa chỉ lớp E luôn
luôn là 1111. Như vậy, octet đầu tiên của 1 địa chỉ lớp E sẽ nằm trong đoạn từ
11110000 đến 11111111, hay từ 240 đến 255.
3. Cơ bản về cách chia mạng 1 mạng lớn thành nhiều mạng con (subnetting)

a. Tại sao phải subnetting?

Nói 1 cách đơn giản, chia nhỏ 1 mạng lớn thành nhiều mạng con cho phép chúng
ta tận dụng được hết không gian địa chỉ IP, tăng tính bảo mật, quản lý, cấp phát các host,
các phân đoạn mạng đơn giản hơn, hiệu quả hơn. Với subnetting, mạng của chúng ta
không còn bị giới hạn bởi các chuẩn của lớp A, B, hay C. Hơn nữa, subnetting còn giúp
chúng ta tăng tính linh động, uyển chuyển khi thiết kế mạng, bảo tồn băng thông và giảm
kích thước các bảng định tuyến.

Nhớ lại rằng 1 mạng con là tập hợp của những địa chỉ sau đây:

Địa chỉ mạng Địa chỉ gán cho các trạm Địa chỉ quảng bá
(Không được gán) (Không được gán)
𝐼𝑃 Đị𝑎 𝑐ℎỉ 𝑚ạ𝑛𝑔
= 𝐴𝑁𝐷 = 𝑋𝑂𝑅
𝑆𝑀 𝑃ℎầ𝑛 𝑏ù 𝑐ủ𝑎 𝑆𝑀

b. Phương pháp subnetting

Các mạng con (subnet) được tạo ra từ mạng đã cho bằng cách mượn n bit từ
phần Host Portion (H) theo các công thức sau (chú ý rằng số bit dành cho H = 32 – u):

2𝑛 ≥ [𝑆 − 1(𝑠𝑢𝑏𝑛𝑒𝑡 đầ𝑢 𝑡𝑖ê𝑛) − 1(𝑠𝑢𝑏𝑛𝑒𝑡 𝑐𝑢ố𝑖 𝑐ù𝑛𝑔)]𝑣ớ𝑖 𝑆 𝑙à 𝑠ố 𝑚ạ𝑛𝑔 𝑐𝑜𝑛 (*)

Tuy nhiên do subnet đầu tiên (subnet zero) và cuối cùng hiện nay đã được cho
phép sử dụng nên từ (*) ta có: 𝟐𝒏 ≥ 𝑺(𝒔ố 𝒎ạ𝒏𝒈 𝒄𝒐𝒏) (1)

Từ giờ trở đi ta sẽ chỉ sử dụng công thức (1) khi tính S.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 4
Cơ bản về phân chia mạng con trên IPv4

232−𝑢−𝑛 − 1(đị𝑎 𝑐ℎỉ 𝑚ạ𝑛𝑔) − 1(đị𝑎 𝑐ℎỉ 𝑞𝑢ả𝑛𝑔 𝑏á) ≥ ℎ (số trạm tối đa/mạng con)

Hay 𝟐𝟑𝟐−𝒖−𝒏 − 𝟐 ≥ 𝒉 (2)

Từ (2) suy ra số IP/subnet = 𝒉 + 𝟐 = 𝟐𝟑𝟐−𝒖−𝒏 (3)

Chú ý: 0 ≤ 𝑛 ≤ 30 − 𝑢

Ví dụ 1: Cho địa chỉ IP lớp C. Tính số bits mượn để có thể tạo ra ít nhất 6 subnet. Khi đó
số trạm (host) tối đa trên mỗi subnet là bao nhiêu?

Giải:

𝑙ớ𝑝 𝐶 → 𝑢 = 24
Được cho { Ta có: 2𝑛 ≥ 6 → Chọn 2𝑛 = 8 = 23 > 6 → n = 3.
𝑆=6
𝑛=3
Khi đó u = 24 → u1 = 27 (SM mới) và h = 232−24−3 − 2 = 30 (hosts/subnet).

Ví dụ 2: Một mạng thuộc lớp B có thể có tối đa bao nhiêu mạng con?

Giải: Được cho lớp B → u = 16.

Số lượng mạng con càng nhiều thì số trạm/mạng con càng ít. Do đó số mạng con tối đa
tương ứng với số trạm/mạng con là tối thiểu → h = 2.

Ta có: 232−16−𝑛 − 2 = 2 → 216−𝑛 = 4 = 22 → n = 14 → S = 214 = 16384.

Ví dụ 3: Một mạng thuộc lớp A có thể có tối đa bao nhiêu trạm?

𝑙ớ𝑝 𝐴 → 𝑢 = 8
Được cho { Ta có: 2𝑛 = 1 → n = 0 → h = 232−8−0 − 2 = 16777214.
𝑆=1

Ví dụ 4: Giả sử bạn là chuyên viên quản trị mạng của công ty Banana và mạng của công
ty có địa chỉ 191.150.6.0/24. Bạn được yêu cầu phải gán các mạng con khác nhau từ địa
chỉ mạng trên cho 10 phòng ban của công ty. Khi đó mặt nạ mạng con của các mạng mới
được xác định như thế nào và hãy viết tường minh 3 mạng con đầu tiên?

Giải:

𝑢 = 24
Được cho { Ta có: 2𝑛 ≥ 10 → Chọn 2𝑛 = 16 = 24 > 10 → n = 4.
𝑆 = 10
𝑛=4
Khi đó u = 24 → u1 = 28 (SM mới): 255.255.255.240.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 5
Cơ bản về phân chia mạng con trên IPv4

Để viết được tường minh 1 mạng con thì ta cần xác định số IP/subnet là bao nhiêu?

Áp dụng công thức (3) ta có: h+2 = 232−24−4 = 16 (IP/subnet).

Như vậy, 3 subnet đầu tiên như sau:

Subnet 0: 191.150.6.0 ÷ 191.150.6.15/28

Subnet 1: 191.150.6.16 ÷ 191.150.6.31/28

Subnet 2: 191.150.6.32 ÷ 191.150.6.47/28

Để ý rằng tất cả các subnet được chia đều có chung SM là /28. Kỹ thuật chia như vậy
được gọi là FLSM (Fixed Length Subnet Mask) – Mặt nạ mạng con có độ dài cố định.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 6
Cơ bản về định tuyến và các giao thức định tuyến

I. Định tuyến
1. Khái niệm
Routing: là quá trình lựa chọn các đường đi trên một mạng máy tính để gửi dữ
liệu qua đó. Định tuyến chỉ ra hướng và đường đi tốt nhất (best path) từ nguồn
tới đích của các gói tin (packet) thông qua các nút trung gian là các bộ định tuyến
(router).
Routing Protocol (giao thức định tuyến): là một tập hợp các qui tắc mô tả một
giao thức lớp 3 sẽ gửi cập nhật cho nhau về các mạng hiện có. Nếu có nhiều đường
đi đến một mạng cùng tồn tại, giao thức định tuyến cũng sẽ xác định đường đi tốt
nhất được dùng. Khi các thiết bị có chung một hiểu biết về mạng đó, các thiết bị sẽ
bắt đầu chuyển tiếp các gói tin trên đường đi tốt nhất.
Có 3 bước cơ bản liên quan trong quá trình xây dựng, duy trì và sử dụng bảng định
tuyến:
Các giao thức định tuyến gửi các thông tin cập nhật về Routers hoặc về mạng
bên trong AS (vùng tự trị)
Bảng định tuyến được cập nhật từ các giao thức định tuyến và cung cấp các
thông tin theo yêu cầu.
Quá trình chuyển gói xác định đường đi nào cần lựa chon từ bảng định tuyến
để chuyển gói tin đi.
Routed Protocol: nó sử dụng các bảng “routing table” mà Routing Protocol xây
dựng để đảm bảo việc truyền dữ liệu qua mạng một cách đáng tin cậy.
Vùng tự trị (Autonomous System – AS): Internet được chia thành các vùng nhỏ
hơn gọi là các vùng tự trị. AS bao gồm tập hợp các mạng con được kết nối với nhau
bởi Router. Một hệ thống AS thông thường thuộc quyền sở hữu của một công ty
hay của một nhà cung cấp dịch vụ Internet (ISP) và các AS được kết nối với nhau.
Nhà quản lí phải đăng kí với cơ quan quản trị mạng trên Internet (Inter NIC) để
lấy được một số nhận dạng AS cho riêng mình. Bên trong mỗi AS, nhà quản lí có
quyền quyết định loại Router cũng như giao thức cho hệ thống định tuyến của
mình.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 1
Cơ bản về định tuyến và các giao thức định tuyến

Bảng định tuyến (routing table): một Router phải xem xét bảng định tuyến của
mình trước khi chuyển gói tin đến địa chỉ ở xa. Bảng này chứa các thông tin về
mạng đích mà Router cần biết để truyền gói tin một cách chính xác. Thông tin có
thể bao gồm các địa chỉ mạng, mạng con, các hệ thống độc lập. Trong bảng định
tuyến có thể bao gồm một tuyến mặc định, được biểu diễn bằng địa chỉ 0.0.0.0
0.0.0.0.
Bảng định tuyến của mỗi giao thức định tuyến là khác nhau, nhưng có thể bao gồm
những thông tin sau:
Địa chỉ đích của mạng, mạng con hoặc hệ thống.
Địa chỉ IP của Router chặng kế tiếp phải đến.
Giao tiếp vật lí phải sử dụng để đi đến Router kế tiếp.
Mặt nạ mạng của Địa chỉ đích.
Khoảng cách đến đích (VD: số lượng chặng để đến đích).
Thời gian (tính theo giây) từ khi Router cập nhật lần cuối.
Khoảng cách quản trị (Administrative Distance)
Administrative Distance (AD) được sử dụng để đánh giá độ tin cậy của
thông tin định tuyến mà Router nhận từ router hàng xóm. AD là một số nguyên
nhận giá trị từ 0 đến 255 (0: tương ứng với độ tin cậy cao nhất; 255: không có lưu
lượng đi qua tuyến này hay tuyến này không được sử dụng để vận chuyển thông
tin của người sử dụng). Thông tin định tuyến được đánh giá dựa vào AD, AD càng
thấp thì tuyến đó càng tin cậy. Điều này cũng đúng trong trường hợp Router được
cài đặt từ 2 giao thức định tuyến trở lên thì giao thức định tuyến nào có AD nhỏ
hơn sẽ được Router sử dụng.
Metric: là giá trị của tuyến đường cụ thể của một giao thức định tuyến nào đó.
Nếu có nhiều hơn một tuyến đường đến đích có cùng một giá trị AD thì tuyến nào
có Metric tốt hơn sẽ được đưa vào Routing Table. Nếu chúng có cùng AD và Metric
thì tùy từng Routing Protocol cụ thể mà số lượng tuyến đường được đưa vào
Routing table là khác nhau. Các giao thức định tuyến khác nhau sử dụng các Metric
khác nhau. Ví dụ RIP xác định tuyến đường tốt nhất là một tuyến đường có số
lượng router phải nhảy qua là ít nhất. EIGRP xác định tuyến đường tốt nhất dựa
trên sự kết hợp băng thông và tổng độ trễ của tuyến đường (ngầm định).

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 2
Cơ bản về định tuyến và các giao thức định tuyến

Giao thức định tuyến AD Metric


Outgoing Interface 0
(Cổng trên router)
Tĩnh Next-hop 1
(Địa chỉ IP của cổng trên
router hàng xóm)
EIGRP 90 Băng thông, độ trễ, độ tin cậy, tải, đơn vị
truyền lớn nhất
Động OSPF 110 Cost = 105/Băng thông (kbps)
RIP 120 Hop-Count (Đếm số router phải nhảy
qua để đến đích)
Bảng I.1 – AD và Metric của 1 số giao thức

Sự hội tụ mạng (convergence): một đặc tính cực kì quan trọng đối với các giao
thức định tuyến đó là các thông tin định tuyến trong các bảng định tuyến của tất
cả các Router trong mạng phải cùng chính xác.
Sự hội tụ là tuyến trình đưa tất cả các bảng định tuyến của các router vào một
trạng thái đồng nhất và chính xác
Thời gian hội tụ: là thời gian cần thiết để chia sẻ thông tin qua mạng và để cho
tất cả các Router tính toán tuyến đường tốt nhất của nó
Cân bằng tải (Load balancing)
Mục đích của Load balancing là để sử dụng băng thông của mạng một cách
hiệu quả hơn, và có thể sử dụng làm tuyến dự phòng trong khi tuyến đường chính
bị ngắt. Nếu một giao thức tìm thấy nhiều tuyến có chi phí bằng nhau, nó sẽ tự
động phân chia lưu lượng mạng giữa các tuyến này. Cơ chế chuyển mạch được
dùng bên trong Router (process switching hay fast switching) xác định quá trình
cân bằng tải nào sẽ được thực thi, round-robin hay session. Cân bằng tải theo kiểu
round-robin sẽ được dùng khi cơ chế process switching được dùng trong Router.
Nguyên tắc định tuyến: các giao thức định tuyến phải đạt những yêu cầu đồng
thời sau:
Khám phá động một cấu trúc liên kết mạng (topology)
Xây dựng các tuyến tốt nhất

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 3
Cơ bản về định tuyến và các giao thức định tuyến

Kiểm soát tóm tắt thông tin về các mạng bên ngoài, có thể sử dụng các Metric
khác nhau trong mạng cục bộ.
Phản ứng nhanh với sự thay đổi topology và cập nhật các tuyến tốt nhất.
Phải có chu kỳ làm việc hiệu quả
Các thành phần định tuyến (Components of Routing Data):
Routing table: là một bảng chứa các tuyến đường đến các mạng mà người
quản trị cấu hình. Các bảng này tạo ra bằng tay theo ý muốn của người quản
trị hay bằng cách thay đổi thông tin định tuyến với các router khác.
Câu lệnh để xem routing table: Router#show ip route
Xây dựng bảng định tuyến (Populating the Routing Table):
Trước khi tuyến đường được đưa vào bảng định tuyến, Router phải học về
những tuyến đường đó. Có 2 cách để học tuyến đường: Tĩnh (Statically
defining a route) và Động (Dynamically learning a route).
Quá trình xử lý để đưa gói tin đến đích (Reaching the Destination)
Sau khi Router nhận gói tin, thì Router sẽ gỡ bỏ phần header lớp 2 để tìm địa
chỉ đích thuộc lớp 3. Sau khi đọc xong địa chỉ đích lớp 3 nó tìm kiếm trong
Routing Table cho mạng chứa địa chỉ đích. Giả sử mạng đó có trong Routing
table, Router sẽ xác định địa chỉ của router hàng xóm (router chia sẻ chung
kết nối). Sau đó gói tin sẽ được đẩy ra bộ đệm của cổng truyền đi tương ứng,
Router sẽ khám phá loại đóng gói lớp 2 nào được sử dụng giữa trên kết nối
giữa 2 router. Gói tin được đóng gửi xuống lớp 2 và đưa xuống môi trường
truyền dẫn dưới dạng bit và được truyền đi bằng tín hiệu điện, quang hoặc
sóng điện từ. Quá trình sẽ tiếp tục cho tới khi gói tin được đưa đến đích thì
thôi.
2. Các kiểu định tuyến
Có hai loại định tuyến: định tuyến tĩnh và định tuyến động.
a) Định tuyến tĩnh (static route):
Các bước để cấu hình định tuyến tĩnh:
 Nhà quản trị cấu hình con đường tĩnh
 Router sẽ đưa con đường vào trong bảng định tuyến
 Con đường định tuyến tĩnh sẽ được đưa vào sử dụng

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 4
Cơ bản về định tuyến và các giao thức định tuyến

Ưu điểm:
 Khi dùng định tuyến tĩnh là giúp tiết kiệm tài nguyên mạng.
Nhược điểm:
 Người quản trị phải chịu trách nhiệm cập nhật cho từng dòng định tuyến tại
tất cả các router nếu có một thay đổi trong mạng.
 Các tuyến đường tĩnh không thể tự động thêm vào mỗi khi có thay đổi xảy ra
do đó các mạng sẽ không hội tụ cho đến khi nào router được cấu hình lại.
 Phù hợp với mạng nhỏ, rất khó triển khai trên mạng lớn.
Một vài tình huống phải dùng định tuyến tĩnh:
Các đường truyền có băng thông thấp.
Người quản trị mạng cần kiểm soát các kết nối.
Kết nối dùng định tuyến tĩnh là dự phòng cho đường kết nối dùng các giao
thức định tuyến động.
chỉ có một đường duy nhất đi ra mạng bên ngoài. Tình huống này gọi là mạng
stub.
Router có ít tài nguyên và không thể chạy một giao thức định tuyến động.
Người quản trị mạng cần kiểm soat bảng định tuyến và cho phép các giao thức
định tuyến classful và classless.

Cú pháp: Router(config)#ip route {destination network} {subnet mask}

{next-hop | outgoing interface} [administrative distance]

Ghi chú: Tham số trong {…} là bắt buộc, trong […] là tùy chọn

 Destination network: Địa chỉ mạng đích


 Subnet-mask: là mặt nạ mạng con của mạng đích
 Next-hop: Địa chỉ IP của cổng trên router kế tiếp mà gói tin sẽ đi đến
 Outgoing interface: cổng của router mà gói tin sẽ đi ra
Defaut route: được sử dụng để gửi các gói tin đến các mạng đích không có trong
bảng định tuyến và thường được sử dụng trên các mạng stub.
Cú pháp:
Router(config)# ip route 0.0.0.0 0.0.0.0 { next-hop ip | outgoing interface}

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 5
Cơ bản về định tuyến và các giao thức định tuyến

Backup route: trong 1 số trường hợp cụ thể thì tuyến tĩnh được sử dụng như 1
tuyến dự phòng.
Ví dụ: Giả sử rằng trên router chạy đồng thời giao thức định tuyến động và tĩnh,
trong đó tuyến động có băng thông 1Mbps còn tuyến tĩnh chỉ có băng thông
256kbps. Rõ ràng với AD = 0/1 thì tuyến tĩnh sẽ được ưu tiên. Tuy nhiên ta lại
không muốn vậy vì băng thông của tuyến tĩnh thấp hơn nhiều so với tuyến động.
Do đó, ta cần cấu hình tuyến động là tuyến chính còn tuyến tĩnh làm tuyến dự
phòng. Điều này được thực hiện bằng cách thêm tùy chọn AD vào câu lệnh cấu
hình tĩnh sao cho AD của tuyến tĩnh lớn hơn AD tuyến động, chẳng hạn:
Router(config)# ip route 19.7.88.0 255.255.255.0 s0/0/0 130

Lab I.1: Cáu hı̀nh định tuyén tı̃nh cơ bản

Hình I.1 – Sơ đồ mạng Lab 1

Yêu cầu: Sử dụng Cisco Packet Tracer để xây dựng mạng như sơ đồ trên

i. Đặt tên cho các router và gán địa chỉ IP cho các cổng tương ứng với sơ đồ mạng
đã cho
ii.RouterC – S0/0/0 đóng vai trò DCE do đó phải sử dụng câu lệnh clock rate
trên cổng này
iii. Cấu hình định tuyến tĩnh cho các router sử dụng cổng ra vào của lưu lượng
mạng là outgoing interface hoặc next – hop
iv.Từ các Router, ta phải ping được tất cả địa chỉ trong mạng

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 6
Cơ bản về định tuyến và các giao thức định tuyến

Các bước thực hiện:


Bước 1: Thực hiện yêu cầu (i), (ii) và (iii) như sau:

Router A
Router> enable RouterA(config-if)# no shut down
Router# configure terminal RouterA(config-if)# interface f0/0
Router(confìg)# hostname RouterA RouterA(config-if)# ip address 10.0.0.2
RouterA(config)# no ip domain-lookup 255.255.255.0
RouterA(config)# interface s0/0/0 RouterA(config-if)# no shut down
RouterA(config-if)# ip address 10.0.3.2 Router(config-if)# end
255.255.255.0 Router# write memory

Router B Router C
Router> enable Router> enable
Router# configure terminal Router# configure terminal
Router(config)# hostname RouterB Router (config) # hostname RouterC
RouterB(config)# no ip domain-lookup RouterC(config) # no ip domain-lookup
RouterB(config)# interface f0/0 RouterC(config) # interface s0/0/0
RouterB(config-if)# ip address 10.0.2.1 RouterC(config-if)# ip address 10.0.3.1
255.255.255.0 255.255.255.0
RouterB(config-if)# no shut down RouterC(config-if) # clock rate 64000
RouterB(config-if)# exit RouterC(config-if) # no shut down
RouterB(config)# ip route 10.0.3.0 RouterC(config-if) #exit
255.255.255.0 f0/0 RouterC(config)# ip route 10.0.2.0
RouterB(config)# end 255.255.255.0 10.0.3.2
RouterB# write memory RouterC(config)# end
RouterC# write memory

Kiểm tra lại cấu hình dùng lệnh show running-config và show ip interface brief

để đảm bảo cấu hình đúng, giải quyết sự cố nếu cần.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 7
Cơ bản về định tuyến và các giao thức định tuyến

Bước 2: Kiểm tra bảng định tuyến dùng lệnh show ip route. Yêu cầu tất cả mạng
con phải được hiển thị (2 mạng con).

Ví dụ:

Bước 3: Thực hiện yêu cầu (iv)

Ví dụ:


b) Định tuyến động (Dynamic Routing): Giao thức định tuyến động không chỉ
thực hiện chức năng tự tìm đường và cập nhật bảng định tuyến, nó còn có thể
xác định tuyến đường đi tốt nhất thay thế khi tuyến đường đi tốt nhất không
thể sử dụng được. Khả năng thích ứng nhanh với sự thay đổi mạng là lợi thế
rõ rệt nhất của giao thức định tuyến động so với giao thức định tuyến tĩnh.
Ưu điểm:
 Đơn giản trong việc cấu hình
 Tự động tìm ra những tuyến đường thay thế khi mạng thay đổi.
Nhược điểm:
 Yêu cầu xử lí của CPU của Router cao hơn so với static route
 Tiêu tốn một phần băng thông trên mạng để xây dựng bảng định tuyến.
Tất cả các giao thức định tuyến động được xây dựng dựa trên giải thuật.
Một cách tổng quan giải thuật là một tiến trình (procedure) nhằm giải quyết một
vấn đề nào đó.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 8
Cơ bản về định tuyến và các giao thức định tuyến

Một giải thuật định tuyến tối thiểu phải xử lí được những tiến trình sau:
Tiến trình chuyển thông tin định tuyến cho các router khác.
Tiến trình nhận thông tin định tuyến từ các router khác.
Tiến trình xác định tuyến đường tốt nhất dựa trên những thông tin nhận được
từ các router khác.
Tiến trình để Router có thể phản ứng với sự thay đổi của hệ thống mạng.

RIP (Routing Information Protocol) OSPF


(Open Shortest Path First)
IGRP (Interior Gateway Routing Protocol) EIGRP (Enhanced IRGP)
IS-IS (Intermediate System – to – Intermediate System) BGP
(Border Gateway Protocol)
Bảng I.2 – Các giao thức định tuyến động

II. Các thuật toán tìm đường đi


1. Distance- vector routing: được chia làm hai phần distance và vector.
Distance chính là metric để tới đích, vector là hướng để tới đích nó được
xác định bằng next-hop của tuyến đường.
Các giao thức Distance-vector cập nhật bảng định tuyến của mình bằng
cách thường xuyên gửi update theo chu kì dưới dạng quảng bá (broadcast). Thông
điệp Broadcast bao gồm toàn bộ bảng định tuyến. Các giao thức định tuyến
Distance-vector có một vấn đề chung là hiện tượng “Routing-Loop” (thông tin
định tuyến không thống nhất giữa các router). Routing-loop xảy ra do các Router
không được cập nhật (update) ngay lập tức mà phải theo chu kì dẫn tới việc xây
dựng bảng định tuyến không đúng. Hiện tượng “Routing-Loop” đã phát sinh lưu
lượng mạng vô ích gây lãng phí băng thông và khiến mạng chậm hội tụ.
Các phương pháp để tránh Loop:
Split Horizon: Khi router nhận được cập nhật định tuyến của một mạng từ
phía cổng nào thì nó không gửi ngược lại cập nhật cho mạng ấy về phía cổng
mà nó nhận được nữa.
Routing Poisoning: bắt đầu hoạt động khi Router nhận thấy một mạng nối
tới bị down. Nó sẽ quảng bá tới tất cả các Router lân cận nó rằng mạng đó
không thể tới được.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 9
Cơ bản về định tuyến và các giao thức định tuyến

Poison – reverse: Khi router láng giềng nhận được bản tin cập nhật về một
mạng con bị sự cố có metric = 16 (infinity metric), nó cũng phải ngay lập tức
hồi đáp cho láng giềng một bản tin cập nhật về mạng con ấy cũng với metric =
16.
Triggered updates: việc phát ra các bản tin Route – poisoning và Poison –
reverse phải được thực hiện ngay lập tức mà không cần chờ tới hạn định kỳ
gửi cập nhật định tuyến được gọi là hoạt động triggered update.
Hold-down timer: sau khi nhận được một poisoned route, router sẽ khởi
động bộ định thời holddown – timer cho route này. Trước khi bộ timer này
hết hạn, không tin tưởng bất kỳ thông tin định tuyến nào về route bị sự cố này,
ngoại trừ thông tin đến từ chính láng giềng đã cập nhật cho mình route này
đầu tiên. Giá trị ngầm định của holddown – timer là 180s.
RIP for IP Xerox Networking System RIP
Novell’s IPX RIP IGRP
DEC’s DNA Phase IV Apple Talk’Routing Table Maintenance Protocol (RTMP)
Bảng II.1 – Các giao thức định tuyến Distance – Vector
Đặc điểm chung của Distance vector:
Cập nhật định kì: có nghĩa rằng cứ hết một chu kì thời gian nào đó thì thông
tin cập nhật sẽ được truyền đi. Khoảng chu kì này có thể là 10 giây với Apple
Talk’RTMP, 30 giây với RIP và 90 giây với IGRP.
Neighbor: trong cách nhìn của một Router, neighbor có nghĩa là những Router
chia sẻ chung những kết nối. Một giao thức Distance vector gửi bản thông tin
cập nhật tới các Router neighbor và dựa vào chúng để chuyển thông tin cập
nhật tới những Router neighbor của chúng.
Cập nhật toàn bộ bảng định tuyến: hầu hết các giao thức distance vector sử
dụng cơ chế rất đơn giản là nói cho neighbor của nó tất cả những gì nó biết
bằng cách quảng bá toàn bộ bảng định tuyến.
Ưu điểm:
 Dễ cấu hình.
 Router ít tốn CPU và bộ nhớ.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 10
Cơ bản về định tuyến và các giao thức định tuyến

Nhược điểm:
 Hệ thống Metric đơn giản nên việc xác định đường đi tốt nhất chưa chính xác.
 Chiếm nhiều băng thông khi cập nhật do phải gửi toàn bộ bảng định tuyến
 Do các Router hội tụ chậm dẫn đến việc sai lệch trong bảng định tuyến.
2. Link – State Routing (Định tuyến theo trạng thái liên kết)
Trong định tuyến Distance – vector, các router chỉ biết được next-hop để
gửi gói tin đi tới đích. Đối với Link-State Routing mỗi router xác định được chính
xác topology của mạng. Vì vậy router sẽ quyết định chuyển gói tin tới đích theo
đường nào là tốt hơn. Quá trình xây dựng topology trên mỗi router được bắt đầu
bằng cách gửi gói tin hello đến các router hàng xóm của nó nhằm thiết lập mối
quan hệ. Sau đó mỗi router trong mạng sẽ báo cáo trạng thái của nó, các kết nối
trực tiếp và trạng thái của mỗi kết nối đó. Router nào nhận được thông tin này sẽ
kết hợp với kiến thức mà nó đã biết để hình thành nên kiến thức mới về topology.
Quá trình này được lặp lại cho đến tất cả các router trong mạng đều có cái nhìn
giống nhau về topology.
Với định tuyến Distance-vector thì các router sẽ gửi toàn bộ bảng định
tuyến của mình cho các router hàng xóm. Trong khi đó với định tuyến Link – State
thì các router chỉ gửi thông tin về sự thay đổi xảy ra trong mạng hay một bản tin
duy trì trạng thái với kích thước nhỏ gọn nếu như mạng không có sự thay đổi theo
những chu kì nhất định.
Ưu điểm:
 Có thể thích nghi với đa số hệ thống mạng, cho phép người thiết kế có thể thiết
kế mạng linh hoạt, phản ứng nhanh với tình huống xảy ra
 Đảm bảo được các băng thông cho các đường mạng
 Ít tốn băng thông
Nhược điểm:
 Tốn nhiều bộ nhớ và CPU của Router khi chạy thuật toán tìm đường ngắn nhất
 Khó cấu hình
Hoạt động của Link-State routing protocol có thể chia làm 4 bước:
Các Router tìm neighbors của mình từ các Router nối trực tiếp.
Sau khi tìm được neighbor xong Router gửi các LSA (xác thực trạng thái liên
kết) tới neighbor của nó.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 11
Cơ bản về định tuyến và các giao thức định tuyến

Tất cả các Router lưu LSA trong database của nó. Điều đó có nghĩa đều có một
cái nhìn giống nhau về topology.
Mỗi Router sử dụng thuật toán Dijktra để tính toán đường đi tốt nhất để đưa
vào Routing Table.
Quyết định tuyến đường nào sẽ được lưu vào trong Routing Table. AD và
Metric là hai nhân tố quyết định tuyến đường nào sẽ được lưu vào trong Routing
Table. Nhân tố đầu tiên xét đến là AD, nếu có nhiều tuyến đường tới đích thì tuyến
đường nào có AD nhỏ hơn sẽ được đưa vào Routing Table, nếu các tuyến đường
có cùng AD thì nhân tố thứ hai xét đến là các Metric.

Open Shortest Path Frist (OSPF) for IP IS-IS for CLNS và IP


DEC’s NLSP
Bảng II.2 – Các giao thức định tuyến Link – State

III. Giao thức định tuyến RIP (Routing Information Protocol)


1. Định nghĩa: RIP là giao thức định tuyến distance-vector điển hình, nó đều đặn gửi
toàn bộ Routing Table ra tất cả các Các cổng đang hoạt động theo chu kì 30 giây.
RIP chỉ sử dụng Metric là hop-count để tính ra tuyến đường tốt nhất tới remote
network.
2. Đặc điểm chính của RIP
RIP là một giao thức distance – vector điển hình. Mỗi router sẽ gửi toàn bộ
bảng định tuyến của nó cho router láng giềng theo định kỳ 30s/lần. Thông
tin này lại tiếp tục được láng giềng lan truyền tiếp cho các láng giềng khác
và cứ thế lan truyền ra mọi router trên toàn mạng. Kiểu trao đổi thông tin
như thế còn được gọi là “lan truyền theo tin đồn”. (Ở đây, ta có thể hiểu
router láng giềng là router kết nối trực tiếp với router đang xét).

Metric trong RIP được tính theo hop count – số node lớp 3 (router) phải đi
qua trên đường đi để đến đích. Với RIP, giá trị metric tối đa là 15, giá trị
metric = 16 được gọi là infinity metric (“metric vô hạn”), có nghĩa là một
mạng chỉ được phép cách nguồn tin 15 router là tối đa, nếu nó cách nguồn
tin từ 16 router trở lên, nó không thể nhận được nguồn tin này và được
nguồn tin xem là không thể đi đến được
RIP chạy trên nền UDP – port 520.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 12
Cơ bản về định tuyến và các giao thức định tuyến

Cách hoạt động của RIP có thể dẫn đến loop nên một số quy tắc chống loop
và một số timer được đưa ra. Các quy tắc và các timer này có thể làm giảm
tốc độ hội tụ của RIP
Administrative distance (AD) là 120
Có 2 phiên bản: RIPv1, RIPv2 trong đó RIPv2 là một giao thức hỗ trợ định
tuyến không phân lớp (classless routing) còn RIPv1 lại là một giao thức
định tuyến phân lớp (classful routing)
3. Các giá trị về thời gian (RIP timer)
Routing update timer: là khoảng thời gian trao đổi định kì thông tin định
tuyến của Router ra tất cả các cổng đang hoạt động. Thông tin định tuyến ở
đây là toàn bộ Routing Table, giá trị thời gian là 30 giây.
Route không hợp lệ timer: là khoảng thời gian trôi qua để xác định một
tuyến là không hợp lệ. Nó được bắt đầu nếu hết thời gian hold-down timer
mà không nhận được cập nhật, sau khoảng thời gian route không hợp lệ
timer nó sẽ gửi một bản tin cập nhật tới tất cả các Các cổng đang hoạt động
tuyến đường đó là không hợp lệ.
Holddown-timer: giá trị này được sử dụng khi thông tin về tuyến này bị
thay đổi, ngay khi thông tin mới được nhận, Router đặt tuyến đường đó vào
trạng thái hold-down. Điều này có nghĩa là Router không gửi quảng bá cũng
như không nhận quảng bá về tuyến đường đó trong khoảng thời gian
holdown-timer này. Sau khoảng thời gian này Router mới nhận và gửi
thông tin về tuyến đường đó. Tác dụng về giá trị này là làm giảm thông tin
sai mà Router học được. Giá trị mặc định là 180 giây.
Router flush timer: là khoảng thời gian được tính từ khi truyền ở trạng
thái không hợp lệ đến khi tuyến bị xóa khỏi bảng định tuyến. Giá trị Route
không hợp lệ timer phải nhỏ hơn giá trị Route flush timer vì Router cần
thông báo đến neighbor của nó về trạng thái không hợp lệ của tuyến đó
trước khi local routing được update.
4. Hoạt động của RIP:
Router RIP sẽ gửi bảng định tuyến để cập nhật thông tin sau khoảng thời
gian trung bình là 30 giây (update timer), địa chỉ đích của thông tin cập nhật này
là là 255.255.255.255 (all-hosts broadcast).

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 13
Cơ bản về định tuyến và các giao thức định tuyến

Trong vòng 180 giây mà không nhận được thông tin cập nhật thì hop count
của tuyến sẽ mang giá trị là 16, mặc dù tuyến này là không thể đến được nhưng
nó vẫn được dùng để chuyển tiếp gói.
Router sẽ không nhận bất cứ cập nhật mới của tuyến này trong khoảng thời
gian 180 giây (holddown timer).
Khoảng thời gian Router phải chờ trước khi xóa tuyến khỏi bảng định tuyến
là 240 giây (flush timer/garbage collection timer).
5. RIP phiên bản 1 (RIPv1): là giao thức định tuyến theo Distance-vector, sử dụng
hop-count (đếm số router phải đi qua để đến đích) làm Metric nhằm xác định
hướng và khoảng cách cho một liên kết bất kỳ trong mạng. Quảng bá toàn bộ bảng
định tuyến của nó cho các Router láng giềng theo chu kì 30 giây.
RIPv1 là giao thức định tuyến phân lớp (classful routing). Khi RIP Router
nhận thông tin về một mạng nào đó từ một cổng, trong thông tin định tuyến không
có thông tin về mặt nạ mạng con (subnet mask) đi kèm do đó router sẽ lấy subnet
mask của cổng để áp dụng cho địa chỉ mạng mà nó nhận được từ cổng này. Nếu
subnet mask này không phù hợp thì nó sẽ lấy subnet mask mặc định theo lớp địa
chỉ để áp dụng cho địa chỉ mạng mà nó nhận được.
Địa chỉ lớp A có subnet mask mặc định là: 255.0.0.0 (/8)
Địa chỉ lớp B có subnet mask mặc định là: 255.255.0.0 (/16)
Địa chỉ lớp C có subnet mask mặc định là: 255.255.255.0 (/24)
6. RIP phiên bản 2 (RIPv2)
Hỗ trợ định tuyến không phân lớp (Classless Routing) do mặt nạ mạng con
(subnet mask) được gửi kèm trong thông tin định tuyến. Với các giao thức định
tuyến Classless, các mạng con khác nhau trong cùng một mạng có thể có subnet
mask khác nhau, điều này được gọi là Mặt nạ mạng con có độ dài biến đổi (VLSM
– Variable-Length Subnet Masking).





Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 14
Cơ bản về định tuyến và các giao thức định tuyến

7. Điểm khác nhau giữa RIPv1 và RIPv2


RIPv1 RIPv2

Giao thức định tuyến Phân lớp (Classful) Không phân lớp
(Classless)

Hỗ trợ VLSM Không Có

Gửi kèm mặt nạ mạng con trong Không Có


thông tin định tuyến
Kiểu địa chỉ khi gửi cập nhật Quảng bá (Broadcast) Nhóm (Multicast)
255.255.255.255 224.0.0.9

Được mô tả trong RFC 1058 RFCs 1721, 1722


and 2453

Hỗ trợ tóm tắt các tuyến bằng tay Không Có

Hỗ trợ xác thực Không Có

Bảng III.1 – RIPv1 vs. RIPv2

8. Kích hoạt RIP


RIP được kích hoạt bằng bằng câu lệnh sau: Router(config)# router rip
Đối với RIPv2 cần có thêm câu lệnh sau đây:
Router(config-router)# version 2
Khai báo các mạng con cần quảng bá cũng như cho phép các cổng được gửi và
nhận RIP bằng câu lệnh:
Router(config-router)#network {network address}
9. Kiểm tra hoạt động của RIP
Router# show ip protocol
Router# show ip route
Router# debug ip rip để quan sát RIP cập nhật bằng cách gửi và nhận trên Router
Router# no debug ip rip hoặc Router#undebug all để tắt chế độ debug.
Router# show protocols để xem các giao thức nào được cấu hình trên cổng


Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 15
Cơ bản về định tuyến và các giao thức định tuyến

10. Lab 2: Cấu hình RIP cơ bản

Hình III.1 – Sơ đồ mạng Lab 2

Yêu cầu: Sử dụng Cisco Packet Tracer để xây dựng mạng như sơ đồ trên
i. Đặt tên cho các router và gán địa chỉ IP cho các cổng theo sơ đồ đã cho
ii. Chú ý Cancun – S0/0/0 và Acapulco – S0/0/0 là DCE nên cần có câu lệnh clock
rate
iii. Sử dụng RIPv2 để định tuyến giữa các mạng con (xem lại phần 8 ở trên)
iv. Các router đều ping được tất cả các địa chỉ trong mạng và ngược lại
Các bước thực hiện:
Bước 1: Thực hiện yêu cầu (i), (ii), (iii) như sau:
Cancun Router
Router> enable Cancun(config-if)# ip address 172.16.20.1
Router# configure terminal 255.255.255.252
Router(config)# hostname Cancun Cancun(config-if)# exit
Cancun(config)# interface f0/0 Cancun(config)# router rip
Cancun(config-if)# no shutdown Cancun(config-router)# version 2
Cancun(config-if)# ip address 172.16.10.1 Cancun(config-router)# network
255.255.255.0 172.16.0.0
Cancun(config-if)# interface s0/0/0 Cancun(config-router)# no auto-summary
Cancun(config-if)# no shutdown Cancun(config-router)# end
Cancun(config-if)# clock rate 64000 Cancun# write memory

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 16
Cơ bản về định tuyến và các giao thức định tuyến

Acapulco Router
Router> enable Acapulco(config-if)# exit
Router# configure terminal Acapulco(config)# router rip
Router(config)# hostname Acapulco Acapulco(config-router)# version 2
Acapulco(config)# interface f0/0 Acapulco(config-router)# network
Acapulco(config-if)# no shutdown 172.16.0.0
Acapulco(config-if)# ip address 172.16.30.1 Acapulco(config-router)# no auto-
255.255.255.0 summary
Acapulco(config-if)# interface s0/0/1 Acapulco(config-router)# end
Acapulco(config-if)# no shutdown Acapulco# write memory
Acapulco(config-if)# ip address 172.16.20. 2
255.255.255.252
Acapulco(config-if)# interface s0/0/0
Acapulco(config-if)# no shutdown
Acapulco(config-if)# clock rate 64000
Acapulco(config-if)# ip address 172.16.40.1
255.255.255.252

Mazatlan Router
Router> enable Mazatlan(config-if)# exit
Router# configure terminal Mazatlan(config)# router rip
Router(config)# hostname Mazatlan Mazatlan(config-router)# version 2
Mazatlan(config)# interface f0/0 Mazatlan(config-router)# network
Mazatlan(config-if)# no shutdown 172.16.0.0
Mazatlan(config-if)# ip address Mazatlan(config-router)# no auto-
172.16.50.1 255.255.255.0 summary
Mazatlan(config-if)# interface s0/0/1 Mazatlan(config-router)# end
Mazatlan(config-if)# no shutdown Mazatlan# write memory
Mazatlan(config-if)# ip address
172.16.40.2 255.255.255.252

Kiểm tra lại cấu hình dùng lệnh show running-config và show ip
interface brief để đảm bảo cấu hình đúng, giải quyết sự cố nếu cần.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 17
Cơ bản về định tuyến và các giao thức định tuyến

Bước 2: Kiểm tra bảng định tuyến dùng lệnh show ip route. Yêu cầu tất cả mạng
con phải được hiển thị (5 mạng con).
Ví dụ:


Bước 3: Thực hiện yêu cầu (iv)
Ví dụ:

IV. Giao thức định tuyến EIGRP


1. Giới thiệu về EIGRP

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 18
Cơ bản về định tuyến và các giao thức định tuyến

EIGRP là giao thức định tuyến lai giữa Distance vector và Link-state, tận
dụng và phát huy những ưu điểm của 2 kỹ thuật định tuyến trên. EIGRP là giao
thức độc quyền của Cisco, được đưa vào năm 1994, được phát triển từ giao thức
IGRP nhằm khắc phục các nhược điểm của RIP/IGRP. EIGRP là một giao thức định
tuyến liên miền không phân lớp (CIDR-Classless Interdomain Routing) và cho
phép người thiết kế mạng tối ưu không gian địa chỉ bằng VLSM.
Đặc biệt EIGRP còn có thể thay thế cho giao thức Novell Routing
Information Prorotocol (Novell RIP) và Apple Takl Routing Table Maintenance
Protocol (RTMP) để phục vụ tốt cho cả 2 mạng IPX và Apple Talk.
EIGRP là một lựa chọn lí tưởng cho các mạng lớn, đa giao thức được xây
dựng dựa trên Cisco Router.
Ưu điểm:
 Dễ cấu hình.
 Hội tụ nhanh có thể dùng cho các mạng có tính mở rộng cao
 Tiết kiệm tài nguyên mạng khi trao đổi thông tin
 Sử dụng địa chỉ Multicast để liên lạc
 Khả năng sử dụng hiệu quả băng thông.
 Hỗ trợ VLSM và vấn đề mạng không liên tục
Các giao thức nhóm Classless được thiết kế để khắc phục các hạn chế của
định tuyến Classful, trong đó bao gồm các đặc điểm sau:
Không gian địa chỉ được sử dụng hiệu quả
Hỗ trợ VLSM và CIDR
Các tuyến có thể được summary
2. Định nghĩa của Prefix/CIDR
Prefix routing là một công cụ cho phép router có thể dùng môt phần địa chỉ
IPv4 (32-bit) để nhận dạng một hệ thống mạng. Công cụ này cho phép tóm gọn
lại các địa chỉ trong bảng định tuyến. Kết quả là hệ thống này được quảng bá
ra ngoài bằng một địa chỉ mạng duy nhất. Việc tóm tắt các địa chỉ sẽ tạo ra các
địa chỉ classless và liên quan đến vấn đề định tuyến giữa các miền trên liên
mạng (Classless InterDomain Routing).
3. Các thuật ngữ của EIGRP
THUẬT NGỮ ĐỊNH NGHĨA

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 19
Cơ bản về định tuyến và các giao thức định tuyến

Neighbor Một Router đang chạy EIGRP và kết nối trực tiếp
Neighbor table Một danh sách của các Router bao gồm:
 Địa chỉ IP
 Các cổng của Router đi ra ngoài
 Hold –time
 SRTT và thời gian update
 Chứa các thông tin chỉ ra Router láng giềng đã thêm vào bảng
được bao lâu
 Bảng này được xây dựng từ các thông tin nhận được từ các gói
tin hello
Route table Bảng định tuyến, bảng này chứa danh sách các mạng hiện có và
đường đi tốt nhất về các mạng này. Một route EIGRP sẽ được đưa
vào bảng định tuyến khi route loại feasible successor được chỉ ra.
Topology table Một bảng chứa tất cả các đường đi được quảng bá bởi các Router
láng giềng. Đây là danh sách tất cả các Router dự phòng, route tốt
nhất, giá trị AD và các cổng của Router. Giải thuật DUAL sẽ tính toán
trên bảng topology này để xác định successor để xây dựng một
bảng định tuyến.
Hello Một thông điệp được dùng để duy trì bảng các Router láng giềng.
Các gói hello này được gửi định kì và được gửi theo kiểu không tin
cậy.
Update Một gói EIGRP chứa các thông tin thay đổi về mạng. Các gói này
được gửi theo cơ chế tin cậy. Nó được gửi chỉ khi có một thay đổi
ảnh hưởng đến Router.
 Khi một láng giềng xuất hiện
 Khi một láng giềng đi từ trạng thái active sang passive
 Khi có một sự thay đổi trong tính toán Metric cho một địa chỉ
mạng đích
Query Được gửi từ Router khi Router mất đi một đường đi về một mạng
nào đó. Nếu không có đường đi dự phòng (feasible successor),
Router sẽ gửi ra các gói tin truy vấn (query) để hỏi về đường đi dự
phòng. Khi này Router sẽ chuyển sang trạng thái active. Khi các gói
tin truy vấn của EIGRP được gửi ra theo kiểu tin cậy.
Reply Là một trả lời cho gói tin Query. Nếu Router không có thông tin nào
trong gói Reply, Router sẽ gửi gói Query đến tất cả các Router láng
giềng. Một unicast sẽ được gửi lại.
ACK Bản chất là một gói tin hello nhưng không có dữ liệu bên trong.
Hold time Giá trị được thiết lập trong gói hello. Thời gian Hold time này sẽ
xác định Router sẽ đợi một khoảng thời gian bao lâu trước khi công
bố mạng là bị down. Thông tin này được để trong bảng neighbor.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 20
Cơ bản về định tuyến và các giao thức định tuyến

Smooth Round Khoảng thời gian Router phải đợi sau khi gửi một gói tin để nhận
Trip được ACK. Thông tin này được giữ trong bảng neighbor và được
Time(SRTT) dùng để tính khoảng thời gian RTO.
Retransmission RTO sẽ xác định khoảng thời gian mà Router phải chờ trước khi
Time Out(RTO) truyền lại một gói tin.
Reliable Đây là cơ chế dùng để xác định các yêu cầu mà một gói tin được
Transport phân phối theo thứ tự.
Protocol (RTP)
Diffusing Một giải thuật được thực hiện trên bảng topology để giúp mạng hội
Update tụ. Giải thuật này dựa trên việc Router phát hiện những thay đổi
Algorithm trong 1 khoảng thời gian nhất định. Vì giải thuật được tính toán
(DUAL) đồng thời nên đảm bảo không bị lặp định tuyến.
Advertise Chi phí đường đi đến mạng ở xa từ Router láng giềng.
Distance (AD)
Feasible Đường đi tốt nhất đến mạng.
distance(FD)
Feasible Trạng thái này xuất hiện khi một láng giềng báo cáo một giá trị
condition (FC) AD<FD
Feasible Khi Router láng giềng báo về giá trị AD thấp hơn giá trị FD của
successor (FS) Router. FS là Router kế tiếp trong trạng thái FC.
Successor Router kế tiếp truyền giá trị FC. Successor được lựa chọn từ các giá
rị FS vì nó có giá trị thấp nhất đến mạng ở xa.
Stuck in Active Trạng thái đạt được khi Router gửi ra các gói tin và chờ ACK.
(SIA) Router vẫn ở trạng thái active cho đến khi nào tất cả các ACK được
nhận về. Nếu các ACK không trở về sau một khoảng thời gian nào
đó, Router sẽ duy trì trạng thái SIA cho Router đó.
Query scoping Thiết kế mạng để giới hạn phạm vi truy cập của các gói query. Phạm
vi này sẽ chỉ ra gói tin query có thể đi đến đâu. Điều này là cần thiết
để ngăn ngừa SIA.
Active Trạng thái của route khi có một thay đổi về mạng nhưng sau khi
triểm tra bảng topo, không có FS nào được tìm thấy.Route sẽ được
gán giá trị active và Router sẽ truy vấn các Router láng giềng cho
những route dự phòng.
Passive Một đường đi đang trong trạng thái passive, nếu đường đi bị mất,
Router sẽ kiểm tra bảng topology để tìm ra FS. Nếu có một FS, route
sẽ được đặt trong bảng định tuyến. Nếu không, Router sẽ truy vấn
các Router láng giềng và đưa route vào trạng thái active.
Active route Là Router mất quyền successor và không có feasible successor thay
thế, khi đó Router phải tìm các route khác để đi đến đích.
Passive route Là Router có một successor đúng đi đến đích

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 21
Cơ bản về định tuyến và các giao thức định tuyến

Bảng IV.1 – Các thuật ngữ của EIGRP


4. Metric
EIGRP và IGRP có cùng cách tính Metric, tuy nhiên:
EIGRP metric = (IGRP metric)*256
do IGRP có trường Metric là 24 bit trong khi EIGRP có trường Metric là 32 bit.
Công thức:
EIGRP metric = [K1 * bandwidth + (K2 * bandwidth) / (256 - load) + K3 *
delay] * [K5 / (reliability + K4)]
Trong đó:
 K1, K2, K3, K4, K5 là những hằng số.
 BW = 107/ Băng thông nhỏ nhất trên tuyến đường (kbps).
 Delay = Tổng các giá trị độ trễ trên bảng định tuyến /10 (ms).
 Load: tải trên cổng giao tiếp, mang giá trị 1-255 (255: 100% lưu lượng dữ
liệu; 1: không có dữ liệu).
 Reliability: độ tin cậy của cổng giao tiếp, mang giá trị 1-255 (1: kết nối không
tin cậy; 255: 100% kết nối tin cậy)
Mặc định: K1=K3=1; K2=K4=K5=0. Khi đó:
EIGRP Metric = (BW + Delay)*256
Môi trường Băng thông Delay
Ethernet 10.000 Kbps 1000 microseconds
Fast Ethernet 100.000 Kbps 100 microseconds
Gigabit Ethernet 1.000.000 Kbps 10 microseconds
FDDI 100.000 Kbps 100 microseconds
Token Ring(16M) 16.000 Kbps 630 microseconds
T1 1544 Kbps 20.000 microseconds
Bảng IV.2 – Độ trễ và băng thông trên các môi trường truyền


5. Thiết lập quan hệ láng giềng trong EIGRP
EIGRP cần phải thiết lập quan hệ láng giềng trước khi gửi cập nhật thông tin
định tuyến bằng cách trao đổi gói tin hello qua địa chỉ multicast 224.0.0.10 sau

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 22
Cơ bản về định tuyến và các giao thức định tuyến

khoảng thời gian 5 giây (hay 60 giây đối với kết nối băng thông thấp hơn T1). Thời
gian hold time là thời gian tối đa mà Router phải chờ trước khi khởi động lại quan
hệ láng giềng nếu không nhận được gói tin hello, thời gian này gấp 3 lần thời gian
hello time (15 giây hay 180 giây đối với kết nối có băng thông thấp hơn T1) để
xem quan hệ láng giềng với cú pháp: Router#show ip eigrp neighbor

Kí hiệu Giải thích


H Danh sách các quan hệ láng giềng mà Router đã thiết lập được
Address Địa chỉ IP của Router EIGRP láng giềng
Interface Cổng nhận thông tin của Router EIGRP láng giềng
Hold Thời gian holddown-timer, nếu mang giá trị 0 sẽ xóa bỏ quan
hệ láng giềng.
Update Thời gian kể từ khi láng giềng được thêm vào bảng

SRTT Thời gian trung bình để đảm bảo gửi và nhận gói tin EIGRP.
(Smooth
Round Trip
Time)
RTO Thời gian Router phải chờ để truyền lại gói tin nếu Router
(Round Trip không nhận được gói tin.
Timeout)
Q Count Số lượng gói tin EIGRP chờ để gửi đến Router EIGRP láng
(Queue giềng. Nếu giá trị Qcount > 0, mạng có hiệu nghẽn.
Count)
Sequence Số tuần tự của gói tin EIGRP update/request/reply cuối cùng
Number nhận được từ Router EIGRP láng giềng. RTP sẽ theo dõi chỉ số
này để đảm bảo rằng các gói tin từ láng giềng nhận đúng thứ
tự.
Bảng IV.3 – Thuật ngữ trong bảng láng giềng

6. Tạo bảng Topology
Sau khi các Router đã thiết lập mối quan hệ với các Router láng giềng nó có
thể tạo ra một cơ sở dữ liệu của các feasible successor. Các Router láng giềng và

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 23
Cơ bản về định tuyến và các giao thức định tuyến

các đường đi tốt nhất được giữ trong bảng topology này. Điều cần chú ý là bảng
topology chứa đường đi của tất các route trong một hệ thống mạng chứ không chỉ
là các Router có đường đi tốt nhất và route dự phòng. Các tuyến đường khác được
gọi là các khả năng. Bảng topology trong EIGRP sẽ quản lí việc chọn lựa route để
thêm vào bảng định tuyến của Router. Bảng topology bao gồm các thông tin sau:
Một route nào đó là ở trạng thái active hay passive
Cập nhật có gửi đến Router láng giềng hay không
Một gói tin truy vấn đã gửi về Router láng giềng. Nếu có thông tin trong cột
này của bảng, đã có một route đang được đánh dấu như active
Nếu một gói tin đã được gửi đi, một cột khác trong bảng sẽ theo dõi là có
bất cứ một trả lời nào từ Router láng giềng
Các mạng ở xa
Địa chỉ mạng và giá trị subnet của các mạng
Giá trị Metric của các mạng ở xa, gọi là FD
Giá trị Metric của các mạng ở xa được quảng bá bởi Router được kết nối
trực tiếp, giá trị này còn gọi là AD
Giá trị next-hop
Cổng đi ra của các Router được dùng để đến Router next-hop.
Tuyến đường tốt nhất được chỉ ra ở dạng hop-count
Bảng topology được xây dựng từ các gói tin cập nhật giữa các Router láng
giềng và được trả lời bởi các truy vấn từ Router. Các gói tin trả lời được gửi bởi
các truy vấn từ Router. Các gói tin trả lời được gửi ra nhằm đáp ứng với các gói
tin truy vấn. Giải thuật DUAL sẽ dùng thông tin từ các gói tin truy vấn và gửi trả
lời.
Có hai loại gói tin cập nhật này được gửi đi một cách tin cậy (có ACK) dùng
module RTP trong giao thức EIGRP của Cisco. Nếu một Router không nghe một
ACK trong một khoảng thời gian cho trước, nó sẽ truyền lại gói tin như một dạng
unicast. Nếu không nhận được gói tin trả lời sau 16 lần cố gắng, Router sẽ đánh
dấu Router láng giềng là đã chết. Mỗi lần một Router gửi ra một gói tin, RTP sẽ
tăng chỉ số thứ tự lên 1. Router phải nghe trả lời từ tất cả các Router trước khi nó
gửi các gói tin kế tiếp. Thời gian xây dựng bảng topology càng ngắn nếu như
Router không phải truyền các gói tin unicast.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 24
Cơ bản về định tuyến và các giao thức định tuyến

7. Duy trì bảng topology

Hình IV.1: Duy trì bảng topology

Có 3 nguyên nhân làm cho bảng topology phải được tính toán lại:

Router nhận được một thay đổi khi có một mạng mới. Mạng mới này có thể
là mạng ở xa hoặc một cổng kết nối trực tiếp của Router được up lên.
Router thay đổi giá trị successor trong bảng topology và bảng định tuyến
trong các tình huống như bảng topology nhận được một trả lời hoặc một
truy vấn từ các Router láng giềng. Hoặc trong một tình huống khác là có
một cấu hình đã làm thay đổi cost của kết nối.
Router nhận được một thay đổi từ Router láng giềng khi một mạng không
còn tồn tại. Các thay đổi này có thể là bảng topology nhận được từ một truy
vấn, một gói tin trả lời hoặc một cập nhật chỉ ra rằng mạng ở xa đang bị
down. Một tình huống khác là Router láng giềng không nhận được gói hello
trong khoảng thời gian hold-time. Hoặc một mạng là một kết nối trực tiếp
nhưng bị down.
8. Tìm một đường đi dự phòng về một mạng ở xa
Khi một đường đi về một mạng nào đó bị mất, EIGRP sẽ tìm các tuyến
đường dự phòng. Quá trình này là một trong những ưu điểm chính của EIGRP.
Phương thức mà EIGRP dùng để tìm đường đi dự phòng thì rất nhanh và rất
đáng tin cậy.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 25
Cơ bản về định tuyến và các giao thức định tuyến


Hình IV.2: Tìm các tuyến đường đi dự phòng
Các sự kiện sau đây khi Router G bị down:
 Router D gửi luồng dữ liệu về Router G.
 Khi đó Router D sẽ tìm trong bảng topology. Bảng này có tất cả các mạng và
đường đi về mạng này để xác định xem có tuyến đường dự phòng nào
không. Nghĩa là Router D đang tìm kiếm một FS.
 Một FS sẽ được xác định. Bảng topo sẽ có một AD và một FD cho tất cả các
route hoặc các successor. Thông tin này bao gồm giá trị Metric qua đó route
sẽ được lựa chọn.
 Router D sẽ thêm các đường đi dự phòng về Router X thông qua Router H.
Các đường đi dự phòng này sẽ được tìm thấy trong bảng topology mà không
bị chuyển sang chế độ active bởi vì giá trị AD vẫn nhỏ hơn giá trị FD. Giá trị
AD là 5, giá trị FD là 15.
Router cần phải gửi các cập nhật đến các Router láng giềng của nó bởi vì
giá trị của AD đã thay đổi.
Nếu Router không có một giá trị FS, nó sẽ đặt route đó vào trạng thái active
khi nó đang truy vấn các Router về các đường đi dự phòng.
Sau khi tìm kiếm trong bảng topology, nó có một đường đi FS là tìm thấy,
Router sẽ trả lời lại bằng đường đi dự phòng. Đường đi dự phòng sẽ được
thêm vào bảng topology.
Bảng định tuyến sẽ được cập nhật.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 26
Cơ bản về định tuyến và các giao thức định tuyến

Route đó sẽ đặt vào trạng thái passive khi Router chuyển sang trạng thái
forwarding bình thường cho đến khi có một thay đổi kế tiếp trong mạng.
Nếu một Router láng giềng đã được truy vấn và không có đường đi dự
phòng hoặc FS, nó sẽ đặt route đó vào trạng thái active và truy vấn những
Router láng giềng của nó.
Nếu không có bất cứ một trả lời nào tìm thấy, các gói tin sẽ tiếp tục truyền
cho đến khi nào nó đến ranh giới của mạng hoặc của AS.
Khi Router gửi một gói tin truy vấn, nó sẽ lưu trong bảng topology. Cơ chế
này đảm bảo các gói tin trả lời nhận được trong khoảng thời gian cho phép. Nếu
một Router không nhận được một gói trả lời, Router láng giềng sẽ bị xóa khỏi bảng
láng giềng. Tất cả các mạng hiện được chứa trong bảng topology cho láng giềng
đó sẽ được gửi truy vấn. Thỉnh thoảng, vì các kết nối là chậm do băng thông thấp,
nên các vấn đề mới có thể xảy ra. Đặc biệt là khi một Router không nhận được các
trả lời từ tất cả các truy vấn đang được gửi ra. Trạng thái này được gọi là SIA. Các
Router láng giềng không có trả lời sẽ bị xóa ra khỏi bảng neighbor và giải thuật
DUAL sẽ giả sử rằng có một gói reply nhận được với giá trị là vô hạn.
9. The Diffusing Update Algorithm
EIGRP sử dụng giải thuật DUAL để quảng cáo các route đến các láng giềng
và chọn đường đi tới đích.


Hình IV.3: Giải thuật DUAL
Một số khái niệm dùng trong giải thuật này:
Khái niệm Định nghĩa

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 27
Cơ bản về định tuyến và các giao thức định tuyến

Feasible distance Là Metric nhỏ nhất để đi đến đích theo một tuyến
(FD) xác định.

Feasibility condition Là điều kiện yêu cầu để RD < FD nhằm đảm bảo
(FC) hình thành các đường đi không bị loop khi xây
dựng bảng topology.

EIGRP successor Là Router EIGRP láng giềng thỏa mãn điều kiện FC
và có Metric nhỏ nhất đi đến đích. Successor được
dùng như là next-hop để chuyển tiếp gói tin đi đến
mạng đích.

Feasible successor Là Router EIGRP láng giềng thỏa mãn điều kiện FC
nhưng không được chọn là Successor nên thường
dùng như các tuyến dự phòng.

Bảng IV.4 – Mô tả khái niệm trong DUAL

Hình IV.4: Tính toán giải thuật DUAL

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 28
Cơ bản về định tuyến và các giao thức định tuyến

Hình VI.5: Tính toán bảng định tuyến


RouterB được chọn là successor vì RouterB có FD nhỏ nhất (metric = 121)
để Network 7 khi xuất phát từ A. Để chọn feasible successor, RouterA kiểm tra RD
của các Router EIGRP láng giềng H và D (RD của H và D lần lượt là 30 và 140) có
nhỏ hơn FD của successor hay không (FD = 121). Router H được chọn feasible
successor vì có RD = 30 nhỏ hơn FD = 121 của successor. Router D không là
successor hay feasible successor vì có RD = 140 > 121 và do đó không thỏa mãn
điều kiện FC.
10. EIGRP Reliable Transport Protocol: có 5 loại gói tin EIGRP chia làm 2 loại:
tin cậy (Update, Query, Reply) và không tin cậy (Hello, Acknowledgement).
Hello: gói tin Hello dùng để thiết lập quan hệ láng giềng trên đường truyền.
Acknowledgment: gói tin Acknowledgment được dùng báo hiệu nhằm đảm
bảo phân phối tin cậy các gói tin EIGRP.Tất cả các gói tin EIGRP được gửi
đến Địa chỉ multicast nhóm EIGRP là 224.0.0.10. Vì có nhiều thiết bị nhận
nên cần một giao thức để đảm bảo phân phối tin cậy các gói tin EIGRP là
giao thức RTP (Reliable Transport Protocol). Khi gói tin reliable EIGRP
được gửi đến router EIGRP láng giềng, Router gửi mong muốn được hồi
đáp để đảm bảo gói tin này đã được nhận.
Update: gói tin Update chứa các cập nhật định tuyến EIGRP và gửi đến
EIGRP Router láng giềng.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 29
Cơ bản về định tuyến và các giao thức định tuyến

Query: các gói tin Query được gửi đến Router EIGRP láng giềng khi route
không sẵn sàng và Router cần biết trạng thái của route để đạt hội tụ nhanh.
Reply: các gói tin Reply chứa trạng thái các route được gửi đáp lại các
Query.
11. EIGRP hỗ trợ mạng không liên tục và VLSM


Hình IV.6: EIGRP hỗ trợ mạng không liên tục và VLSM

RouterB kết nối với mạng 192.168.8.128/25 muốn quảng cáo đến RouterA
qua mạng 10.1.1.0/24. Mặc định, EIGRP là giao thức định tuyến dạng Classful;
RouterB sẽ tiến hành tóm tắt (autosummarize) mạng này về Địa chỉ lớp mạng mặc
định. Do đó, RouterB sẽ quảng cáo mạng 192.168.8.0 /24 đến RouterA. Do đó, để
đảm bảo EIGRP hỗ trợ mạng không liên tục, người quản trị mạng cần phải cấu
hình:
RouterB (config-router)# no auto-summary
Khi đó RouterB sẽ quảng cáo mạng 192.168.8.128/25 đến RouterA và giải
quyết được ván đề mạng không liên tục.
12. Tóm tắt Route trong EIGRP (summarization)
Có 2 loại Route trong EIGRP là tóm tắt tự động và bằng phương pháp thủ công.
Tóm tắt tự động: được dùng mặc định EIGRP, khi đó EIGRP mang đặc tính
tương tự như RIP và IGRP. Nghĩa là khi gửi cập nhật định tuyến thì Router
sẽ tự động tóm tắt route về Địa chỉ mạng chính ở lớp A, B hay C.


Hình IV.7: Quá trình summarization của EIGRP
Ở hình trên, Router R1 gửi cập nhật về mạng 132.168.1.0 đến R2 thông qua
lớp mạng trung gian là 192.168.2.0. R1 sẽ tự động tóm tắt route này về ranh

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 30
Cơ bản về định tuyến và các giao thức định tuyến

giới mạng lớp B là 132.168.0.0 và gửi đến R2. Sự cố sẽ xuất hiện trong trường
hợp mạng không liên tục.
Tóm tắt bằng phương pháp thủ công: là ta cấu hình tóm tắt trên các cổng
giao tiếp của Router bằng lệnh:
Router(config-if)# ip summary-address eigrp {AS number} {network
address} {subnet mask}
Có thể thực hiện tóm tắt route trên tất cả các loại cổng giao tiếp trên Router
(còn OSPF thì chỉ tóm tắt các loại Router biên ARB và ASBR), khi đó Router ngay
lập tức sẽ tạo ra route về null 0 với giá trị AD bằng 5 nhằm ngăn chặn vòng lặp xảy
ra.

R1(config)# interface S0
R1(config-if)# ip address 192.168.11.1 255.255.255.252
R1(config-if)# no shutdown
R1(config-if)# ip summary-address eigrp 1 192.168.8.0 255.255.252.0
Hình VI.8: Cấu hình tóm tắt route

Ở ví dụ trên, R1 tóm tắt Địa chỉ 192.168.8.0/24, 192.168.9.0/24,


192.168.10.0/24 thành 192.168.8.0/22. Việc thực hiện tác vụ này trong EIGRP
nhằm giảm kích thước bảng định tuyến và số lần cập nhật giúp dễ dàng nâng cấp
khi mở rộng mạng EIGRP.
Điểm khác biệt về summarization giữa EIGRP và OSPF là ở chỗ:
OSPF chỉ thực hiện tóm tắt ở các vùng biên.
EIGRP có thể hực hiện tóm tắt trên bất cứ Router nào trong mạng. Quyết
định vị trí nào sẽ được tóm tắt route là tùy thuộc vào cách thiết kế. Mặc
định sẽ tự động tóm tắt ở ranh giới các địa chỉ lớp mạng khác nhau. Các
lệnh dùng ở chế độ Router hay cấu hình trên cổng giao tiếp.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 31
Cơ bản về định tuyến và các giao thức định tuyến

13. Tiến tình truy vấn của EIGRP


EIGRP sẽ tiến hành tìm các đường bị mất kết nối để đạt được thời gian hội
tụ cao nhất. Tiến trình này gọi là tiến trình truy vấn (Query process). Khi đó,
các gói tin truy vấn sẽ được gửi đi khi bị mất kết nối. Lúc này Router được xem
là đang ở trạng thái active. Các gói tin truy vấn được gửi đến tất cả các Router
EIGRP láng giềng ngoại trừ Router làm successor. Nếu các Router láng giềng
không có thông tin về tuyến bị mất thì các gói tin truy vấn tiếp tục được gửi
đến các Router láng giềng khác cho đến khi hết AS. Khi gói tin truy vấn được
gửi đi, Router phải chờ hồi đáp từ Router láng giềng trước khi Router thực
hiện tính toán để chọn successor. Nếu trong khoảng thời gian 3 phút mà Router
láng giềng không hồi đáp lại, Router được gọi là stuck in active (SIA), và Router
sẽ tiến hành thiết lập lại quan hệ láng giềng.
14. Tuyến đường mặc định trong EIGRP
EIGRP cũng sử dụng lệnh ip default-network để quảng bá tuyến mặc định
giống như IGRP. Lệnh này chỉ định Địa chỉ của major network và đánh dấu
tuyến đường là mặc định.
15. Cân bằng tải trong EIGRP
EIGRP tự động cân bằng tải qua những đường có cùng giá trị cost. Ta có thể
cấu hình cân bằng tải qua những đường có cost không bằng nhau bằng cách sử
dụng lệnh variance như trong IGRP:

Cú pháp: Router (config-router)# variance var

Trong đó var là tỉ số từ 1-128, mặc định là 1 (equal-cost). Nếu var >1, thì ta
sẽ lấy var nhân với Metric của đường có cost nhỏ nhất tạo thành số a. Nếu
những đường nào đó có Metric nhỏ hơn số a thì những đường đó được cân
bằng tải. Luồng dữ liệu được gửi ra mỗi liên kết sẽ tỉ lệ với Metric cho đường
đi đó.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 32
Cơ bản về định tuyến và các giao thức định tuyến

Hình VI.9: Cân bằng tải trên EIRGP


Một đường đến mạng A có 4 đường từ F và đường có Metric tốt nhất là 10.
Giả sử ta cấu hình variance là 2 thì số a sẽ là 2*10=20, vậy những đường nào từ F
đến mạng A có Metric<20 sẽ được cân bằng tải: F→D→B→A(15), F→C→B→A(15),
F→C→G→A(10), và được cân bằng theo tỉ lệ 1:1:2.
Lợi ích của cân bằng tải là tăng khả năng linh động, sử dụng hiệu quả đường
truyền.
16. Thiết kế mạng EIGRP
EIGRP được thiết kế để hoạt động trong một mạng rất lớn. Tuy nhiên EIGRP
vẫn giống OSPF, nó đòi hỏi nhiều yếu tố thiết kế. Các yêu cầu mới thường xuyên
yêu cầu nhiều băng thông và các tài nguyên khác từ mạng.
Các yếu tố ảnh hưởng đến khả năng mở rộng của EIGRP là:
Tổng số thông tin được gửi giữa các Router láng giềng
Tổng số Router gửi các routing update
Các RouterCách xa nhau bao nhiêu
Tổng số các đường đi thay thế đến một mạng đích
Một mạng EIGRP thiết kế kém có thể dẫn đến kết quả sau:
Router bị SIA
Mạng bị nghẽn do delay, các thông tin định tuyến bị mất, các tuyến bị mất
hay phải truyền lại
Router bị hết bộ nhớ
CPU bị quá tải
Các kết nối trở nên kém tin cậy

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 33
Cơ bản về định tuyến và các giao thức định tuyến

Các giải pháp cho vấn đề mở rộng EIGRP:


Địa chỉ mạng được cấp phát liên tục để có thể thực hiện được quá trình tóm
tắt.
Mạng nên được thiết kế theo từng lớp để cho phép quá trình
summarization.
Các thiết bị phải đủ tài nguyên.
Phải đủ băng thông trên các kết nối WAN.
Cấu hình EIGRP phù hợp trên các kết nối WAN. Mặc định EIGRP dùng 50%
bẳng thông của đường truyền cho các lưu lượng dữ liệu. Giá trị mặc định
này có thể thay đổi được.
Nên dùng các cơ chế lọc tuyến.
17. Lab 3 – Cấu hình EIGRP cơ bản


Hình IV.10 – Lab 3 Cấu hình EIRGP cơ bản

Yêu cầu: Sử dụng Cisco Packet Tracer để xây dựng mạng như sơ đồ đã cho,
có thể lấy 1 Router để giả lập Corporate Network

i. Đặt tên, gán địa chỉ IP cho router và cổng tương ứng như trong sơ đồ
ii. Chú ý: cổng Houston S0/1 là DCE nên cần có clock rate trên cổng này
iii. Sử dụng giao thức định tuyến động EIGRP trên AS 69
iv. Tuyến ngầm định (định tuyến tĩnh) được dùng để chuyển tiếp lưu lượng
giữa AS 69 và Corporate Network và có địa chỉ mạng 6.9.6.0/24
v. Các router đều ping được tất cả địa chỉ trong mạng và ngược lại

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 34
Cơ bản về định tuyến và các giao thức định tuyến

Các bước thực hiện


Bước 1: Thực hiện yêu cầu (i), (ii), (iii) và (iv)

Austin

Router> enable Austin(config)# router eigrp 69


Router# configure terminal Austin(confi -router)# network 172.16.0.0
Router(config)# hostname Austin Austin(config-router)# no auto-summary
Austin(config)# interface f0/1 Austin(config-router)# end
Austin(config-if)# no shutdown Austin# write memory
Austin(config-if)# ip address 172.16.10.1
255.255.255.0
Austin(config-if)# exit
Austin(config)# interface s0/1
Austin(config-if)# no shutdown
Austin(config-if)# ip address 172.16.20.1
255.255.255.0
Austin(config-if)# exit

Giả sử rằng Houston S0/0 và Corporate Network S0/1 lần lượt lấy các địa
chỉ là 6.9.6.9/24 và 6.9.6.10/24 (suy ra từ địa chỉ mạng 6.9.6.0/24), khi đó kết
hợp với các địa chỉ cho trước trong sơ đồ mạng ta có thể cấu hình như sau
Houston

Router> enable Houston(config)# interface s0/0


Router# configure terminal Houston(config-if)# no shutdown
Router(config)# hostname Houston Houston(config-if)# ip address 6.9.6.9
Houston(config)# interface f0/1 255.255.255.0
Houston(config-if)# no shutdown Houston(config-if)# exit
Houston(config-if)# ip address 172.16.30.1 Houston(config)# ip route 0.0.0.0 0.0.0.0
255.255.255.0 6.9.6.10
Houston(config-if)# exit Houston(config)# router eigrp 69
Houston(config)# interface s0/1 Houston(config-router)# network 172.16.0.0
Houston(config-if)# no shutdown Houston(config-router)# no auto-summary
Houston(config-if)# clock rate 64000 Houston(config-router)# redistribute static
Houston(config-if)# ip address 172.16.20.2 Houston(config-router)# end
255.255.255.0 Houston# write memory
Houston(config-if)# exit

Corporate Network

Router> enable Corp(config)# ip route 0.0.0.0 0.0.0.0 6.9.6.9


Router# configure terminal Austin(config)# end
Router(config)# hostname Corp Austin# write memory
Corp(config)# interface s0/1
Corp(config-if)# no shutdown
Corp(config-if)# ip address 6.9.6.10 255.255.255.0
Corp(config-if)# exit
Kiểm tra lại cấu hình dùng lệnh show running-config và show ip interface brief
để đảm bảo cấu hình đúng, giải quyết sự cố nếu cần.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 35
Cơ bản về định tuyến và các giao thức định tuyến

Bước 2: Kiểm tra bảng định tuyến bằng câu lệnh show ip route, đảm bảo tất
cả các mạng con đều được hiển thị trong bảng định tuyến (4 mạng con).
Ví dụ:


Bước 3: Thực hiện bước (v)
Ví dụ:

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 36
Cơ bản về định tuyến và các giao thức định tuyến


Lệnh Giải thích

Show ip eigrp neighbors Xem thông tin chi tiết về các neighbor.

Show ip protocol Lệnh này hiển thị các thông số và trạng thái hoạt động
hiện tại của các giao thức định tuyến. Thông tin hiển
thị: giao thức định tuyến sử dụng, thời gian, các giao
thức được redistribute, và mạng mà giao thức quảng
bá…

Show ip eigrp interfaces Hiển thị tất cả các thông tin giao tiếp của RouterChạy
EIGRP. Câu lệnh này dùng để xem nhanh EIGRP đã
được cấu hình trên interface nào, thuộc AS nào.

Show ip eigrp topology Xem thông tin chi tiết về những đường được giữ trong
bảng topology của Router, các network và những
đường đến mạng đó, next hop…

Show ip eirgp topology all Xem thông tin chi tiết về những đường và những đường
dự phòng trong bảng topo.

Show ip eigrp traffic Xem thông tin về các lưu lượng dữ liệu được gửi và
nhận từ quá trình EIGRP.

Debug eigrp packet Xem thông tin về những packet eigrp được gửi và
nhận. Lệnh này cần thiết trong phân tích các bản tin
giữa các Router láng giềng.

Debug eigrp neighbors Xem các gói tin hello được gửi và nhận giữa Router và
những neighbor của nó

Debug eigrp route Xem những thay đổi về bảng định tuyến

Debug ip eigrp summary Xem thông tin tóm tắt về các quá trình của EIGRP,
gồm: neighbor, distance, filtering, và redistribution

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 37
Cơ bản về định tuyến và các giao thức định tuyến

Bảng IV.5 – Các lệnh hiển thị hoạt động của EIGRP
V. Giao thức định tuyến OSPF
1. Khái niệm
OSPF là giao thức định tuyến mở ứng dụng kỹ thuật link-state thường được
triển khai trên hệ thống mạng phức tạp. OSPF tự xây dựng cơ chế đảm bảo độ tin
cậy chứ không sử dụng các giao thức như TCP để đảm bảo độ tin cậy. OSPF là giao
thức định tuyến classless nên hỗ trợ VLSM và mạng không liên tục. OSPF sử dụng
địa chỉ multicast 224.0.0.5 và 224.0.0.6 (DR và DBR Router) để gửi thông điệp
Hello và Update. OSPF còn hỗ trợ khả năng chứng thực không mã hóa/mã hóa
(MD5). Nó cũng có thể dò tìm nhanh chóng sự thay đổi của topology (cũng như lỗi
của các cổng) và tính toán lại những tuyến đường mới sau chu kì hội tụ. Cũng
giống như các giao thức nhóm link-state, mỗi Router OSPF duy trì cơ sở dữ liệu
mô tả toàn bộ các thông tin trong khu vực (Area) của mình. Cơ sở dữ liệu này được
gọi là cơ sở dữ liệu trạng thái kết nối (link-state) và phải là một cơ sở dữ liệu thống
nhất.
2. Lịch sử phát triển của OSPF
Bắt đầu nghiên cứu và phát triển từ 1987 nhằm thay thế RIP. OSPF được
mô tả trong RFC của IETF.

Năm ra đời Phiên bản Ghi chú


1989 1 (RFC 1131) Thử nghiệm và không được ứng dụng rộng rãi
1991 2 (RFC 1247) Được ứng dụng rộng rãi
1999 3 (RFC 2740) Hỗ trợ IPv6
Bảng V.1 – Tóm tắt lịch sử OSPF

3. Thuật toán SPF


OSPF sử dụng thuật toán Dijkstra để xây dựng bảng định tuyến. Đây là giải
thuật xây dựng các đường đi ngắn nhất để đi đến đích. Thông điệp quảng cáo LSA
mang thông tin của Router và trạng thái của các Router lân cận. Dựa trên các thông
tin học được khi trao đổi các thông điệp LSA, OSPF sẽ xây dựng cấu trúc liên kết
hình học trên toàn mạng (topology). Mỗi Router chạy một thuật toán giống nhau
thực sự và chạy song song. Từ cơ sở dữ liệu đã nêu ở trên, mỗi Router sẽ tự xây
dựng một đường đi ngắn nhất tới các điểm còn lại và bản thân nó là một nút gốc

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 38
Cơ bản về định tuyến và các giao thức định tuyến

(root) của cây này. Trong trường hợp các tuyến chi phí như nhau đến một mạng
đích thì lưu lượng sẽ phân phối đều giữa các tuyến đường này (cân bằng tải – load
balancing.


Hình V.1 – Tóm tắt hoạt động của OSPF
Khi Router nhận được các gói LSA, nó sẽ tự xây dựng cơ sở dữ liệu về trạng
thái kết nối và dùng thật toán Dijktra’s Shortest Path First (SPF) để tạo ra
cây SPF. Khi nhận thông tin thay đổi thì các router sẽ tính lại SPF.
4. Ưu điểm của OSPF
 Tốc độ hội tụ nhanh
 Hỗ trợ VLSM
 Áp dụng cho các mạng lớn
 Hiệu quả hơn trong việc chống Routing loop
 Đường đi linh hoạt hơn.
 Hỗ trợ xác thực (Authenticate)
5. So sánh OSPF với giao thức định tuyến theo Distance Vector

OSPF Distance Vector

Router định tuyến theo trạng thái liên kết có một cơ sở đầy Router chỉ biết next-hop để
đủ về cấu trúc hệ thống mạng. Chúng chỉ thực hiện trao đổi gửi gói tin đến đích.
thông tin về trạng thái liên kết lúc khởi động và khi hệ
thống mạng có sự thay đổi.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 39
Cơ bản về định tuyến và các giao thức định tuyến

Không quảng bá bảng định tuyến theo định kì Quảng bá bảng định tuyến
theo định kì.

Sử dụng ít băng thông hơn cho hoạt động duy trì bảng định Tốn nhiều băng thông.
tuyến
OSPF phù hợp với các mạng lớn, có khả năng mở rộng, RIP phù hợp với các mạng
đường đi tốt nhất của OSPF là dựa trên tốc độ của đường nhỏ và đường tốt nhất đối với
truyền, đường truyền có tốc độ càng cao thì chí phí OSPF RIP là con đường có số hop ít
càng thấp. nhất. RIP không hề quan tâm
đến băng thông đường
truyền khi quyết định chọn
đường đi.

OSPF chọn đường tốt nhất từ cây SPF. RIPcũng như các giao thức
định tuyến theo Distance
vector đều sử dụng thuật
toán chọn đường đi đơn giản.

Tốn nhiều bộ nhớ và năng lực xử lí của Router. Ít tốn bộ nhớ và năng lực xử
lí của Router.

Đảm bảo không bị định tuyến lặp Vẫn có thể bị định tuyến lặp

OSPF sau khi đã hội tụ vào lúc khởi động, khi có thay đổi RIP phải mất ít nhất vài phút
thì việc hội tụ sẽ rất nhanh vì chỉ có thông tin về sự thay đổi mới có thể hội tụ được vì mỗi
này được phát ra cho mọi Router trong vùng. Router chỉ trao đổi bảng định
tuyến với các Router láng
giềng kết nối trực tiếp với
mình mà thôi.

OSPF hỗ trợ VLSM nên nó được xem là một giao thức định RIPv1 không hỗ trợ VLSM
tuyến không phân lớp. nhưng RIPv2 thì có

Không giới hạn về kích thước mạng Giới hạn về kích thước mạng.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 40
Cơ bản về định tuyến và các giao thức định tuyến

OSPF sử dụng khái niệm về phân vùng. Một mạng OSPF có RIP sử dụng cấu trúc mạng
thể chia các Router thành nhiều nhóm. Bằng cách này OSPF ngang hàng. Thông tin định
có thể giới hạn lưu thông trong từng vùng nên thay đổi tuyến được truyền lần lượt
trong vùng này không ảnh hưởng đến hoạt động của các cho mọi Router trong cùng
vùng khác. Cấu trúc phân lớp như vậy cho phép hệ thống một hệ thống RIP.
mạng có khả năng mở rộng một cách hiêu quả.
Bảng V.2 – OSPF vs. Distance – Vector
6. Các loại gói tin trong OSPF



Tên Chức năng

Hello Gói tin Hello dùng để phát hiện trao đổi thông tin của
các Router cận kề.

Database Description Gói tin dùng để chọn lựa Router nào sẽ được quyền
trao đổi thông tin trước (master/slave).

Link State Request Gói tin này dùng để chỉ định loại LSA dùng trong tiến
trình trao đổi các gói tin DBD.

Link State Update Gói tin này dùng để gửi các gói tin LSA đến Router cận
kề yêu cầu gói tin này khi nhận thông điệp Request.

Link State Acknowledge Gói tin này dùng để báo hiệu đã nhận gói tin Update.

Bảng V.3 – Mô tả các gói tin OSPF

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 41
Cơ bản về định tuyến và các giao thức định tuyến


Bảng V.4 – Nội dung của 1 gói tin OSPF
7. Các loại thông điệp LSU hoặc LSAs (Link – State Advertisements)
Loại LSU/LSAs Chức năng

1 Router Mô tả trạng thái, chi phí của kết nối đến Router hàng
xóm và IP Prefix của các kết nối dạng điểm – điểm.

2 Network Mô tả số lượng Router và subnet mask trên phân đoạn


mạng.

3 Summary Mô tả đích đến ở ngoài vùng nhưng cùng miền OSPF.


Network Thông tin tóm tắt của một vùng sẽ được gửi đến vùng
khác.

4 Summary ASBR Mô tả thông tin của ASBR (router tại biên kết nối với hệ
tự trị). Không có sự tóm tắt LSA Type 4 này trong cùng
một vùng.

5 External Mô tả các tuyến đường đi đến các đích ở ngoài miền


OSPF (các hệ tự trị - Autonomous Systems)

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 42
Cơ bản về định tuyến và các giao thức định tuyến

6 Group Mô tả quan hệ thành viên nhóm multicast OSPF


Membership (MOSPF).

7 NSSA Mô tả các tuyến đường đến các đích trong Not – So –


Stubby Area

8 Unused Không sử dụng

8-11 Opaque Được sử dụng để tính toán các tuyến đường sử dụng
cho kĩ thuật quản lý lưu lượng của công nghệ MPLS

Bảng V.5 – Mô tả chức năng các gói tin OSPF


8. Metric của OSPF:
OSPF sử dụng Metric là chi phí (cost). Cost của toàn tuyến được tính theo
cách cộng dồn cost dọc theo tuyến đường đi của gói tin. Cách tính cost được IETF
được đưa ra trong RFC 2328.

10 10
= ặ =
( ) ( )

Tuy nhiên, ta có thể thay đổi giá trị của cost. Nếu Router có nhiều đường
đến đích bằng nhau thì Router sẽ cân bằng tải trên các tuyến đường đó (mặc định
là 4 đường, tối đa là 16 đường). Những tham số bắt buộc phải giống nhau đối với
các Router chạy OSPF trong một Area đó là khoảng thời gian gửi Hello/Dead, định
danh vùng (Area – ID), mật khẩu xác thực (authentication password) và stub area
flag nếu có.


Bảng V.6 – Chi phí đối với các băng thông tiêu biểu


Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 43
Cơ bản về định tuyến và các giao thức định tuyến

9. Các loại Router trong OSPF

Hình V.2 – Phân loại OSPF router


10. Chi tiết về vùng (Area) trong OSPF
OSPF hỗ trợ hai mức độ phân cấp qua khái niệm vùng (area). Mỗi vùng là một
số 32 bit biểu diễn ở dạng IP (vùng a.b.c.d) hay dạng thập phân (vùng x). Vùng 0
là vùng xương sống (backbone), do đó các vùng đều phải kết nối trực tiếp với vùng
0 hay thông qua kết nối ảo (virtual link). OSPF có một số loại vùng sau: normal
area, stub area, totally stubby area, not-so-stubby area (NSSA) và totally NSSA.
Vùng bình thường (Nomal Area)
Mặc định, vùng mang những đặc tính sau:
 Nhận các thông tin tóm tắt (summary LSA) từ các vùng khác.
 Nhận các thông tin từ bên ngoài (external LSA).
 Nhận các thông tin mặc định từ bên ngoài (external default LSA).

Hình V.3 – Phân loại vùng OSPF

Stub Area
Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 44
Cơ bản về định tuyến và các giao thức định tuyến

Hình V.4 – Hoạt động của stub area

Vùng Stub không nhận các thông tin từ bên ngoài (external LSA). Vùng Stub
nhận các thông tin tóm tắt (Summary LSA) từ các vùng khác và nhận các thông
tin mặc định.
Totally Stubby Area

Hình V.5 – Hoạt động của Totally Stubby Area



Totally Stubby Area là vùng bị hạn chế nhất. Router trong loại vùng này
chỉ tin tưởng vào các thông tin tóm tắt mặc định (default summary route) từ

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 45
Cơ bản về định tuyến và các giao thức định tuyến

ABR. Không tồn tại thông tin từ bên ngoài của OSPF (external route) hay thông
tin tóm tắt (summary) trong bảng định tuyến. Đây là một mở rộng của vùng
stub nên mang đầy đủ các các đặc tính của vùng Stub.
Những đặc tính của vùng Totally Stub:
 Không nhận các thông tin tóm tắt (summary LSA).
 Không nhận các thông tin từ bên ngoài (external LSA).
 Chỉ nhận các thông tin về tuyến mặc định.
 Không tạo ra các summary LSA.
Not – So – Stubby - Area:

Hình V.6 – Hoạt động của Totally NSSA

Totally Not-So-Stubby Area


Loại vùng này là một mở rộng của NSSA, nếu vùng 1 là totally NSSA thì sẽ
mang những đặc tính sau:
 Không chấp nhận external LSA.
 Không chấp nhận các thông tin tóm tắt summary LSA.
11. Các loại môi trường OSPF:
Có 3 kiểu mạng được định nghĩa trong OSPF là Đa truy cập quảng bá
(Broadcast Multi-Access/BMA), Đa truy cập không quảng bá (Non-Broadcast
Multi-Access/NBMA) và Điểm – Điểm (Point-to-Point)
BMA
BMA sử dụng kiến trúc mạng (cấu trúc liên kết hình học và cách thức truy cập
mạng) tương tự như ETHERNET.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 46
Cơ bản về định tuyến và các giao thức định tuyến

Quá tải là hậu quả xảy ra với BMA khi có nhiều router được kết nối thực hiện
quá trình thiết lập mối quan hệ và trao đổi thông tin trạng thái.
Giải pháp cho vấn đề trên là bầu ra một router làm đại diện cho BMA. Router
đó được gọi là Designated Router (DR). DR sẽ thiết lập mối quan hệ với mọi router
khác trong mạng quảng bá. Các router còn lại sẽ chỉ gửi thông tin về trạng thái liên
kết cho DR. Sau đó DR sẽ gửi thông tin này cho mọi router khác trong mạng sử
dụng địa chỉ multicast 224.0.0.5. Rõ ràng DR đóng vai trò như một người phát
ngôn chung. Việc bầu ra DR rất có hiệu quả nhưng cũng có một nhược điểm. DR
trở thành một tâm điểm nhạy cảm đối với sự cố. Do đó, cần một Router thứ hai
được bầu ra để làm đại diện dự phòng – Backup DR (BDR), Router này sẽ đảm
trách vai trò của DR nếu DR bị sự cố. Địa chỉ multicast 224.0.0.6 được sử dụng để
truyền thông giữa các DR và BDR.
 Lựa chọn DR và BDR: quá trình bầu chọn DR và BDR được tiến hành ngay sau
khi cổng của Router đầu tiên được kết nối vào mạng đa truy cập và được cấu
hình giao thức OSPF. Quá trình này có thể mất vài phút, sau khi tất các Router
được bật, Router có chỉ số ID lớn nhất có thể là DR.
Quá trình lựa chọn DR và BDR sẽ theo qui tắc sau:
 DR: Router có chỉ số Priority lớn nhất.
 BDR: Router có chỉ số Priority lớn thứ hai.
 Trong trường hợp các Router có chỉ số Priority bằng nhau thì Router nào
có chỉ số ID (Router ID) cao nhất làm DR.


Hình V.7 – Bầu chọn DR và BDR

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 47
Cơ bản về định tuyến và các giao thức định tuyến

Trong hình trên RouterC được chọn làm DR vì có độ ưu tiên cao nhất. RouterB
được chọn làm BDR vì có độ ưu tiên cao thứ hai và có Địa chỉ ID cao hơn RouterA.
 Router ID: dùng để chọn DR và BDR trong mạng. Router ID đơn giản là Địa chỉ
IP, nó là duy nhất với mỗi Router. Nó được chọn như sau:
 Người quản trị mạng cấu hình trực tiếp.
 Nếu không được cấu hình, sẽ chọn địa chỉ IP lớn nhất của cổng ảo (Loopback
interface)
 Nếu không có Loopback interface, Địa chỉ IP lớn nhất của cổng vật lí (đang
hoạt động) sẽ được chọn làm Router ID.
 Khi DR được chọn, nó sẽ vẫn là DR cho đến khi các điều kiện sau xảy ra:
 Router ID bị lỗi.
 OSPF trên DR bị lỗi.
 Cổng (interface) trên DR bị lỗi.
 Thay đổi DR và DBR:
 Trong trường hợp DR bị lỗi, BDR sẽ làm DR và sẽ có tiến trình lựa
chọn để chọn ra Router mới làm BDR.
 Khi Router có Địa chỉ IP lớn nhất tham gia vào mạng thì DR và BDR
vẫn không thay đổi (không chọn lại DR và BDR).


Hình V.8 – Trường hợp 1 – Không bầu lại DR/BDR
 Nếu DR cũ hết lỗi, tham gia vào mạng thì vẫn coi là Router Other
(Router thành viên).

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 48
Cơ bản về định tuyến và các giao thức định tuyến


Hình V.9 – Trường hợp 2 – Không bầu lại DR/BDR

 Khi BDR bị lỗi, một tiến trình sẽ lựa chọn các Router còn lại trừ DR
để làm BDR (với Router ID lớn nhất).


Hình V.10 – Bầu lại DBR





Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 49
Cơ bản về định tuyến và các giao thức định tuyến

 Chỉ khi cả DR và BDR bị lỗi, OSPF sẽ tiến hành tính toán lựa chọn lại
DR và BDR.


Hình V.11 – Bầu lại DR và BDR
Point-to-Point
Môi trường điểm đến điểm là môi trường truyền dẫn được đóng gói HDLC/PPP,
Frame Relay/ATM point-to-point subinterface. Không có sự bầu chọn DR/BDR
trong môi trường này. Các gói tin OSPF được gửi đi ở dạng multicast.


Hình V.12 – Minh họa về mạng Point – to - Point
NBMA

Kết nối các mạng chứa


hơn 2 router nhưng
không có khả năng
quảng bá. Hình V.13 – Minh họa về mạng NBMA
Tương tự như BMA, NBMA cũng bầu DR/BDR để giải quyết tình trạng quá tải
trong mạng. NBMA có 5 chế độ làm việc là quảng bá, không quảng bá, điểm – đa
điểm, điểm – điểm không quảng bá và điểm – điểm.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 50
Cơ bản về định tuyến và các giao thức định tuyến

Chế độ làm việc Cấu trúc liên kết Địa chỉ Thời gian Thiết lập Định nghĩa
OSPF trong NBMA mạng con gửi Hello mối quan hệ bởi RFC hoặc
(giây) hàng xóm Cisco
Quảng bá Lưới hoặc lưới Như nhau 10 Tự động, Cisco
từng phần bầu DR/BDR
Không quảng bá Lưới hoặc lưới Như nhau 30 Người quản trị RFC
từng phần cấu hình,
bầu DR/BDR
Điểm – Đa điểm Lưới từng phần Như nhau 30 Tự động, RFC
hoặc sao không bầu
DR/BDR
Điểm – đa điểm Lưới từng phần Như nhau 30 Người quản trị Cisco
không quảng bá hoặc sao cấu hình,
không bầu
DR/BDR
Điểm – điểm Lưới từng phần Khác nhau 10 Tự động, Cisco
hoặc sao, sử dụng trên từng không bầu
cổng logic cổng logic DR/BDR
(subinterface)
Bảng V.7 – Tóm tắt các chế độ làm việc của NBMA

12. Chi tiết về thiết lập quan hệ hàng xóm (Adjacency)


OSPF thiết lập quan hệ Adjacency giữa các Router láng giềng nhằm mục
đích trao đổi thông tin định tuyến. Trong môi trường quảng bá, không phải Router
nào cũng có khả năng thiết lập quan hệ Adjacency với tất cả các router khác. Gói
tin Hello chịu trách nhiệm thiết lập và duy trì mối liên hệ này.


Hình V.14 – Thiết lập và duy trì mối quan hệ bằng gói tin Hello

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 51
Cơ bản về định tuyến và các giao thức định tuyến

Quá trình trong hình V.14 được mô tả như sau:

Đầu tiên Router OSPF sẽ gửi gói tin Hello đến Địa chỉ multicast 224.0.0.5.
Gói tin này sẽ định kì gửi đến tất cả các cổng giao tiếp có hỗ trợ OSPF với
khoảng thời gian tùy thuộc vào từng loại cổng giao tiếp. Trong môi trường
broadcast như Ethernet hay dạng Point-to-Point, thời gian là 10 giây. Trong
môi trường non-broadcast như Frame Relay hay ATM, khoảng thời gian này
là 30 giây.
Gói tin Hello sẽ định kì gửi đi đến tất cả các cổng giao tiếp của Router có chạy
OSPF. Khi Router phát hiện thấy có Router láng giềng nhờ vào gói tin Hello
nhận được, truyền thông hai chiều được thiết lập. Trong môi trường
broadcast và NBMA, gói tin Hello còn được sử dụng để chọn ra các Router chỉ
định DR/BDR.
Sau khi đã thiết lập truyền thông hai chiều, sẽ thiết lập quan hệ liền kề
adjacency, việc ra quyết định thiết lập quan hệ adjacency dựa vào trạng thái
của Router láng giềng và công nghệ mạng dùng để kết nối hai Router. Nếu kiểu
network là broadcast hay non-broadcast, quan hệ adjacency sẽ được thiết lập
giữa các Router láng giềng. Để thiết lập quan hệ adjacency, đầu tiên Router sẽ
tiến hành đồng bộ hóa cơ sơ dữ liệu bằng cách gửi gói tin DBD mô tả cơ sở dữ
liệu cho nhau. Tiến trình này gọi là tiến trình trao đổi cơ sở dữ liệu. Khi đó hai
Router sẽ thiết lập quan hệ master/slave. Mỗi gói tin mô tả cơ sở dữ liệu được
gửi đi bởi master sẽ chứa số tuần tự đánh dấu gói tin. Router slave sẽ báo nhận
gói tin này bằng cách gửi gói tin chứa số thuần tự này để hồi đáp.
Router ở trạng thái sau khi thiết lập quan hệ liền kề adjacency: Down State,
Attemp State, Init State, 2-way State, Exstart State, Exchange State, Loading
State, Full State.

Các trạng thái được mô tả vắn tắt trong bảng V.8 dưới đây:

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 52
Cơ bản về định tuyến và các giao thức định tuyến

Trạng thái Giải thích

Down State Router không nhận được các thông tin về Router kế cận.

Attemp State Trạng thái này chỉ tồn tại trong mạng NBMA. Ở trạng thái này,
Router sẽ không nhận được thông tin từ các Router hàng xóm
nhưng vẫn nỗ lực tạo mối quan hệ với chúng bằng cách gửi các
gói tin Hello theo định kỳ đến chúng.

Init State Tiến trình gửi gói tin Hello một chiều.

2-way State Khi thiết lập quan hệ hai chiều, Router sẽ đặt ở trạng thái 2-way
State. Khi đó, sẽ bắt đầu thiết lập quan hệ liền kề, các Router chỉ
định DR/BDR sẽ được chọn.

Exstart State Trạng thái này là sự bắt đầu tiến trình đồng bộ hóa cơ sở dữ liệu.
Master và slave được chọn trong trạng thái này.

Exchange State Ở trạng thái này, Router mô tả trạng thái cơ sở dữ liệu trạng thái
liên kết thông qua gói tin DBD (Database Descriptor). Mỗi gói tin
DBD được đánh số thứ tự để phân biệt. Tại mỗi thời điểm chỉ
cho phép gửi đi một gói tin DBD. Gói tin request cũng được gửi
đi để yêu cầu cập nhật các gói tin LSA.

Loading State Ở trạng thái này, gói tin LS Request được gửi đi để yêu cầu trạng
thái mới nhất của LSA

Full State Sau khi nhận gói tin LS Update, cơ sở dữ liệu của hai Router đã
đồng bộ hóa và Router sẽ chuyển sang trạng thái Full.

Các trạng thái 2 – way và Exstart được minh họa bởi Hình V.15 và V.16 dưới đây:

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 53
Cơ bản về định tuyến và các giao thức định tuyến

Hình V.15 – Mô tả hoạt động của trạng thái 2 - way

Hình V.16 – Mô tả hoạt động của trạng thái Exstart

13. Lab 4 – Cấu hình OSPF cơ bản

Hình V.17 – Sơ đồ mạng Lab 4


Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 54
Cơ bản về định tuyến và các giao thức định tuyến

Yêu cầu: Sử dụng Cisco Packet Tracer để xây dựng mạng như sơ đồ đã cho
i. Đặt tên, gán địa chỉ IP cho các router và các cổng tương ứng
ii. Chú ý: các cổng Austin – S0/0 và Houston – S0/0 đóng vai trò DCE nên cần
có câu lệnh clock rate trên các cổng này
iii. Kích hoạt OSPF để định tuyến giữa các mạng con
iv. Các router phải ping được tất cả các địa chỉ trong mạng và ngược lại
Cấu hình:
Bước 1: Thực hiện yêu cầu (i), (ii) và (iii)

Austin Router
Router>enable Moves to privileged mode.
Router#configure terminal Moves to global configuration mode.

Router(config)#hostname Austin Sets the host name.

Moves to interface configuration


Austin(config)#interface fastethernet 0/0
mode.
Austin(config-if)#ip address Assigns an IP address and netmask.
172.16.10.1 255.255.255.0

Austin(config-if)#no shutdown Enables the interface.

Moves to interface configuration


Austin(config-if)#interface serial 0/0
mode.
Austin(config-if)#ip address Assigns an IP address and netmask.
172.16.20.1 255.255.255.252
Austin(config-if)#clock rate 64000 DCE cable plugged in this side.
Austin(config-if)#no shutdown Enables the interface.
Austin(config-if)#exit Returns to global configuration mode.

Austin(config)#router ospf 1 Starts OSPF process 1.

Austin(config-router)#network Any interface with an address of


172.16.10.0 0.0.0.255 area 0 172.16.10.x/24 is to be put into area 0.
Austin(config-router)#network Any interface with an address of
172.16.20.0 0.0.0.3 area 0 172.16.20.x/30 is to be put into area 0.

Austin(config-router)#end Returns to privileged mode.

Austin#write memory Saves the configuration to NVRAM.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 55
Cơ bản về định tuyến và các giao thức định tuyến

Houston Router
Router>enable Moves to privileged mode.
Router#configure terminal Moves to global configuration mode.

Router(config)#hostname Houston Sets the host name.

Houston(config)#interface fastethernet Moves to interface configuration mode.


0/0
Houston(config-if)#ip address Assigns an IP address and netmask.
172.16.30.1 255.255.255.0

Houston(config-if)#no shutdown Enables the interface.

Houston(config-if)#interface serial0/0 Moves to interface configuration mode.

Houston(config-if)#ip address Assigns an IP address and netmask.


172.16.40.1 255.255.255.252
Houston(config-if)#clock rate 64000 DCE cable plugged in this side.
Houston(config-if)#no shutdown Enables the interface.

Houston(config)#interface serial 0/1 Moves to interface configuration mode.

Houston(config-if)#ip address Assigns an IP address and netmask.


172.16.20.2 255.255.255.252
Houston(config-if)#no shutdown Enables the interface.
Houston(config-if)#exit Returns to global configuration mode.

Houston(config)#router ospf 1 Starts OSPF process 1.

Houston(config-router)#network Any interface with an address of


172.16.20.0 0.0.0.3 area 0 172.16.20.x/30 is to be put into area 0.
Houston(config-router)#network Any interface with an address of
172.16.30.0 0.0.0.255 area 0 172.16.30.x/24 is to be put into area 0.
Houston(config-router)#network Any interface with an address of
172.16.40.0 0.0.0.3 area 0 172.16.40.x/30 is to be put into area 0.

Houston(config-router)#end Returns to privileged mode.

Houston#write memory Saves the configuration to NVRAM.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 56
Cơ bản về định tuyến và các giao thức định tuyến

Router>enable Moves to privileged mode.


Router#configure terminal Moves to global configuration mode.
Router(config)#hostname Galveston Sets the host name.
Galveston(config)#interface fastethernet Moves to interface configuration mode.
0/0
Galveston(config-if)#ip address Assigns an IP address and netmask.
172.16.50.1 255.255.255.0
Galveston(config-if)#no shutdown Enables the interface.

Galveston(config-if)#interface serial 0/1 Moves to interface configuration mode.

Galveston(config-if)#ip address Assigns an IP address and netmask.


172.16.40.2 255.255.255.252
Galveston(config-if)#no shutdown Enables the interface.
Galveston(config-if)#exit Returns to global configuration mode.
Galveston(config)#router ospf 1 Starts OSPF process 1.
Galveston(config-router)#network Any interface with an address of
172.16.40.0 0.0.0.3 area 0 172.16.40.x/30 is to be put into area 0.
Galveston(config-router)#network Any interface with an address of
172.16.50.0 0.0.0.255 area 0 172.16.50.x/24 is to be put into area 0.
Galveston(config-router)#end Returns to privileged mode.

Galveston#write memory Saves the configuration to NVRAM.

Kiểm tra lại cấu hình dùng lệnh show running-config và show ip interface
brief để đảm bảo cấu hình đúng, giải quyết sự cố nếu cần.

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 57
Cơ bản về định tuyến và các giao thức định tuyến

Bước 2: Kiểm tra bảng định tuyến bằng câu lệnh show ip route, đảm bảo
tất cả các mạng con đều được hiển thị trong bảng định tuyến (5 mạng con).
Ví dụ:

Bước 3: Thực hiện yêu cầu (iv)

Ví dụ:

Nguyễn Thế Xuân Ly, Bộ môn Mạng và Truyền thông, Khoa CNTT, Đại học Bách khoa Đà Nẵng Page 58

You might also like