# Virtual LANs and VLAN Trunking

Using VLAN Database Mode to Create VLANs

Only normal-range VLANs (1-1005) can be configured and stored in a flash file called vlan.dat.

Switch# vlan database
Switch(vlan)# vlan 10 name ccie
Switch(vlan)# show current ! proposed or difference
Switch(vlan)# show proposed
Switch(vlan)# apply ! reset or abort

Private VLANs

A private VLAN has a primary VLAN and one or more secondary VLANs.
The ports in the primary VLAN are promiscuous.
Secondary VLANs are community VLANs or isolated VLANs.

VLAN Trunking Protocol

VTP advertises the VLAN ID, VLAN name and VLAN media type (Ethernet, FDDI, Token Ring).

VTP Modes: Server (default mode), Client, Transparent and off (only in CatOS).

Originates VTP advertisements: server and client
Processes received advertisements to update its VLAN configuration: server and client
Forwards received VTP advertisements: server, client and transparent
Saves VLAN configuration in NVRAM or vlan.dat: server, client and transparent
Can create, modify or delete VLANs using configuration commands: server and transparent

VTP Process

VTP server needs a VTP domain name before to start sending VTP updates.
A VTP client without a VTP domain will assume the VTP domain in the first received VTP update.
VTP configuration is stored in vlan.dat (flash memory).

VTP updates are propagated throughout trunk ports.

If md5 is configured then the VTP advertisement carries the validation (hash) of the VTP update.

VTP Configuration

Server and client switches must match the same VTP version.
Transparent switches at version 2 forward version 1 (default version) or 2 VTP updates.

Pruning (disabled by default) prevents flooding on a per-VLAN basis. When pruning is enabled on a VTP server, pruning is enable for the entire VTP domain. VLANs 1, 1002-1005 and 1006-4094 (extended-range) are pruning-ineligible.

Normal-Range and extended-range VLANs

Normal-range VLANs (1-1005) can be configured in VLAN database mode with the details stored in vlan.dat (flash memory).
Extended-range VLANs (1006-4096) cannot be configured in VLAN database mode, nor stored in vlan.dat, nor advertised via VTP. In fact, to configure then, the switch must be in VTP transparent mode.

Storing VLAN configuration

Normal-range VLANs can be configured from VLAN database mode or configuration mode (server and transparent).
Extended-range VLANs can only be configured from configuration mode (transparent).
VTP and normal-range VLAN configuration are stored in vlan.dat (server and transparent) and NVRAM (transparent). If VTP mode or domain name in vlan.dat file and startup-config file differ, the switch uses only the vlan.dat file for VLAN configuration.
Extended-range VLAN configuration are only stored in NVRAM (transparent).

ISL and 802.1Q Concepts

Support normal and extended range (ISL, 802.1Q)
ISL is a protocol defined by Cisco. 802.1Q by IEEE.
ISL encapsulates the original frame. 802.1Q inserts a tag.
ISL does not support native VLAN but 802.1Q does.

ISL adds a new 26 byte header and a 4 byte trailer (new CRC).
This header uses the source address of the device doing the trunk and a multicast destination address (0100.0C00.0000 or 0300.0C00.0000).

802.1Q inserts a 4 byte tag (Etype and Tag), right after the source address, and a new calculated FCS.
With an 802.1Q tag, the first 2 bytes are a registered Ethernet type (0x8100) and the last 2 bytes contain the priority and VLAN-ID.

ISL and 802.1Q Configuration

Switches default to use the DTP desirable mode.
If both switches support both types of trunking, they negotiate to use ISL.

Allowed, Active and Pruned VLANs

Allowed VLANs are those allowed by using the switchport trunk allowed command.
Allowed and active are those VLANs configured on the switch.
Active and pruned are those with any VTP-pruned VLANs removed.

Trunk Configuration Compatibility

trunk = switchport mode trunk
trunk+DTP = switchport mode trunk; switchport nonegotiate
desirable = switchport mode dynamic desirable
auto = switchport mode dynamic auto
access = switchport mode access
access+DTP = switchport mode access; switchport nonegotiate

