Networking 201

VlANs,802.1q tagging- Networking 201

Sometimes it is advantageous to break up a single Layer 2 broadcast domain into multiple Layer 2 broadcast domains.If multiple Layer 3 networks need to be used,instead of using multiple switches for each layer 2 segment,it is possible to divide a single VLAN-Capable switch into two or more “virtual” switches,This is possible due to the concept of VLAN,which stands for “virtual LAN”

To communicate between the Layer 3 networks mapped to their individual VLANs, packets need to pass through a router or other Layer 3 device. If one has a switch with many VLANS implemented on it,either of these two methods could work:

1. Devote a switch interface per VLAN, with a single link for each VLAN. This is the simplest method, but the most wasteful of switch and router interface
2. "Trunk" multiple VLANs over on physical link,which only requires a single interface per side(switch to router,or server to switch).This method multiplexes multiple VLANs over the one link by "tagging" the frame with a 4-byte VLAN identifier field which is inserted after the destionation MAC field in the Ethernet header.This tagging format is offically defined by the IEEE's 802.1q protocol ,The tag is stripped of by the receiving trunk interface,and the frame placed on the proper VLAN on the receiving device.

The VLAN identifier must be between 1 and 4094 inclusive. The 802.1q tag also provides for a 3-bit priority(first at all) field and 1-bit discard(throw it) eligibility(zi ge) field which can be used for Qos application.The trunking and priority functions of 802.1q can be enabled and disabled separately.

Spanning Tree

As networks and broadcast domains grow and become more complex, ti becomes much easier to intentionally or unintentionally create loops-multiple network paths between one or more switches. Thes loops may lead to a infinite forwarding of Ethernet packets.causing switches to be overwhelmed by an ever-increasing amount of packets being forwarded to all other switches in the broadcast domain. To address this concern,Spanning Tree Protocol(STP) was invented as a standard protocol used by Ethernet switches,designed to provent such loops in broadcast domains.

To disable loops,each switch that implements Spanning Tree Protocol(STP) will participate in eleting a “root” device where the Spanning Tree is calculated from. Once the root is chosen,all other participating switches will calculate their last-cost path for each of its ports to the root device.

Routing

When a network is subdivided into multiple Layer 2 broadcast domains, Layer 3 addressing enables hosts to communicate with another host in another broadcast domain.

The process of forwarding packets from one layer 2 subdomain to another layer 2 subdomain using layer 3 address is called routing.

Routers may user many different ways to forward packets but these methods can be categorized into two types.

Static Routing

The method of using manually configured router is called static routing

Typically, there are three pieces of information that are needed to specify a static route:

1. the destination subnet
2. the latter's subnet mask and
3. the nexe hop host or outgoing interface

e.g.: ip route add 10.10.20.0/24 via 192.168.2.1

e.g. in Cisco IOS: ip route 10.10.20.0 255.255.255.0 Serial10/0/1

Static routes don’t change when the network changes but can be useful in cases where the network is small enough that it outweighs the cost of dynamic routing.

Dynamic routing protocols(RIP, OSPF, BGP)

Here are some examples of dynamic routing protocols:

  1. Routing information Protocol(RIP) - RIP uses the number of routers between a router and the destination subnet as its path selection metric.When a RIP router first comes online,it sends a broadcast message and then all its neighbor routers respond back with their own routing table,This new RIP router then compares the routes in its own routing table with the routes from the other routing tables it has received. If there are routes to other subnets that are currently not in its own routing table,that route is added, more importantly,it updates routes in its own router table if there is a route with less hops to a destination subnet. RIP is a part of a class of routing tables with theic neighbors.
  2. Open Shortest Path First(OSPF) - OSPF is a routing protocol that calculates the shortest path to each destination subnet in the network. Routing protocols like OSPF that work this way are said to be called Link State routing protocols. To be able to know the shortest path to each destination subnet, each router should know everything about the network form links, subnets and even other routers. To do this in OSPF, each router packages routing information they know in a data structure called Link State Advertisements(LSA) and floods the whole network with this information.Fellow OSPF routers listn for LSAs,colllect this data and store them in a Link State Database(LSDB), The points of all this sharing is for each other router to have identical LSDBs, Once this is achieved,each OSPF router calculates routers to all subnets from its own point of view using a shortest path algorithm.These routes are added then added to the router’s routing table.
  3. Border Gateway Protocol(BGP)

Network Troubleshooting

ping

Ping should always be the first step in any network-related troubleshooting session,due to the simple manner in which it works,and the information it returns. Many times,the resulting information from a ping will point you in the next direction. For example, if you notice jitter(ping responses varying widly), you will know to start looking at layer 1 problems somewhere on the path, and that available bandwidth probably isn’t an issue

You’re probably already familiar with the basic usage of ping, but there are some really handly options that can be used.

  1. -i Change the source IP address you’re pinging from.
  2. -s Set the packet size. This is useful when debugging MTU mismatches,by increasing the packet size. Use in conjuction with the -M flag to set MTU path Discovery hint.

mtr

Mtr is a program that combines the functionality of ping and traceroute into on utility

user@opsschool ~$ mtr -r google.com

HOST: opsschool Loss% Snt Last Avg Best Wrst StDev
1. (redacted) 0.0% 10 0.3 0.4 0.3 0.5 0.1
2. 192.241.164.237 0.0% 10 0.3 0.4 0.3 0.4 0.0
3. core1-0-2-0.lga.net.google.c 0.0% 10 0.4 0.7 0.4 2.8 0.8
4. 209.85.248.178 0.0% 10 0.5 1.1 0.4 6.2 1.8
5. 72.14.239.245 0.0% 10 0.7 0.8 0.7 1.4 0.2
6. lga15s46-in-f5.1e100.net 0.0% 10 0.5 0.4 0.4 0.5 0.0

iftop

iftop displays bandwidth usage on a specific interface, broken down by remote host

user@opsschool ~$ sudo iftop -i eth0 -t interface: eth0 IP address is: 10.0.2.15 MAC address is: 08:00:27:ffffff8a:6d:07 Listening on eth0 | # Host name (port/service if enabled) | | last 2s | last 10s | last 40s |cumulative |—————————————-|———|———–|———–|———-|———– | 1 10.0.2.15 | => | 804b | 804b | 804b | 201B | google-public-dns-a.google.com | <= | 980b | 980b | 980b | 245B | 2 10.0.2.15 | => | 352b | 352b | 352b | 88B | 10.0.2.2 | <= | 320b | 320b | 320b | 80B |—————————————-|———|———–|———–|———-|———– |Total send rate: | | 1.13Kb | 1.13Kb | 1.13Kb| |Total receive rate: | | 1.27Kb | 1.27Kb | 1.27Kb| |Total send and receive rate: | | 2.40Kb | 2.40Kb | 2.40Kb| |—————————————-|———|———–|———–|———-|———– |Peak rate (sent/received/total): | | 1.12Kb | 1.27Kb | 2.40Kb| |Cumulative (sent/received/total): | | 289B | 325B | 614B| |========================================|=========|===========|===========|==========|===========

iperf

Iperf is a bandwidth testing utility. it consists of a daemon and running on separate machines.