Network Device Communication
The main function of a network is provide connectivity between devices.
- Each layer describes a specific function.
- Each layer can be modified or changed without requiring changes to the layers above or below it.
Layer 2 Forwarding
- Second layer of OSI model.
- Ethernet use MAC (Media Access Control) addresses.
- MAC address FF:FF:FF:FF:FF:FF will be processed by all network devices.
- By default broadcast are not forwarded beyond a Layer 3.
- Ethernet use CSMA/CD (Carrier Sense Multiple Access / Collision Detect).
- Hub: Repeat traffic out of every port –> Half duplex.
- Switch: Maintain a table associated with the host’s MAC connected to the port –> Full duplex.
- A frame is received by the switch and checks if the source MAC is in the MAC Table, if not its added.
- If the destination MAC of the frame is in the MAC table then is forwarded, if not it is flooded to all ports except the source port (no matter if already those ports have a MAC address in the MAC table).
- CAM is a high-speed memory.
- Logical segmentation by creating multiple broadcast domains on the same network switch.
- Inter VLAN communication is not possible via Layer 2 or broadcast traffic.
- 802.1Q standard.
- 32 bits are added to the packet header (12 of those bits are assigned to VLAN identifier).
- 802.1Q (Tag and Untagged) insert a field, modifies 802.3 frame (ethernet) and FCS must be recalculated.
VLAN configuration commands:
SW1# configure terminal SW1(config)# vlan 10 SW1(config-vlan)# name PHONES
SW1# show vlan SW1# show vlan brief SW1# show vlan summary
- Assigned to only one VLAN.
- The 802.1Q tags are not included in packets transmitted o received. (Untagged)
Configuring Access Port:
SW1# configure terminal SW1(config)# vlan 10 SW1(config-vlan)# name PHONES SW1(config-vlan)# interface g0/0 SW1(config-if)# switchport mode access SW1(config-if)# switchport access vlan 10
- Can carry multiple VLANs.
- Packets received in trunk link are tagged, then 802.1Q header are removed and traffic is forwarded to the next port (untagged).
Configuring a Trunk Port
SW1# configure terminal SW1(config)# interface g0/1 SW1(config-if)# switchport mode trunk
SW1# show interfaces trunk
Native and Allowed VLANs
- Traffic on a trunk port without 802.1Q tag (untagged) is associated to native VLAN.
- Default native VLAN is 1
- Native VLANs on a trunk link should match to expect a proper behavior of the network.
Configuring a Trunk Port
SW1# configure terminal SW1(config)# interface g0/1 SW1(config-if)# switchport mode trunk SW1(config-if)# switchport trunk native vlan 66 SW1(config-if)# switchport trunk allowed vlan 201,202,203,204
SW1# show mac address-table SW1# clear mac address-table SW1# show interface g0/0 switch port SW1# show interface status
Layer 3 Forwarding
- Packets must be routed when two devices are on different networks.
IP Address Assignment
- An IP address must be assigned to an interface for a router or multilayer switch to route packets.
- An interface with a configured IP address and is in an UP state injects the associated network into de router’s routing table – RIB (Routing Information Base).
- Connected networks or router have an administrative distance (AD) of zero.
- It is not possible for any other routing protocol to preempt a connected route in the RIB.
Assigning IP Address to an Interface:
R1# configure terminal R1(config)# interface g0/1 R1(config-if)# ip address 10.10.10.254 255.255.255.0 R1(config-if)# ip address 192.168.1.254 255.255.255.0 secondary
- Used in router-in-stick inter VLAN communication.
- The sub-interface number does not have to match VLAN ID, but it helps with operational support.
Configuring Routed Sub-interfaces:
R1# configure terminal R1(config)# interface g0/1.10 R1(config-if)# encapsulation dot1Q 10 R1(config-if)# ip address 10.10.10.1 255.255.255.0 R1(config)# interface g0/1.20 R1(config-if)# encapsulation dot1Q 20 R1(config-if)# ip address 10.20.20.1 255.255.255.0
Switched Virtual Interfaces (SVI)
- Used in multilayer switches (can route packets).
- No need for an external router.
- Assign an IP to a VLAN interface.
- The switch MUST have an interface associated to that VLAN in an UP state.
Creating a Switched Virtual Interface (SVI)
SW1# configure terminal SW1(config)# interface vlan 10 SW1(config-if)# ip address 10.10.10.1 255.255.255.0 SW1(config-if)# no shutdown
Routed Switch Ports
- Used when there is a need to configure a point to point link between a switch and a router.
- Is not recommended to use a VLAN to accomplish this because there is always the potential that the used VLAN could exist elsewhere in the Layer 2 realm or that spanning tree could impact the topology.
Configuring a Routed Switch Port
SW1# configure terminal SW1(config)# interface g0/1 SW1(config-if)# no switchport SW1(config-if)# ip address 10.10.10.1 255.255.255.0 SW1(config-if)# no shutdown