trunk  trunk+DTP  desirable   auto    access   access+DTP
trunk       trunk  trunk      fail        fail    fail     fail
trunk+DTP   trunk  trunk      trunk       trunk   fail     fail
desirable   fail   trunk      trunk       trunk   access   access
auto        fail   trunk      trunk       access  access   access
access      fail   fail       access      access  access   access
access+DTP  fail   fail       access      access  access   access

isl = switchport trunk encapsulation isl
dot1q = switchport trunk encapsulation dot1q
negotiate = switchport trunk encapsulation negotiate

isl   dot1q   negotiate
isl       isl   fail    isl
dot1q     fail  dot1q   dot1q
negotiate isl   dot1q   isl->dot1q

Configuring Trunking on Routers

Routers and hosts do not support DTP.

ISL configuration:

Router(config)# interface fa0/1.1
Router(config-if)# ip address 10.1.1.1 255.255.255.0
Router(config-if)# encapsulation isl 11
Router(config)# interface fa0/1.2
Router(config-if)# ip address 10.1.2.1 255.255.255.0
Router(config-if)# encapsulation isl 12

802.1Q configuration:

Router(config)# interface fa0/2
Router(config-if)# description native_vlan_1
Router(config-if)# ip address 10.2.0.1 255.255.255.0
Router(config)# interface fa0/2.1
Router(config-if)# ip address 10.2.1.1 255.255.255.0
Router(config-if)# encapsulation dot1q 21 ! [native]
Router(config)# interface fa0/2.2
Router(config-if)# ip address 10.2.2.1 255.255.255.0
Router(config-if)# encapsulation dot1q 22

802.1Q-in-Q Tunneling

SwitchSP1(config)# interface fa0/1
SwitchSP1(config-if)# description to_SwitchCustomer1
SwitchSP1(config-if)# switchport access vlan 10
SwitchSP1(config-if)# switchport mode dot1q-tunnel
SwitchSP1(config-if)# no l2protocol-tunnel cdp ! enables cdp, stp and vtp
SwitchSP1(config)# interface fa0/2
SwitchSP1(config-if)# description to_SwitchCustomer2
SwitchSP1(config-if)# switchport access vlan 20
SwitchSP1(config-if)# switchport mode dot1q-tunnel
SwitchSP1(config-if)# no l2protocol-tunnel cdp ! enables cdp, stp and vtp
SwitchSP1(config)# interface fa0/3
SwitchSP1(config-if)# description to_SwitchSP2
SwitchSP1(config-if)# switchport mode trunk
SwitchSP1(config-if)# switchport trunk encapsulation dot1q

SwitchSP2(config)# interface fa0/1
SwitchSP2(config-if)# description to_SwitchCustomer1
SwitchSP2(config-if)# switchport access vlan 10
SwitchSP2(config-if)# switchport mode dot1q-tunnel
SwitchSP2(config-if)# no l2protocol-tunnel cdp ! enables cdp, stp and vtp
SwitchSP2(config)# interface fa0/2
SwitchSP2(config-if)# description to_SwitchCustomer2
SwitchSP2(config-if)# switchport access vlan 20
SwitchSP2(config-if)# switchport mode dot1q-tunnel
SwitchSP2(config-if)# no l2protocol-tunnel cdp ! enables cdp, stp and vtp
SwitchSP2(config)# interface fa0/3
SwitchSP2(config-if)# description to_SwitchSP1
SwitchSP2(config-if)# switchport mode trunk
SwitchSP2(config-if)# switchport trunk encapsulation dot1q

Configuring PPPoE

ISP(config)# ip local pool MyPool 10.0.0.2 10.0.0.254
ISP(config)# bba-group pppoe MyGroup
ISP(config-bba-group)# virtual-template 1
ISP(config-bba-group)# sessions per-mac limit 2
ISP(config)# interface virtual-template 1
ISP(config-if)# ip address 10.0.0.1 255.255.255.0
ISP(config-if)# peer default ip address pool MyPool
ISP(config-if)# ppp authentication chap callin
ISP(config)# interface f0/0
ISP(config-if)# no ip address
ISP(config-if)# pppoe enable group MyGroup
ISP(config-if)# no shutdown
ISP(config)# username CPE password MyPassword

