It is tedious to browse through your linux screen windows, by typing “Ctrl a” + ” every-time you want to switch to another window. A better approach, that will save your time is to use multiple Tabs in the same window. You will remember the context and can quickly switch among the tabs.
So let us quickly get the tabs.
Screen Tabs Setup
Open a terminal and first install screen if screen is not already installed
nir@ubuntu:~$ sudo apt-get install screen
nir@ubuntu:~$ which screen
Open your .screenrc file and add the following string and you are set.
Given a packet, can you tell, if it will get switched or routed ? What algorithm will you use.
To understand this, let us dig into what happens during switching and routing.
Switching happens in the same network. And routing works across the network.
The fundamental concept for Switching is it works at Layer 2 (L2) and Routing works at Layer 3 (L3) of the networking stack.
For switching to happen L2 lookup is necessary. The L2 data (for ethernet) present in the packet header includes Destination MAC, Source MAC, VLAN etc.
For routing to happen L3 lookup is necessary. The L3 data present in the packet header includes Source Ip, Destination Ip etc.
But when will L3 lookup happen ?
After L2 lookup matches then L3 lookup starts (Similarly, after L3 lookup matches then L4 lookup will start and so on, for the entire network layers)
Switching / L2 Lookup
When the packet arrives on a port, the destination MAC address present as a part of the packet header is matched against the MAC address of the port on which this packet is received.
If the Destination MAC address present in the packet header is same to the MAC address of the port on which this packet is received, the packet has reached its destination when Layer 2 is concerned. The packet can now proceed for L3 lookup.
But what will happen if the packet’s destination MAC does not match with the MAC address of the port on which it is received ?
Then, the MAC address table lookup happens. The MAC address table, is a table that has the following key fields (or columns). Let us take an example
The above tables tells that MAC aa:00:bb:00:cc:00 is learnt on port 1/1/1 and belongs to VLAN 10. Or in other words, to reach destination MAC aa:00:bb:00:cc:00 use port 1/1/1 as the egress port for all packets part of VLAN 10.
As the MAC is learnt so the type is “dynamic”. On the other hand if administrator configures the above table entry manually then the type becomes “static”.
So when MAC table lookup happens, the destination MAC specified in the packet header matches with an entry in the MAC address table, for the same vlan, then the packet is forwarded to that port. In other words, this is switching.
Routing / L3 Lookup
As discussed above, L3 lookup will happen after L2 match is found – that is when the destination MAC of the packet matches with the mac address of the port on which it is received.
Now it can go ahead for L3 lookup and see if the Destination IP present in the packet header also matches with the IP address of the port where the packet is received. (Or it can be a L3 virtual port as well, example a SVI – switch virtual interface, which is essentially is a L3 VLAN port ).
If the above matches, the packet has reached the final destination. If it does not match, then Routing table lookup happens and the packet gets routed to another network. In other words, routing takes place.
So to answer the question “what decides if a packet will get switched or routed” as you can see it all dependents on the Destination MAC.
So if the packet has not yet reached its destination MAC, switching happens. If packet has reached the destination MAC, it checks to see if routing is necessary.
Access port in a switch is a port, which is associated with a single VLAN connecting usually to a host.
Access port in egress (transmit) path will always send untagged packet out.
In ingress (receipt) path, the access port can accept both untagged and tagged packets. But note, not all tagged packets, it is only for that VLAN which is associated with this port.
Note: In some products the requirement may be to only accept untagged packets on access port
Let us take an example to understand it better
In the above diagram it can be seen that host H1(can be a linux host machine) is connected directly to a switch Sw1
Let the port of Sw1 connecting host H1 be an access port of vlan say 10
So if H1 send a packet to Sw1 as untagged ethernet packet, sw1 will accept and it will be treated as a packet belonging to vlan 10.(The Host H1 can remain unaware of the VLAN)
H1(if it is vlan aware) can send a tagged packet with vlan 10 as well and still be accepted by Sw1, as the connecting port in Sw1 is belonging to the same vlan.
However if a packet tagged with vlan 20 arrives Sw1, it will be dropped.
In egress Sw1 will always send out untagged packet for that vlan.
Even if say Sw1 received a tagged packet with vlan 10 from some other port and it needs to switch it out via this port to H1, it will send it out as untagged.
Here is typical diagram involving only access ports
In the above diagram all ports of the switch are access ports of the respective VLANs. VLAN 10 hosts can ping each other and likewise VLAN 20 hosts can ping each other.
But VLAN10 hosts can’t reach VLAN 20 hosts and vice versa.
Question for you
Now that you know what is a access port, I do have a followup question. In the previous example we saw a host connecting a switch via access port. So can we have a switch connecting to another switch via access port ?
Can you think of what are the shortcoming in connecting two switches via access port ?
As a developer you might be using VNC frequently. But new Mac user will find there is no Shift+Insert or middle click option available in Mac. Using these key combinations it is possible paste content in VNC (Windows) but these keys are not present in Mac.
So here is the alternate I use
In the VNC window you will see the Settings tab. Click there you will find Configure Shortcuts. As in the image below
If you scroll you will find various option to configure. Click on Paste and select Custom and then click the button next to it to set your shortcut for paste. In my case I have selected command+v as the shortcut for paste. Similarly you can set command+c the shotcut for copy.
Thus whenever you select any lines on your VNC just click command C to copy and command V to paste it.
However if the above do not work, say if you are working in xterm instead of konsole. Then how can you paste items from clipboard easily ? Usually if you highlight text it gets copied but there is no option to paste without using mouse. If you had a mouse a middle click would have served the purpose. So now without a mouse we need to have some trigger which acts as a mouse middle click. To serve this purpose I use MagicPrefs.
Install MagicPrefs. Once done it appears in the top menu, as you can see in the picture below
Now Click, MagicPrefs->Prefences, it open up
Set the 3 finger click middle click option. That’s it. For a quick test open your terminal from dock (or VNC) highlight any text (gets copied in clipboard). Now do a 3 finger tap to paste.
If this was helpful to you, please share and let me know your comments below.