Computer Network II
Computer Network II
FastEthernet0/1 FastEthernet0/0
192.168.1.1/24 192.168.0.1/24
Switch Management IP Address
VLAN 1 SVI:
192.168.0.10
192.168.0.1
LAN R1 B
SW1
FE0/0 FE0/1
Hostname
The system will load the first IOS image found in Flash by default
You can override this with the boot system command
You can copy additional IOS system images to Flash via TFTP or USB
NVRAM Non-Volatile RAM Memory
When the system has finished loading the IOS system image from Flash,
it will load the startup-config configuration file from NVRAM
The saved startup-config becomes the current running-config in RAM
If no startup-config file is found, the device will load the Setup Wizard
NVRAM Non-Volatile RAM Memory
Whenever you enter a command in IOS it takes effect immediately and
goes into the running-config
To make your changes permanent across a reboot:
copy running-config startup-config
RAM Random Access Memory
The IOS system image and startup-config are loaded from Flash and
NVRAM into RAM during bootup
RAM is used as the normal working memory of the device
ROM, Flash and NVRAM are permanent memory, their contents are not
lost when the device is powered off or rebooted
RAM is volatile memory, its contents are lost when the device is powered
off
The VLAN Database
After downloading the software, copy to the device’s Flash using TFTP:
copy tftp flash
Delete the old system image or use the boot system command
Lab Example
Router IOS Licensing
Prior to IOS 15.0, different IOS system images were available for
different feature sets, such as Security or Telephony
Licensing was not enforced
A universal system image is provided from IOS 15.0
License codes must be entered to activate the Technology Packages
Licensing Procedure
When you purchase a license you will be provided with a Product
Activation Key (PAK) code
The license will be tied to an individual device. To get the device’s
Unique Device Identifier (UDI) enter show license udi
Go the the Cisco License Portal http://www.cisco.com/go/license and
enter the PAK code and UDI to generate the license
Copy the license to Flash on the router
license install flash:
license show
Router Functions
FastEthernet1/0
FastEthernet0/0 10.0.1.1/24
10.0.0.1/24
FastEthernet2/0
10.0.2.1/24
show ip route - Connected Routes
This will automatically enter connected routes into the routing table:
R1#sh ip route
C 10.0.0.0/24 is directly connected, FastEthernet0/0
C 10.0.1.0/24 is directly connected, FastEthernet1/0
C 10.0.2.0/24 is directly connected, FastEthernet2/0
If any traffic for the 10.0.0.0/24 network is received in another interface on the
router, it will forward it out interface FastEthernet0/0
FastEthernet1/0
FastEthernet0/0 10.0.1.1/24
10.0.0.1/24
FastEthernet2/0
10.0.2.1/24
show ip route - Local Routes
From IOS 15, local routes will also be added to the routing table
Local routes always have a /32 mask and show the IP address configured on the
interface
R1#sh ip route
L 10.0.0.1/32 is directly connected, FastEthernet0/0
L 10.0.1.1/32 is directly connected, FastEthernet1/0
L 10.0.2.1/32 is directly connected, FastEthernet2/0
FastEthernet1/0
FastEthernet0/0 10.0.1.1/24
10.0.0.1/24
FastEthernet2/0
10.0.2.1/24
Lab
Static Routes
If a router receives traffic for a network which it is not directly attached to,
it needs to know how to get there in order to forward the traffic
An administrator can manually add a static route to the destination, or the
router can learn it via a routing protocol
ip route 10.0.1.0 255.255.255.0 10.0.0.1
ip route 10.0.2.0 255.255.255.0 10.0.0.1
10.0.1.1/24
10.0.0.0/24 F1/0
10.1.0.2/24 .2 .1
R2 R1
F1/0 F0/0 F0/0 10.0.2.1/24
F2/0
FE1/0
10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0 FE0/0 FE0/0
FE2/0
10.0.2.1/24
Longest Prefix Match
When there are overlapping routes, the longest prefix will be selected
ip route 10.1.0.0 255.255.0.0 10.0.0.2
ip route 10.1.3.0 255.255.255.0 10.0.3.2
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Load Balancing
When multiple equal length routes are added for the same destination, the
router will add them all to the routing table and load balance between them
R1(config)# ip route 10.1.0.0 255.255.0.0 10.0.0.2
R1(config)# ip route 10.1.0.0 255.255.0.0 10.0.3.2
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Default Route (Gateway of Last Resort)
ip route 10.1.0.0 255.255.0.0 10.0.0.2
ip route 10.1.3.0 255.255.255.0 10.0.3.2
ip route 0.0.0.0 0.0.0.0 203.0.113.2
Internet
FE1/0
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24 203.0.113.1 .2
.1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0 FE0/0 FE0/0
FE2/0
FE2/0 FE3/0 10.0.2.1/24
10.1.3.1/24 10.0.3.1/24
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Lab
Dynamic Routing Protocols
10 Mbps 10 Mbps
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Routing Protocol Types
Routing protocols can be split into two main types:
Interior gateway protocols (IGPs)
Exterior gateway protocols (EGPs)
Advanced
All of the IGPs do the same job, which is to advertise routes within an
organisation and determine the best path or paths
An organisation will typically pick one of the IGPs
If an organisation has multiple IGPs in effect (for example because of a
merger), information can be redistributed between them. This should
generally be avoided if possible
Lab
10 Mbps 10 Mbps
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Metric
If the best path to a destination is lost (for example because a link went
down) it will be removed from the routing table and replaced with the
next best route
Metric
For example in RIP, path A>B>C>D has a hop count of 3, path A>B>D has a
hop count of 2, so A>B>D would be preferred
In OSPF, if path A>B>C>D has a cost of 60, and path A>B>D has a cost of
100, then A>B>C>D would be used
Administrative Distance
If paths to the same destination are received from different routing
protocols, their metrics cannot be compared
For example, a RIP hop count of 5 cannot be compared to an OSPF cost of
60. The comparison would be meaningless because the routing protocols
calculate the metric in completely different ways
The router must use a different method to choose when routes to the
same destination are received from different routing protocols
The Administrative Distance (AD) is used for this
Administrative Distance
The router will then compare the routes received via OSPF and install the
one with the lowest cost in the routing table
If multiple equal cost paths are received via OSPF they will all be installed
in the routing table and the router will load balance outbound traffic to
the destination between them
Floating Static Routes
If the best path to a destination is lost (for example because a link went
down) it will be removed from the routing table and replaced with the
next best route
We might want to configure a static route as a backup for the route
learned via a routing protocol
A problem is that static routes have a default Administrative Distance of 1
which will always be preferred over routes learned via an IGP
Floating Static Routes – OSPF
We can change the Administrative Distance of a static route to make it
act as the backup (rather than the preferred) route
Floating static route for OSPF example
R4(config)#ip route 10.0.1.0 255.255.255.0 10.1.3.2 115
10 Mbps 10 Mbps
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Loopback Interfaces
10.0.1.1/24 RB
FE0/0 FE1/0
10.0.0.1/24 R1
RA
Loopback0 FE2/0
10.0.2.1/24
192.168.1.1/32 RC
Passive Interfaces
10.0.1.1/24 RB
FE0/0 FE1/0
10.0.0.1/24 R1
RA
Loopback0 FE2/0
10.0.2.1/24
192.168.1.1/32 RC
Passive Interface Use Cases
Loopback0
192.168.1.1/32 FE1/0
100 Mbps 100 Mbps 100 Mbps 10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE0/0 FE0/0 FE2/0
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0
10.0.2.1/24
FE2/0 FE3/0
10.1.3.1/24 10.0.3.1/24 FE2/0
10.0.2.2/24
10 Mbps 10 Mbps
R5
FE2/0 FE3/0 R6
10.1.3.2/24 10.0.3.2/24
Ping
ICMP: Internet Control Message Protocol
R1#ping 10.1.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.1, timeout is 2
seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max =
68/322/1076 ms
Ping Responses
If the router does not have a corresponding route or the destination IP
address does not respond:
R1#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2
seconds:
.....
Success rate is 0 percent (0/5)
Ping Responses
If the router discards the packet (for example it is blocked by an Access
Control List):
R1#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2
seconds:
UUUUU
Success rate is 0 percent (0/5)
Traceroute
R1#traceroute 10.1.2.1
Type escape sequence to abort.
Tracing the route to 10.1.2.1
VRF info: (vrf in name/id, vrf out name/id)
1 10.0.0.2 20 msec 16 msec 16 msec
2 10.1.0.1 36 msec 40 msec 40 msec
3 10.1.1.1 60 msec 64 msec 60 msec
Traceroute Responses
The packet is getting as far as 10.1.0.1. Start troubleshooting there.
Press Ctrl-Shift-6 to abort
R1#traceroute 10.1.2.1
Type escape sequence to abort.
Tracing the route to 10.1.2.10
VRF info: (vrf in name/id, vrf out name/id)
1 10.0.0.2 28 msec 16 msec 16 msec
2 10.1.0.1 36 msec 36 msec 40 msec
3 * * *
4 * * *
Other Tools – Layer 1
Show ip interface brief
Show interface
Other Tools – Layer 2
Show arp
Show mac address-table
Other Tools – Layer 4
Telnet
Other Tools – DNS
nslookup
Ping by FQDN
OSPF Characteristics
OSPF is a Link State routing protocol
It supports large networks
It has very fast convergence time
Messages are sent using multicast
OSPF is an open standard protocol
It uses Dijkstra’s Shortest Path First algorithm to determine the best path
to learned networks
Link State Routing Protocols
In Link State routing protocols, each router describes itself and its
interfaces to its directly connected neighbours
This information is passed unchanged from one router to another
Every router learns the full picture of the network including every router,
its interfaces and what they connect to
OSPF routers use LSA Link State Advertisements to pass on routing
updates
OSPF Operations
1. Discover neighbours
2. Form adjacencies
3. Flood Link State Database (LSDB)
4. Compute Shortest Path
5. Install best routes in routing table
6. Respond to network changes
OSPF Packet Types
Hello: A router will send out and listen for Hello packets when OSPF is
enabled on an interface, and form adjacencies with other OSPF routers
on the link
DBD DataBase Description: Adjacent routers will tell each other the
networks they know about with the DBD packet
LSR Link State Request: If a router is missing information about any of
the networks in the received DBD, it will send the neighbour an LSR
OSPF Packet Types (Cont.)
LSA Link State Advertisement: A routing update
LSU Link State Update: Contains a list of LSA’s which should be updated,
used during flooding
LSAck: Receiving routers acknowledge LSAs
OSPF Configuration – Process ID
R1(config)#router ospf 1
R2(config)#router ospf 1
R2(config-router)#network 10.0.0.0 0.0.0.255 area 0
R2(config-router)#network 10.1.0.0 0.0.0.255 area 0
Interface FE1/0 and FE2/0 fall within this range, FE0/0 does not
OSPF will be enabled on FE1/0 and FE2/0 and the router will peer with
adjacent OSPF routers
Networks advertised: FE1/0
10.0.1.1/24
10.0.1.0/24 FE0/0
10.1.0.1/24
R1
10.0.2.0/24
FE2/0
10.1.0.0/24 is NOT advertised 10.0.2.1/24
10.0.0.0/24 10.0.1.1/24
.2 .1 F1/0
R2 R1
F0/0 F0/0 10.0.2.1/24
F2/0
OSPF Operations
1. Discover neighbours
2. Form adjacencies
3. Flood Link State Database (LSDB)
4. Compute Shortest Path
5. Install best routes in routing table
6. Respond to network changes
OSPF Verification - show ip ospf database
R2#show ip ospf database
10.0.0.0/24 10.0.1.1/24
.2 .1 F1/0
R2 R1
F0/0 F0/0 10.0.2.1/24
F2/0
OSPF Router ID
OSPF routers identify themselves using an OSPF Router ID which is in
the form of an IP address.
This will default to being the highest IP address of any loopback
interfaces configured on the router, or the highest other IP address if a
loopback does not exist.
Loopback interfaces never go down so the Router ID will not change.
You can also manually specify the Router ID.
Best practice is to use a Loopback or manually set the Router ID.
OSPF Router ID – No Loopback
R1#sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.0.0.1 YES NVRAM up up
FastEthernet1/0 10.0.1.1 YES NVRAM up up
FastEthernet2/0 10.0.2.1 YES NVRAM up up
FastEthernet3/0 10.0.3.1 YES NVRAM up up
R1#show ip protocols
*** IP Routing is NSF aware ***
R1#show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 2.2.2.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
! truncated
Passive Interface Configuration
Loopback0
192.168.1.1/32 FE1/0
10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE0/0 FE0/0 FE2/0
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0
10.0.2.1/24
FE2/0 FE3/0
10.1.3.1/24 10.0.3.1/24 FE2/0
10.0.2.2/24
R1
FE2/0 FE3/0 R6
10.1.3.2/24 10.0.3.2/24
R1(config)#router ospf 1
R1(config-router)#passive-interface loopback 0
R1(config-router)#passive-interface f2/0
Passive Interface Configuration
Loopback0
192.168.1.1/32 FE1/0
10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE0/0 FE0/0 FE2/0
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0
10.0.2.1/24
FE2/0 FE3/0
10.1.3.1/24 10.0.3.1/24 FE2/0
10.0.2.2/24
R5
FE2/0 FE3/0 R6
10.1.3.2/24 10.0.3.2/24
R1(config)#router ospf 1
R1(config-router)#passive-interface default
R1(config-router)#no passive-interface f0/0
R1(config-router)#no passive-interface f1/0
R1(config-router)#no passive-interface f3/0
Default Route Injection
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24 FE1/0
10.0.1.1/24
FE1/0 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE0/0 FE0/0 FE1/0 FE1/0 FE0/0 FE0/0
FE2/0
FE3/0 10.0.2.1/24
203.0.113.1
203.0.113.2
Internet
The rate that Serial interfaces physically transmit at is set by the ‘clock
rate’ command
Serial interfaces transmit at 1.544 Mbps by default
If you use the ‘clock rate 64000’ command on a Serial interface it will
physically transmit at 64 Kbps
The bandwidth command
10.0.2.0/24 10.0.3.0/24
Cost: 10 Cost: 10
.2 .2
F1/0 R3 F0/0
Reference Bandwidth
The cost is automatically derived from the interface bandwidth
Cost = Reference Bandwidth / Interface Bandwidth
The default reference bandwidth is 100 Mbps
FastEthernet link cost defaults to 1 (100 / 100)
T1 link cost defaults to 64 (100 / 1.544)
Reference Bandwidth
OSPF treats all interfaces of 100 Mbps or faster as equal
FastEthernet, Gigabit Ethernet, 10 Gigabit Ethernet etc. all
default to a cost of 1
This can cause undesirable routing in modern networks
10.0.2.0/24 10.0.3.0/24
Cost: 1 Cost: 1
.2 .2
G1/0 R3 G0/0
Reference Bandwidth
R1(config)#router ospf 1
R1(config-router)#auto-cost reference-bandwidth 100000
10.0.2.0/24 10.0.3.0/24
Cost: 100 Cost: 100
.2 .2
G1/0 R3 G0/0
Manipulating the OSPF Metric
OSPF takes the bandwidth of an interface into account when
calculating the metric, so paths along higher bandwidth links will be
preferred
The most desirable path will typically be automatically selected
Manipulating the OSPF Metric (Cont.)
If you want to use a different path, you can manipulate this by
manually changing the bandwidth or OSPF cost on interfaces
It is recommended to use cost because the bandwidth setting can
affect many features other than OSPF (such as QoS)
OSPF Metric - Bandwidth
R1#show interface serial1/0
Serial1/0 is administratively down, line protocol is down
Hardware is M4T
MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
!
R1(config)#interface serial1/0
R1(config-if)#bandwidth 768
!
R1#show interface serial1/0
Serial1/0 is administratively down, line protocol is down
Hardware is M4T
MTU 1500 bytes, BW 768 Kbit/sec, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
OSPF Metric - Cost
172.16.1.1/24 172.16.2.1/24
10.0.0.1/30 10.0.0.2/30
R1 R2
172.16.1.1/24 172.16.2.1/24
10.0.0.1/30 10.0.0.2/30
R1 R2
172.16.1.1/24 172.16.2.1/24
10.0.0.1/30 10.0.0.2/30
R1 R2
172.16.1.1/24 172.16.2.1/24
10.0.0.1/30 10.0.0.2/30
R1 R2
LSDB Summary
DBD
Acknowledged
LSAck
LSDB Summary
DBD
Acknowledged
LSAck
Neighbor States – Loading
172.16.1.1/24 172.16.2.1/24
10.0.0.1/30 10.0.0.2/30
R1 R2
172.16.1.1/24 172.16.2.1/24
10.0.0.1/30 10.0.0.2/30
R1 R2
Acknowledged
LSAck
Acknowledged
LSAck
OSPF on Multiaccess Segments
On point to point links, OSPF router pairs form a FULL adjacency
On multiaccess segments (such as Ethernet) where there can be
multiple routers, it is inefficient for all routers to form a FULL OSPF
adjacency with each other
R1 R2
10.0.0.1/24 10.0.0.2/24
R3 10.0.0.3/24 10.0.0.4/24 R4
DR and BDR
A DR Designated Router and BDR Backup Designated
Router are elected
The router with the highest priority becomes DR, and the
router with the 2nd highest priority becomes BDR
Default priority is 1, the higher the better (0 - 255)
Highest Router ID is used in case of a tie
Neighbor States – 2-Way
Area 0
R6 FE0/0 FE0/0 R7
172.16.0.6/24 172.16.0.7/24
R8 FE0/0 FE0/0 R9
172.16.0.8/24 172.16.0.9/24
OSPF Areas
Every router learns the full picture of the network including every router,
its interfaces and what they connect to
This can cause issues in large networks:
Too many routes can use up too much router memory
Network changes cause all routers to reconverge which takes time
and CPU resources
OSPF Areas
OSPF supports a hierarchical design which segments large networks into
smaller areas to solve this problem
Each router maintains full information about its own area, but only
summary information about other areas
OSPF Areas
A two level hierarchy is used:
Transit area (backbone or area 0). Does not generally contain end users.
Regular areas (nonbackbone areas). Used to connect end users to the Transit area.
By default, all transit traffic goes through the Transit area.
Small networks do not require a hierarchical design and all routers can be in Area 0
Area 0
Area 1 Area 2
OSPF Configuration - network
R1(config-router)# network 10.0.0.0 0.0.255.255 area 0
The area is configured at the interface level with the ‘network’
command
For a router to form an adjacency, its neighbour must be
configured to be in the same area
OSPF Router Types – Backbone Routers
Routers which have all their OSPF interfaces in Area 0 are Backbone Routers
Routers maintain a full LSDB of other routers and links in their own area
Area 0
Internal Routes
Routes received from other routers in the same area appear as Internal OSPF routes
R3#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Area 0
Area 1 Area 2
OSPF Router Types - ABRs
An ABR has the following characteristics:
It separates LSA flooding zones.
It becomes the primary point for area address summarization.
It functions regularly as the source for default routes.
It maintains the LSDB for each area with which it is connected.
The ideal design is to have each ABR connected to two areas only, the
backbone and another area, with three areas being the upper limit.
Manual Summarization
ABRs do not automatically summarise
If you do not configure summarisation, all routes are flooded everywhere
R2(config)#router ospf 1
R2(config-router)#network 10.1.0.0 0.0.255.255 area 0
R2(config-router)#network 10.0.0.0 0.0.255.255 area 1
R2(config-router)#area 0 range 10.1.0.0 255.255.0.0
R2(config-router)#area 1 range 10.0.0.0 255.255.0.0
Area 0 Area 1
10.1.0.0/24 10.0.0.0/24 10.0.1.1/24
10.1.1.1/24 R4
.2 .1 F1/0
.1 .2 R3
R1 R2
F0/0 F1/0 F1/0 F0/0 F0/0 10.0.2.1/24
F2/0
Inter Area Routes
Routes to other areas appear as Inter Area IA routes
R1#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Area 1 Area 2
OSPF Router Types – Normal Area Routers
Routers maintain a full LSDB of other routers and links in their own area
They learn Inter Area routes to other areas from their ABRs
Area 0
Area 1 Area 2
OSPF Router Types - ASBRs
Routers which redistribute into OSPF are Autonomous System Boundary Routers
Area 0
Area 1 Area 2
Another AS
External Routes
Routes which are redistributed into OSPF appear as External Routes
R1#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Area 0
FE1/0
10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0 FE0/0 FE0/0
FE2/0
FE2/0 FE3/0 10.0.2.1/24
10.1.3.1/24 10.0.3.1/24
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Multi Area OSPF Lab
Area 0
FE1/0
10.0.1.1/24
10.1.1.0/24 10.1.0.0/24 10.0.0.0/24
10.1.2.1/24 .1 .2 .1 .2 .2 .1
R4 R3 R2 R1
FE1/0 FE0/0 FE0/0 FE1/0 FE1/0 FE0/0 FE0/0
FE2/0
FE2/0 FE3/0 10.0.2.1/24
10.1.3.1/24 10.0.3.1/24
R5
FE2/0 FE3/0
10.1.3.2/24 10.0.3.2/24
Area 1
Campus Design - Access, Distribution and Core Layers
Access Layer
Distribution Layer
Access Layer
Core Layer
Distribution Layer
Access Layer
Distribution/Core Layer
Access Layer
Main Building
Traditional Campus Design
Wide Area
Network
Core Layer
Distribution Layer
Access Layer
Core Layer
Distribution Layer
Access Layer
ENG PC3
IP Address: 10.10.10.12
Ethernet Switch
ENG PC3
IP Address: 10.10.10.12
Ethernet Switch
ENG PC3
IP Address: 10.10.10.12
Ethernet Switch
ENG PC3
IP Address: 10.10.10.12
Ethernet Switch
ENG PC3
IP Address: 10.10.10.12
Switches only
F0/3 F0/1 F0/2 Ethernet Switch allow traffic within
F0/4
F0/6
F0/7 the same VLAN
F0/5
ENG PC3
IP Address: 10.10.10.12
ENG PC3
IP Address: 10.10.10.12
ENG PC3
IP Address: 10.10.10.12
VLAN access ports are configured on switch interfaces where end hosts
are plugged in
Access ports are configured with one specific VLAN
The configuration is all on the switch, the end host is not VLAN aware
Switches only allow traffic within the same VLAN
Unicast Traffic within same IP subnet
ROUTER
ENG VLAN Wide Area
SALES VLAN ENG Default Gateway SALES Default Gateway
Network
ENG PC3
IP Address: 10.10.10.12
ENG PC3
IP Address: 10.10.10.12
ENG PC3
IP Address: 10.10.10.12
Ethernet Switch
ENG PC3
IP Address: 10.10.10.12
IP Address: 10.10.20.1
ENG PC3
IP Address: 10.10.10.12
Ethernet Switch
IP Address: 10.10.20.1
ENG PC3
IP Address: 10.10.10.12
Ethernet Switch
Ethernet Switch
When the switch forwards traffic to another switch, it tags the layer 2
Dot1Q header with the correct VLAN
The receiving switch will only forward the traffic out ports that are in
that VLAN
The switch removes the Dot1Q tag from the Ethernet frame when it
sends it to the end host
Dot1Q Format
A receiving switch will remove the Dot1Q tag when forwarding the frame out an access port
Dot1Q Trunks
ROUTER
ENG VLAN Wide Area
ENG Default Gateway
SALES VLAN IP Address: 10.10.10.10 SALES Default Gateway
Network
2 4
Dot1q tag: Sales VLAN Ethernet Switch
Sales VLAN
1 5
SALES PC2 ENG PC2
IP Address: 10.10.20.10 IP Address: 10.10.10.11
The Native VLAN
The switch needs to know which VLAN to assign to any traffic which
comes in untagged on a trunk port
This used to be required for when a switch was connected to a hub.
Hubs are Layer 1 devices so are not VLAN aware
The Native VLAN is used for this
The default Native VLAN is VLAN 1
There are some security issues with using VLAN 1 as the Native VLAN so
best practice is to change it to an unused VLAN
The Native VLAN must match on both sides of a trunk for it to come up
Native VLAN Configuration
SW1(config)#vlan 199
SW1(config-vlan)#name Native
If two Cisco switches are cabled together they can negotiate a trunk
connection using Cisco’s Dynamic Trunking Protocol DTP
It is however recommended to manually configure switch ports
Manual configuration:
switchport mode access
switchport mode trunk
Dynamic Trunking Protocol DTP
DTP configuration:
Switchport mode dynamic auto: will form a trunk if the
neighbour switch port is set to trunk or desirable. Trunk will not be
formed if both sides are set to auto. Default on newer switches.
Switchport mode dynamic desirable: will form a trunk if
the neighbour switch port is set to trunk, desirable or auto. Default on
older switches.
Switchport nonegotiate: disables DTP.
DTP Lab
VLANs and IP subnets in the LAN
You need a separate physical interface for every VLAN – you are liable
to run out of interfaces
Traffic being routed within the campus has to go up and down physical
Ethernet cables to the router
Inter-VLAN Routing Lab
Option 2: Router on a Stick
F0/2
ENG VLAN 203.0.113.1/24 Wide Area
SALES VLAN Network
F0/1.10 F0/1.20
ENG Default Gateway SALES Default Gateway
ENG PC3 IP Address: 10.10.10.1 IP Address: 10.10.20.1
IP Address: 10.10.10.12
F0/3 F0/1
F0/4 F0/7
F0/5 F0/6
You do not need a separate physical interface for every VLAN – you are
less likely to run out of interfaces
Traffic being routed within the campus has to go up and down the
same physical Ethernet cable to the router – there is more contention
for bandwidth than when using separate interfaces
Inter-VLAN Routing Lab
Option 3: Layer 3 Switch
ROUTER F0/2
ENG VLAN 203.0.113.1/24 Wide Area
SALES VLAN Network
F0/1
10.10.100.2/24
ENG PC3 Interface VLAN 10
IP Address: 10.10.10.12
ENG Default Gateway
10.10.100.1/24 IP Address: 10.10.10.1 SVI
F0/1 Switched Virtual
F0/3 Interface VLAN 20 Interfaces
F0/4 F0/7 SALES Default Gateway
F0/5 F0/6 IP Address: 10.10.20.1
Traffic being routed within the campus is routed across the switch
backplane, it does not need to travel over physical cables to an
external router
You may still need an external router for WAN connectivity and
services
Layer 3 Switch Lab
DHCP – Dynamic Host Configuration Protocol
Desktop PCs are good candidates to be DHCP clients because there will
typically be many of them in an office. Using DHCP saves a lot of admin
work that would be necessary if manually configuring IP addresses.
They do not accept incoming connections so it does not matter if their
IP address changes.
DHCP Clients
Pool 10.10.10.0_Clients :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 2
Excluded addresses : 1
Pending event : none
R1(config)#interface f0/1
R1(config-if)#ip helper-address 10.10.20.10
Configuring a Cisco Router as a DHCP Client
The BPDU contains the switch’s Bridge ID which uniquely identifies the
switch on the LAN
The Bridge ID is comprised of the switch’s unique MAC address and an
administrator defined Bridge Priority value
The Bridge Priority can be from 0 – 65535, with 32768 being the
default
The Root Bridge
The other switches will detect their lowest cost path to the Root Bridge
These paths will transition to a forwarding state
Spanning Tree Cost
When a switch calculates its best path towards the Root Bridge, higher
bandwidth links are preferred
Root Ports
Each switch’s exit interface on the lowest cost path to the Root Bridge
is selected as its Root Port
Load Balancing
A Spanning Tree instance does not do load balancing
If a switch has multiple equal cost paths towards the Root Bridge, it
will select the neighbour switch with the lowest Bridge ID
Root Ports and Designated Ports are the most direct paths to and from
the Root Bridge and transition to a forwarding state
Other Links
On the remaining links, the switches determine which of them has the
least-cost path to the root
If they have equal cost paths then the Bridge ID is used as a tiebreaker
The port connecting this switch to the link is selected as a Designated
Port.
Blocking Ports
Any ports which have not been selected as a Root Port or Designated
Port pair would potentially form a loop
These are selected as Blocking Ports
Blocking Ports
Spanning Tree only blocks ports on one side of the blocked link
BPDUs continue to be sent over the link but other traffic is dropped
Root, Designated and Blocking Ports
The easy way to figure out which ports are Root, Designated and
Blocking:
1. Determine the Root Bridge first (best Bridge ID)
2. All ports on the Root Bridge are Designated Ports
3. Determine the Root Ports on the other switches (lowest cost to
Root Bridge)
Root, Designated and Blocking Ports (Cont.)
4. The ports on the other side of those links are Designated Ports
5. On the links which are left, one port will be Blocking
6. Determine the Blocking Port (highest cost path to Root Bridge or
highest Bridge ID)
7. The ports on the other side of those links are Designated Ports
Campus Design - Oversubscription
Wide Area
Network
Core Layer
Distribution Layer
Access Layer
End hosts do not constantly send traffic onto the network, most of the
time their network connection is sitting idle
Because of this you can connect less uplinks to each higher layer than
the number of hosts you have and still maintain acceptable network
performance
Campus Design - Oversubscription
Physical Physical
NIC1 Switch
Logical
Interface
IP Address:
10.10.10.10
Physical
NIC2
Server 1
Terminology
EtherChannel is also known as:
A Port Channel
LAG Link Aggregation
A link bundle
S-1 S-2
PC-1 PC-2
EtherChannel Load Balancing – 1 Packet
st
2nd Packet from PC-1 to Server-1 goes over the same link
EtherChannel Load Balancing – 1 Packet
st
2nd Packet from PC-2 to Server-2 goes over the same link
EtherChannel Load Balancing
Packets from the same flow are not load balanced round robin across
all the interfaces in the port channel
We do not load balance the first packet from PC-1 to Server-1 on to
interface G0/1, the second packet onto G0/2
Round robin load balancing could cause packets to arrive out of order
which would break some applications
EtherChannel Load Balancing – 1 Packet
st
SW1(config)#interface port-channel 1
SW1(config-if)#switchport mode trunk
Configure the interface settings on the port channel
LACP Configuration
Configure matching settings on the other switch on the other side of the links:
SW2(config)#interface port-channel 1
SW2(config-if)#switchport mode trunk
PAgP Configuration
PAgP interfaces can be set as either Desirable or Auto
If one side is Desirable and the other Auto, the port channel will come
up
If both sides are Auto, the port channel will not come up
If both sides are Desirable, the port channel will come up
If you configure both sides as Desirable you don’t have to think about
which side is which
PAgP Configuration
SW1(config)#interface range f0/23 - 24
SW1(config-if-range)#channel-group 1 mode desirable
SW1(config)#interface port-channel 1
SW1(config-if)#switchport mode trunk
Configure matching settings on the switch on the other side of the links
Static Configuration
SW1(config)#interface range f0/23 - 24
SW1(config-if-range)#channel-group 1 mode on
SW1(config)#interface port-channel 1
SW1(config-if)#switchport mode trunk
Configure matching settings on the switch on the other side of the links
Verification – show etherchannel summary
Verification – show spanning-tree vlan
Before EtherChannel configured:
Verification – show spanning-tree vlan
After EtherChannel configured:
1 Port Channel – Acc3 to CD1 - LACP
st
Switch1(config)#interface port-channel 1
Switch1(config-if)#ip address 192.168.0.1 255.255.255.252
Switch1(config-if)#no shutdown
Layer 3 Campus Design
Wide Area
Network
Core Layer
Distribution Layer
Access Layer
DHCP Snooping
DAI Dynamic ARP Inspection
802.1X Identity Based Networking
Port Security
External DHCP Server Configuration
R1(config)#interface f0/1
R1(config-if)#ip helper-address 10.10.20.10
Rogue DHCP Server
DHCP Snooping
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Address Resolution Protocol
I’m 10.10.10.1, my MAC
address is 2.2.2
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2
ARP Address Resolution Protocol
10.10.10.10 > 10.10.10.1
1.1.1 > 2.2.2
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2
ARP Address Resolution Protocol
10.10.10.1 > 10.10.10.10
2.2.2 > 1.1.1
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2
Man in the Middle ARP Spoofing
Gratuitous ARP: ‘I am 10.10.10.1, my MAC address is 3.3.3’
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2 Attacker
10.10.10.100/24
MAC: 3.3.3
Man in the Middle ARP Spoofing
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 3.3.3 Attacker
10.10.10.100/24
MAC: 3.3.3
Man in the Middle ARP Spoofing
Gratuitous ARP: ‘I am 10.10.10.10, my MAC address is 3.3.3’
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 3.3.3 Attacker
10.10.10.100/24
MAC: 3.3.3
Man in the Middle ARP Spoofing
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 3.3.3
ARP Cache
10.10.10.1 = 3.3.3 Attacker
10.10.10.100/24
MAC: 3.3.3
Man in the Middle ARP Spoofing
10.10.10.10 > 10.10.10.1
1.1.1 > 3.3.3
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2 Attacker
10.10.10.100/24
MAC: 3.3.3
Man in the Middle ARP Spoofing
10.10.10.10 > 10.10.10.1
3.3.3 > 2.2.2
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2 Attacker
10.10.10.100/24
MAC: 3.3.3
Man in the Middle ARP Spoofing
10.10.10.1 > 10.10.10.10
2.2.2 > 3.3.3
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2 Attacker
10.10.10.100/24
MAC: 3.3.3
Man in the Middle ARP Spoofing
10.10.10.1 > 10.10.10.10
3.3.3 > 1.1.1
R1
PC1
10.10.10.1/24
10.10.10.10/24
MAC: 2.2.2
DG: 10.10.10.1
MAC: 1.1.1
ARP Cache
10.10.10.10 = 1.1.1
ARP Cache
10.10.10.1 = 2.2.2 Attacker
10.10.10.100/24
MAC: 3.3.3
Dynamic ARP Inspection DAI
When you enable DHCP snooping, the switch inspects the DHCP traffic
and keeps track of which IP addresses were assigned to which MAC
addresses
For example, PC1 with MAC address 1.1.1 was assigned IP address
10.10.10
If invalid ARP traffic tries to pass through the switch, for example 3.3.3
saying it is 10.10.10, the switch drops the traffic
DAI Configuration
SW1(config)#int f0/1
SW1(config-if)#ip arp inspection trust
!
SW1(config)#ip arp inspection vlan 10
SBH-SW2(config)#int g1/0/23
SBH-SW2(config-if)#ip arp inspection trust
!
SBH-SW2(config)#ip arp inspection vlan 12
802.1X Identity Based Networking
SW1(config)#int f0/2
SW1(config-if)#shutdown
Port Security
f0/2
PC1 Allowed MAC: 1.1.1
MAC: 1.1.1
Port Security
f0/2
PC1 Allowed MAC: 1.1.1
MAC: 1.1.1
Port Security
f0/2
PC2 Allowed MAC: 1.1.1
MAC: 2.2.2
Port Security
It is easy to spoof a MAC address, so locking ports down to a specific
host is not usually Port Security’s main role in production networks
Port Security can also configure individual switch ports to allow only a
specified number of source MAC addresses to send traffic in to the
port
It can learn connected MAC addresses
f0/2
PC1 Allow 1 MAC address
MAC: 1.1.1 Learned MAC: 1.1.1
Port Security
This is useful to prevent users from adding Wireless Access Points or
other shared devices
PC2
MAC: 2.2.2
f0/2
Allow 1 MAC address
Learned MAC: 1.1.1
PC1
MAC: 1.1.1
Port Security Configuration
SW1(config)#int f0/2
SW1(config-if)#switchport port-security
Port Security Default Behaviour
You can bring error disabled ports back into service automatically after
they have been disabled for a configurable period of time (in seconds)
You can statically configure allowed MAC addresses if you want to lock
the port down to a particular host:
ACL’s are also used in other software policies when traffic has to be
identified, for example:
Identify traffic to give better service to in a QoS Quality of Service
policy
Identify traffic to translate to a different IP address in a NAT
Network Address Translation policy
ACE Access Control Entries
Access Control Lists are made up of Access Control Entries which are a
series of permit or deny rules
Each ACE is written in a separate line
ACE Access Control Entry Example
R1(config)#ip access-list ?
extended Extended Access List
standard Standard Access List
! truncated
Named ACL Syntax
R1(config)#ip access-list standard Flackbox-Demo
R1(config-std-nacl)#deny 10.10.10.10 0.0.0.0
R1(config-std-nacl)#permit 10.10.10.0 0.0.0.255
Extended Access List Example
R1(config)# access-list 100 deny tcp 10.10.10.10 0.0.0.0
gt 49151 10.10.50.10 0.0.0.0 eq 23
R1(config)# access-list 100 permit tcp 10.10.10.0
0.0.0.255 gt 49151 10.10.50.10 0.0.0.0 eq telnet
ACL Action
R1(config)#access-list 100 ?
deny Specify packets to reject
permit Specify packets to forward
remark Access list entry comment
! Truncated
ACL Protocol
R1(config)#access-list 100 permit ?
<0-255> An IP protocol number
ahp Authentication Header Protocol
eigrp Cisco's EIGRP routing protocol
esp Encapsulation Security Payload
gre Cisco's GRE tunneling
icmp Internet Control Message Protocol
ip Any Internet Protocol
ospf OSPF routing protocol
tcp Transmission Control Protocol
udp User Datagram Protocol
! truncated
ACL Protocol
Use TCP or UDP if you want the ACE to apply to traffic for a particular
application between a source and destination address
The ‘log’ keyword is not required to log hit counts. It is used to log to the console
or an external monitoring server
Access Groups
ACLs are applied at the interface level with the Access-Group command
ACLs can be applied in the inbound or outbound direction
You can have a maximum of one ACL per interface per direction
You can have both an inbound and an outbound ACL on the same
interface, but not 2 inbound or outbound ACLs
An interface can have no ACL applied, an inbound ACL only, an
outbound ACL only, or ACLs in both directions
Access-Group Configuration
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ip access-group 100 out
R1(config-if)# ip access-group 101 in
Access-Group Configuration – show ip interface
R3#show ip interface f1/0 | include access list
Outgoing access list is 100
Inbound access list is 101
This will deny 10.10.10.10 but permit the rest of the 10.10.10.0/24 subnet
R1(config)# access-list 1 deny host 10.10.10.10
R1(config)# access-list 1 permit 10.10.10.0 0.0.0.255
10.1.0.0/24
10.1.1.1/24 .1 .2
10.1.1.10 R1 R2
F0/0 F1/0 F1/0
10.1.1.11
RFC 1918 Private Addresses
The Internet Engineering Task Force (IETF) documents standards with
RFC’s (Requests For Comments)
RFC 1918 specifies private IP address ranges which are not routable on
the public internet
RFC 1918 Private Addresses
Private addresses were originally designed for hosts which should have
no internet connectivity
Public IP addresses cost money
If an organisation has a part of their network where the hosts need to
communicate with each other over IP, but do not require connectivity
to the Internet, they can assign private IP addresses
RFC 1918 Private Addresses
There is a range of private addresses in each address class.
10.0.0.0 – 10.255.255.255
‒ 10.0.0.0/8
‒ 10.0.0.0 255.0.0.0
172.16.0.0 – 172.31.255.255
‒ 172.16.0.0/12
‒ 172.16.0.0 255.240.0.0
192.168.0.0 – 192.168.255.255
‒ 192.168.0.0/16
‒ 192.168.0.0 255.255.0.0
The IPv4 Global Address Space Problem
The designers of IPv4 did not envision the explosive growth of its use
4.3 billion addresses seemed more than enough
The protocol is not particularly efficient in its use of the available
space, with many addresses being wasted
IPv6
The Internet authorities started to predict address exhaustion in the
late 1980’s, and IPv6 was developed in the 90’s as the long term
solution
IPv6 uses a 128 bit address, compared to IPv4’s 32 bit address
IPv6 provides more than 7.9×1028 times as many addresses as IPv4
The IPv6 Problem and NAT
There is not a seamless migration path from IPv4 to IPv6
NAT (Network Address Translation) was implemented as a temporary
workaround to mitigate the lack of IPv4 addresses until organisations
had time to migrate to IPv6
The IPv6 Problem and NAT
An organisation can use private IP addresses on their inside network,
but still grant their hosts Internet access by translating them to their
outside public IP addresses
Many hosts on the inside can share a few or a single public IP address
on the outside
Private Addresses and NAT
Office A Office B
Internet
Public Public
203.0.113.1/28 203.0.113.16/29
14 Addresses 6 Addresses
Private Private
192.168.10.0/24 192.168.10.0/24
200 Hosts 100 Hosts
Today’s Networks
Many industry experts predicted in the early 2000’s that IPv6 would be
ubiquitous within a few years
It hasn’t worked out that way – most enterprises today use RFC 1918
IPv4 addresses with NAT
RFC 1918 has the security benefit of hiding inside hosts by default
(they don’t have a publicly routable IP address), plus network
engineers have more experience with IPv4 than v6
NAT Types
Static NAT – permanent one-to-one mapping usually between a
public and private IP address. Used for servers which must accept
incoming connections.
Dynamic NAT – uses a pool of public addresses which are given out on
an as needed first come first served basis. Usually used for internal
hosts which need to connect to the Internet but do not accept
incoming connections.
PAT (Port Address Translation)– allows the same IP address to be
reused.
NAT Lab
Static NAT Scenario
We have bought the range of public IP addresses 203.0.113.0/28 from
our service provider
203.0.113.2 is used on the outside interface on our Internet edge
router R1
203.0.113.1 is used as the default gateway address. It is the SP1 router
on the other side of the link
203.0.113.3 – 203.0.113.14 remain available
Static NAT Scenario
Int-S1 at 10.0.1.10 is an internal web server which needs to accept
incoming connections from the Internet
We need to assign a fixed public IP address to accept incoming
connections. We will use the first available address 203.0.113.3
A static NAT translation is required to translate the public IP address
203.0.113.3 on F0/0 to 10.0.1.10 on F1/0 for incoming connections
The translation is bidirectional so will also translate 10.0.1.10 to
203.0.113.3 for outbound traffic from the server
Static NAT Configuration
R1(config)#int f0/0
R1(config-if)#ip nat outside
R1(config)#int f1/0
R1(config-if)#ip nat inside
Company A Company B
A1 B1
R1
10.10.10.0/24 10.10.10.0/24
NAT: 10.10.20.0/24 NAT: 10.10.30.0/24
Company A Company B
A1 B1
R1
10.10.10.0/24 10.10.10.0/24
Create an access list which references the internal IP addresses we want to translate.
R1(config)#access-list 1 permit 10.0.2.0 0.0.0.255
Associate the access list with the NAT pool to complete the configuration.
R1(config)#ip nat inside source list 1 pool Flackbox
NAT Verification – show ip nat translation
clear ip nat translation
R1#clear ip nat translation can be used to remove
translations from the translation table
This can be useful when troubleshooting
It is also often required if you want to edit your NAT configuration –
the router will not allow changes when there are active translations
clear ip nat translation * will remove all dynamic
translations
NAT Verification – show ip nat statistics
R1#show ip nat statistics
Total active translations: 2 (0 static, 2 dynamic; 2 extended)
Outside interfaces:
FastEthernet0/0
Inside interfaces:
FastEthernet2/0
Hits: 148 Misses: 0
CEF Translated packets: 148, CEF Punted packets: 0
Expired translations: 7
Dynamic mappings:
-- Inside Source
[Id: 2] access-list 1 interface FastEthernet0/0 refcount 2
nat-limit statistics:
max entry: max allowed 0, used 0, missed 0
NAT Types
Static NAT – permanent one-to-one mapping usually between a public
and private IP address. Used for servers which must accept incoming
connections.
Dynamic NAT – uses a pool of public addresses which are given out on
an as needed first come first served basis. Usually used for internal
hosts which need to connect to the Internet but do not accept
incoming connections.
PAT (Port Address Translation)– allows the same IP address to be
reused.
Dynamic NAT Address Exhaustion
With standard dynamic NAT the inside hosts are translated to public IP
addresses on a first come first served basis when they send traffic out
This requires a public IP address for every inside host which
communicates with the outside network
When all the addresses in the pool have been used, new outbound
connections from other inside hosts will fail because there will be no
addresses left to translate them to
PAT Port Address Translation
Port Address Translation (PAT) is an extension to NAT that permits
multiple devices to be mapped to a single public IP address
With PAT you do not need a public IP address for every inside host
The router tracks translations by IP address and Layer 4 port number
Because different inside hosts are assigned different port numbers, the
router knows which host to send return traffic to, even when the
public IP address is the same
NAT Lab
Dynamic NAT with Overload
Dynamic NAT with Overload uses PAT to allow more clients to be
translated than IP addresses are available in the NAT pool
If the NAT pool is 203.0.113.4 to 203.0.113.6 for example, the first 2
hosts which initiate outbound connections will be translated to
203.0.113.4 and 203.0.113.5
Dynamic NAT with Overload
The 3rd host will be translated to 203.0.113.6 and the router will track
which source port number was used in the translation table
The 4th and 5th etc. hosts will also be translated to 203.0.113.6 but
with different source port numbers
When the return traffic is sent back the router checks the destination
port number to see which host to forward it to
Dynamic NAT with Overload
10.10.10.10 203.0.113.4:4096 > 203.0.113.10:80
203.0.113.10
10.10.10.11
10.10.10.12 203.0.113.11
10.10.10.13
10.10.10.12 203.0.113.11
10.10.10.13
10.10.10.12 203.0.113.11
10.10.10.13
10.10.10.12 203.0.113.11
10.10.10.13
10.10.10.12 203.0.113.11
203.0.113.6:4098 > 203.0.113.11:80
10.10.10.13
10.10.10.12 203.0.113.11
203.0.113.6:4098 < 203.0.113.11:80
10.10.10.13
10.10.10.12 203.0.113.11
10.10.10.12 203.0.113.11
Create an access list which references the internal IP addresses we want to translate.
R1(config)#access-list 1 permit 10.0.2.0 0.0.0.255
Associate the access list with the NAT pool to complete the configuration.
R1(config)#ip nat inside source list 1 pool Flackbox
Dynamic NAT with Overload Configuration
R1(config)#int f0/0
R1(config-if)#ip nat outside
R1(config)#int f2/0
R1(config-if)#ip nat inside
Create an access list which references the internal IP addresses we want to translate.
R1(config)#access-list 1 permit 10.0.2.0 0.0.0.255
Associate the access list with the NAT pool to complete the configuration.
R1(config)#ip nat inside source list 1 pool Flackbox overload
PAT with Single IP Address
The last NAT scenario to cover is a small office which has not
purchased a range of public IP addresses
In this case the outside interface will most likely get its IP address via
DHCP from the service provider
PAT can be used to allow multiple inside hosts to share the single
outside public IP address
PAT with Single IP Address
The configuration is very similar to Dynamic NAT with Overload but
translates to the outside interface address rather than a pool of
addresses
You must translate to the outside interface rather than a specific IP
address because a DHCP address can change
PAT with Single IP Address Configuration
R1(config)#int f0/0
R1(config-if)#ip address dhcp
R1(config-if)#ip nat outside
R1(config)#int f1/0
R1(config-if)#ip nat inside
Outbound
*Aug 21 23:52:55.739: NAT*: TCP s=52670->4097, d=23
*Aug 21 23:52:55.739: NAT*: s=10.0.2.11->203.0.113.13, d=203.0.113.20
[34332]
Return Traffic
*Aug 21 23:52:55.763: NAT*: TCP s=23, d=4097->52670
*Aug 21 23:52:55.763: NAT*: s=203.0.113.20, d=203.0.113.13->10.0.2.11
[45975]