CPE(config)# interface dialer1
CPE(config-if)# dialer pool 1
CPE(config-if)# dialer-group 1
CPE(config-if)# encapsulation ppp
CPE(config-if)# ip address negotiated
CPE(config-if)# ppp chap password MyPassword
CPE(config-if)# mtu 1492
CPE(config)# interface f0/0
CPE(config-if)# no ip address
CPE(config-if)# pppoe enable
CPE(config-if)# pppoe-client dial-pool-number 1
CPE(config-if)# no shutdown
CPE(config)# dialer-list 1 protocol ip permit

# Download and convert youtube videos

Introduction

youtube-dl

Install dependencies and youtube-dl python script

# apt-get install ffmpeg lame libavcodec-extra-53
# apt-get install youtube-dl

Download a list of videos and convert them to mp3 files

# echo "http://www.youtube.com/watch?v=6cz1MbifOtU
> http://www.youtube.com/watch?v=woy6vdMT40U
> http://www.youtube.com/watch?v=9B0vzmowxkU
> http://www.youtube.com/watch?v=HGJWhltJ2JA
> http://www.youtube.com/watch?v=epcn7YEO8M8
> http://www.youtube.com/watch?v=ark-1xpvt2A
> http://www.youtube.com/watch?v=bkGC-wo2t1o
> http://www.youtube.com/watch?v=7s2vHx2VE9Y
> http://www.youtube.com/watch?v=KstbKNpmy3A
> http://www.youtube.com/watch?v=nGUzPk6srTU
> http://www.youtube.com/watch?v=aejsavfztzI
> http://www.youtube.com/watch?v=8lMIPBAJWGQ
> http://www.youtube.com/watch?v=0btmw2E10n0
> http://www.youtube.com/watch?v=Iidnp3vgqFw
> http://www.youtube.com/watch?v=Mhk8IyWsgeM
> http://www.youtube.com/watch?v=oi0XJWWFZA4
> http://www.youtube.com/watch?v=WRBBCUGUwwQ
> http://www.youtube.com/watch?v=2YIoP4HgZjA
> http://www.youtube.com/watch?v=WXa0rNgNyfA
> http://www.youtube.com/watch?v=qpUNdnR7Sjw" | \
> xargs -I {} youtube-dl -t --extract-audio --audio-format mp3 {}
[youtube] Setting language
[youtube] 6cz1MbifOtU: Downloading video webpage
[youtube] 6cz1MbifOtU: Downloading video info webpage
[youtube] 6cz1MbifOtU: Extracting video information
[download] Destination: David_Guetta_DJ_MIX_a_Flaix_fm_Sessio_25_2_2012_1-6cz1MbifOtU.webm
[download]  42.9% of 25.63M at    1.76M/s ETA 00:08
...

# GCC on Iphone

# apt-get install csu
# apt-get install ldid
# wget http://iphone-gcc-full.googlecode.com/files/libgcc.deb
# wget http://iphone-gcc-full.googlecode.com/files/iphone-gcc.deb
# wget http://iphone-gcc-full.googlecode.com/files/headers-libs.deb
# dpkg --install libgcc.deb
# dpkg --install --force-overwrite iphone-gcc.deb
# dpkg --install headers-libs.deb
# gcc -o helloworld helloworld
# ldid -S helloworld
# ./helloworld

# Ethernet basics

RJ-45 pinouts

EIA/TIA defines the cabling specifications for Ethernet, including the pinouts for RJ-45:

T568A - Pair 1 (4,5) Pair 2 (3,6) Pair 3 (1,2) Pair 4 (7,8)
T568B - Pair 1 (4,5) Pair 2 (1,2) Pair 3 (3,6) Pair 4 (7,8)

PC transmission uses pins 1 and 2, reception uses pins 3 and 6.
Switch transmission uses pins 3 and 6, and reception uses pins 1 and 2.

Auto-MDIX (Automatic Medium-Dependent Interface Crossover) is a feature not supported on all switch models.

Auto-negotiation, speed and duplex

By default, each Cisco switch uses auto-negotiation:

- Speed detection is based on FLP (Fast Link Pulses) when both ends uses auto-negotiation and based on incoming electrical signal if the other end does not use auto-negotiation.

- Duplex detection is based on auto-negotiation only.

If both ends use auto-negotiation then full duplex mode is used.
If only one end uses auto-negotiation then if speed is 10Mbps or 100Mbps the end with auto-negotiation uses half duplex, if speed is 1000Mbps the end with auto-negotiation uses full duplex.
To disable auto-negotiation you statically configure speed and duplex settings.

CSMA/CD

Carrier Sense Multiple Access with Collision Detection algorithm:

- The sender begins sending a frame and listens to make sure that no collision occurred.
- If there was a collision, all stations that sent a frame send a jamming signal.
- After the jamming signal, each sender randomizes a timer and waits that long before resending.

Collision Domains and Switch Buffering

Switches store frames in memory buffers to prevent collisions.
NICs operating in HDX mode use a loopback circuitry when transmitting a frame. The combined looped-back signal and the received signal allows the NIC to detect the collision.

Basic Switch Port Configuration

Switch(config-if)# speed ?
  10    Force 10 Mbps operation
  100   Force 100 Mbps operation
  auto  Enable AUTO speed configuration
Switch(config-if)# duplex ?
  auto  Enable AUTO duplex configuration
  full  Force full duplex operation
  half  Force half-duplex operation

Bables: frames longer than 1518 bytes in size.
Late collision: detected after the first 64 bytes.
Deferred: found the carrier busy at the first attempt.

Ethernet Layer 2: Framing and Addressing

- DIX Ethernet v2 and revised IEEE 802.3

Preamble (8B) Destination Address (6B) Source Address (6B) Type/Length (2B) ! 802.3
Data (var)
FCS (4B) ! 802.3

- Original IEEE 802.3

Preamble (7B) SFD (1B) Destination Address (6B) Source Address (6B) Length (2B) ! 802.3
DSAP (1B) SSAP (1B) Control (1-2B) ! 802.2
Data (var)
FCS (4B) ! 802.3

- IEEE 802.3 with SNAP header

Preamble (7B) SFD (1B) Destination Address (6B) Source Address (6B) Length (2B) ! 802.3
DSAP (1B) SSAP (1B) Control (1-2B) ! 802.2
OUI (3B) TYPE (2B) ! SNAP
Data (var)
FCS (4B) ! 802.3

If Type/Length is >= 1536 then is a DIX frame (Type) else is a IEEE frame (Length).
DSAP (Destination Service Access Point)
SSAP (Source Service Access Point)
If DSAP == 0xAA and SSAP == 0xAA and Control == 0x03 then there is a SNAP header.
OUI (Organizationally Unique Identifier) represents the manufacturer of the sender Ethernet NIC.

Types of Ethernet Addresses

Unicast: I/G bit = 0
Broadcast: 0XFFFFFFFFFFFF
Multicast: I/G bit = 1

Ethernet Address Formats

1B 2B 3B ! OUI
4B 5B 6B ! Vendor-Assigned

1B is the most significant byte.
6B is the least significant byte.

1b 2b 3b 4b 5b 6b 7b 8b

8b is the most significant bit and I/G (Individual/Group) bit.
7b is the U/L (Universal/Local) bit.

If I/G == 0 then is a Unicast MAC address else is a Broadcast/Multicast MAC address.
If U/L == 0 then is a Vendor-Assined MAC address else is a Administratively-Assigned MAC address.

Switching and Bridgind Logic

The default MAC address aging time is 300 seconds (5 minuts).
Store-and-forward: receives all bits in the frame (store) before forwarding (check FCS).
Cut-through: forwards the frame as soon as the Destination Address field is received.
Fragment-free: forwards the frame as soon as the first 64 bytes are received.

SPAN, RSPAN and ERSPAN

SPAN: Switch Port ANalyzer
RSPAN: Remote SPAN
ERSPAN: Encapsulated RSPAN (GRE tunnel)

A SPAN source port:

- Can be any type of port (routed, switched, access, trunk, etherchannel, ...)
- Can be one or more ports OR one or more VLANs, but not a mix.

A SPAN destination port:

- Does not support CDP, STP, VTP or DTP.
- Overwrites its original configuration until the destination of the session is removed.

Up to 64 SPAN destination ports on a switch.
Only one SPAN/RSPAN session can send traffic to a single destination port.
Traffic routed from another VLAN to a source VLAN can not be monitored with SPAN.
For RX SPAN, each frame is copied before any modification.
For TX SPAN, each frame is copied after any modification, not all frames match the orginal frames exactly.
SPAN/RSPAN ignores CDP, STP BPDU, VTP or DTP, so use encapsulation replicate in order to forward these frames.

Basic SPAN Configuration

Switch(config)# monitor session 1 source interface fa0/10
Switch(config)# monitor session 1 destination interface fa0/24

Complex SPAN Configuration

Switch(config)# monitor session 1 source interface fa0/10 rx
Switch(config)# monitor session 1 source interface fa0/11 tx
Switch(config)# monitor session 1 source interface fa0/12 ! Trunk port
Switch(config)# monitor session 1 filter vlan 1-3,10 interface fa0/11 tx ! Only VLANs 1, 2, 3 and 10
Switch(config)# monitor session 1 destination interface fa0/24 encapsulation replicate

RSPAN Configuration

Switch1(config)# vlan 10
Switch1(config-vlan)# remote span
Switch1(config)# monitor session 1 source vlan 1-5
Switch1(config)# monitor session 1 destination remote vlan 10

Switch2(config)# vlan 10
Switch2(config-vlan)# remote span
Switch2(config)# monitor session 2 source remote vlan 10
Switch2(config)# monitor session 2 destination interface fa0/24

Ethernet Standards

10BASE5 - Thick coaxial - 500m
10BASE2 - Thin coaxial - 185m
10BASE-T - UTP cat 3, 4, 5, 5e, 6 - 100m
100BASE-FX - MM fiber - 400m
100BASE-T4 - UTP cat 3, 4, 5, 5e, 6 (4 pair) - 100m
100BASE-TX - UTP cat 5, 5e, 6, or STP (2 pair) - 100m
1000BASE-LX - Long wavelenght laser, SM or MM fiber - 10km or 3km
1000BASE-SX - Short wavelenght laser, MM fiber - 220m or 550m
1000BASE-ZX - Extended wavelenght laser, SM fiber - 100km
1000BASE-CS - STP (2 pair) - 25m
1000BASE-T - UTP cat 5, 5e, 6 (4 pair) - 100m

IEEE 802.3u: Fast Ethernet over copper and optical cabling
IEEE 802.3z: Gigabit Ethernet over optical cabling
IEEE 802.3ab: Gigabit Ethernet over copper cabling

# Multiple terminals with screen

Multiple terminals
# cat multiple_terminals.screen
bindkey -k k5 focus up # Previous region
bindkey -k k6 focus down # Next region
bindkey -k kP copy # Scrollback on (up)
bindkey -k kN copy # Scrollback on (down)
bindkey "^[" quit # ESC to quit

defscrollback 10000

split
split
split

screen -t Terminal-0 tail -f /var/log/syslog
focus down

screen -t Terminal-1 tail -f /var/log/messages
focus down

screen -t Terminal-2 tail -f /var/log/auth.log
focus down

screen -t Terminal-3 tail -f /var/log/error
focus top
# screen -S screen_tail -c multiple_terminals.screen

Some key bindings

Ctrl+a \ (quit) Kill all windows and terminate screen
Ctrl+a tab (focus) Switch the input focus to the next region
Ctrl+a n (next) Switch to the next window
Ctrl+a p (prev) witch to the previous window
Ctrl+a w (windows) Show a list of window
Ctrl+a [ (copy) Enter copy/scrollback mode
Ctrl+a ] (paste) Write the contents of the paste buffer to the stdin queue of the current window
Ctrl+a ? (help) Show key bindings

More information
# man screen

# Syslog on iPhone

/var/log/syslog
# echo "*.* /var/log/syslog" > /etc/syslog.conf
# cd /System/Library/LaunchDaemons
# plutil -convert xml1 com.apple.syslogd.plist
# sed -i '/<string>\/usr\/sbin\/syslogd<\/string>/ a \
> \t\t<string>-bsd_out</string>\n\t\t<string>1</string>' com.apple.syslogd.plist.backup
# plutil -convert binary1 com.apple.syslogd.plist
# reboot
# tail -f /var/log/syslog
Socat
# socat - UNIX-CONNECT:/var/run/lockdown/syslog.sock
> help
> watch

# SNMPv3 configuration

IOS configuration
Router(config)# ip access-list standard SNMP_MANAGERS
Router(config-std-nacl)# permit host 192.168.1.100
Router(config-std-nacl)# permit host 192.168.1.101
Router(config)# snmp-server view READ_VIEW iso included
Router(config)# snmp-server group READ_GROUP v3 priv read READ_VIEW access SNMP:MANAGERS
Router(config)# snmp-server user SNMPv3_USER READ_GROUP v3 auth md5 MD5_auth_KEY priv des DES_priv_KEY
Check
# snmpwalk -v 3 -u SNMPv3_USER -l authPriv -a md5 -A MD5_auth_KEY -x des -X DES_priv_KEY 192.168.50.1 .1

# Telephony Features

Configuring a Voice Network Directory
CME(config)# ephone-dn 20
CME(config-ephone-dn)# name Joshua Bellman
CME(config)# ephone-dn 21
CME(config-ephone-dn)# name Ruth Hopper
CME(config)# ephone-dn 22
CME(config-ephone-dn)# name Esther Billford
CME(config)# ephone-dn 23
CME(config-ephone-dn)# name Job Smith
CME(config)# ephone-dn 24
CME(config-ephone-dn)# name Samuel Oldham
CME(config-telephony)# directory last-name-first
CME(config-telephony)# directory entry 1 1599 name Fax Corporate
Forwarding Calls
CME(config)# ephone-dn 21
CME(config-ephone-dn)# call-forward max-length 4
CME(config-ephone-dn)# call-forward busy 1599
CME(config-ephone-dn)# call-forward noan 1599 timeout 25
CME(config-telephony)# call-forward pattern 15.. ! H.450.3 support
Configuring Call Transfer
CME(config-telephony)# transfer-system full-consult
CME(config-telephony)# transfer-pattern 5...
CME(config-telephony)# transfer-pattern 9..........
Configuring Call Park
CME(config)# ephone-dn 50
CME(config-ephone-dn)# number 3001
CME(config-ephone-dn)# name Maintenance
CME(config-ephone-dn)# park-slot
Configuring Call Pickup
CME(config)# ephone-dn 1
CME(config-ephone-dn)# pickup-group 5509
CME(config)# ephone-dn 2
CME(config-ephone-dn)# pickup-group 5509
Configuring Intercom
CME(config)# ephone-dn 60
CME(config-ephone-dn)# number A100
CME(config-ephone-dn)# intercom A101 label “Manager”
CME(config)# ephone-dn 61
CME(config-ephone-dn)# number A101
CME(config-ephone-dn)# intercom A100 label “Assistant”
CME(config)# ephone 1
CME(config-ephone)# button 2:60
CME(config-ephone)# restart
CME(config)# ephone 2
CME(config-ephone)# button 2:61
CME(config-ephone)# restart
Configuring Paging
CME(config)# ephone-dn 80
CME(config-ephone-dn)# number 5555
CME(config-ephone-dn)# paging
CME(config)# ephone-dn 81
CME(config-ephone-dn)# paging ip 239.1.1.100 port 2000
CME(config)# ephone 1
CME(config-ephone)# paging-dn 80
CME(config)# ephone 2
CME(config-ephone)# paging-dn 80
Configuring After-Hours Call Blocking
CME(config-telephony)# after-hours day mon 17:00 8:00
CME(config-telephony)# after-hours day tue 17:00 8:00
CME(config-telephony)# after-hours day wed 17:00 8:00
CME(config-telephony)# after-hours day thu 17:00 8:00
CME(config-telephony)# after-hours day fri 17:00 8:00
CME(config-telephony)# after-hours date dec 25 00:00 00:00
CME(config-telephony)# after-hours date jan 1 00:00 00:00
CME(config-telephony)# after-hours block pattern 1 91..........
CME(config-telephony)# after-hours block pattern 2 9011T
CME(config-telephony)# after-hours block pattern 3 91900....... 7-24
CME(config)# ephone 1
CME(config-ephone)# after-hour exempt
CME(config)# ephone 2
CME(config-ephone)# pin 1234
CME(config-telephony)# login timeout 120 clear 23:00
Configuring Call Detail Records (CDR) and Call Accounting
CME(config)# logging buffered 512000
CME(config)# dial-control-mib retain-timer 10080
CME(config)# dial-control-mib max-size 700
CME(config)# gw-accounting syslog
CME(config)# logging 172.30.100.101
Configuring Music on Hold (MoH)
CME(config-telephony)# moh ludovico_einaudi.wav
CME(config-telephony)# multicast moh 239.1.1.55 port 2123
Configuring Single Number Reach (SNR)
CME(config)# ephone-dn 2 dual-line
CME(config-ephone)# snr 12345556789 delay 8 timeout 30 cfwd-noan 2000
CME(config-ephone)# mobility

# Class of Restriction (COR) lists

Two rules

Rule 1: If there is no outgoing COR list applied, the call is always routed.
Rule 2: If there is no incoming COR list applied, the call is always routed.

Defining COR List Tags
CME(config)# dial-peer cor custom
CME(config-dp-cor)# name 911
CME(config-dp-cor)# name LOCAL
CME(config-dp-cor)# name LD

Creating Outgoing COR Lists
CME(config)# dial-peer cor list 911-CALL
CME(config-dp-corlist)# member 911
CME(config)# dial-peer cor list LOCAL-CALL
CME(config-dp-corlist)# member LOCAL
CME(config)# dial-peer cor list LD-CALL
CME(config-dp-corlist)# member LD

Creating Incoming COR Lists
CME(config)# dial-peer cor list 911-ONLY
CME(config-dp-corlist)# member 911
CME(config)# dial-peer cor list 911-LOCAL
CME(config-dp-corlist)# member 911
CME(config-dp-corlist)# member LOCAL
CME(config)# dial-peer cor list 911-LOCAL-LD
CME(config-dp-corlist)# member 911
CME(config-dp-corlist)# member LOCAL
CME(config-dp-corlist)# member LD

Assigning Outbound and Inbound COR Lists
CME(config)# dial-peer voice 10 pots
CME(config-dial-peer)# corlist outgoing 911-CALL
CME(config)# dial-peer voice 11 pots
CME(config-dial-peer)# corlist outgoing LOCAL-CALL
CME(config)# dial-peer voice 12 pots
CME(config-dial-peer)# corlist outgoing LD-CALL
CME(config)# ephone-dn 1
CME(config-ephone-dn)# corlist incoming 911-ONLY
CME(config)# ephone-dn 2
CME(config-ephone-dn)# corlist incoming 911-LOCAL
CME(config)# ephone-dn 3
CME(config-ephone-dn)# corlist incoming 911-LOCAL-LD

# Configuring dial peers

POTS Dial Peers
CME_A(config)# dial-peer voice 1101 pots
CME_A(config-dial-peer)# destination-pattern 1101
CME_A(config-dial-peer)# port 0/0/0 FXS Port
CME_A(config)# dial-peer voice 1102 pots
CME_A(config-dial-peer)# destination-pattern 1102
CME_A(config-dial-peer)# port 0/0/1 ! FXS Port
CME_B(config)# dial-peer voice 2000 pots
CME_B(config-dial-peer)# destination-pattern 2...
CME_B(config-dial-peer)# no digit-strip
CME_B(config-dial-peer)# port 1/0:23 ! T1 Interface
Configuring VoIP Dial Peers
CME_A(config)# dial-peer voice 2000 voip
CME_A(config-dial-peer)# destination-pattern 2...
CME_A(config-dial-peer)# session target ipv4:10.1.1.2
CME_A(config-dial-peer)# codec g711ulaw
CME_B(config)# dial-peer voice 1100 voip
CME_B(config-dial-peer)# destination-pattern 110.
CME_B(config-dial-peer)# session target ipv4:10.1.1.1
CME_B(config-dial-peer)# codec g711ulaw