Switching
Wednesday, 21 September 2022
Wednesday, 14 September 2022
LAYERED TASKS : Open System Interconnection & TCP/IP Model
LAYERED TASKS
We use the concept of layers in our daily
life. As an example, let us consider two friends who communicate through postal
mail the process of sending a letter to a friend would be complex if there were
no services available from the post office.
Sender, Receiver, and Carrier
At the Sender Site
Let us first describe, in order, the
activities that take place at the sender site.
• Higher layer. The sender writes the letter,
inserts the letter in an envelope, writes the sender and receiver addresses,
and drops the letter in a mailbox.
• Middle layer. The letter is picked up by a
letter carrier and delivered to the post office.
• Lower layer. The letter is sorted at the
post office; a carrier transports the letter.
0n the Way: The letter is then on its way to
the recipient. On the way to the recipient's local post office, the letter may
actually go through a central office. In addition, it may be transported by
truck, train, airplane, boat, or a combination of these.
At the Receiver Site
• Lower layer. The carrier transports the
letter to the post office.
• Middle layer. The letter is sorted and
delivered to the recipient's mailbox.
• Higher layer. The receiver picks up the
letter, opens the envelope, and reads it.
Reference Models:
In computer networks, reference models give a conceptual framework that standardizes communication between heterogeneous networks.
•OSI Model
•TCP/IP Protocol Suite
- OSI stands for Open Systems Interconnection
- Created by International Standards Organization (ISO)
- Was created as a framework and reference model to explain how different networking technologies work together and interact
- It is not a standard that networking protocols must follow
- Each layer has specific functions it is responsible for
- All layers work together in the correct order to move data around a network
Application Layer: Contains all services or protocols needed by application software or operating system to communicate on the network
Examples
–Firefox web browser uses HTTP (Hyper-Text Transport Protocol)
–E-mail program may use POP3 (Post Office Protocol version 3) to read e-mails and SMTP (Simple Mail Transport Protocol) to send e-mails
•Handles three primary tasks:
Translation , Compression , Encryption
Session Layer
- Responsible for managing the dialog between networked devices
- Establishes, manages, and terminates connections
- Provides duplex, half-duplex, or simplex communications between devices
- Provides procedures for establishing checkpoints, adjournment, termination, and restart or recovery procedures
- Takes data from higher levels of OSI Model and breaks it into segments that can be sent to lower-level layers for data transmission
- Conversely, reassembles data segments into data that higher-level protocols and applications can use
- Also puts segments in correct order (called sequencing ) so they can be reassembled in correct order at destination
- Concerned with the reliability of the transport of sent data
- May use a connection-oriented protocol such as TCP to ensure destination received segments
- May use a connectionless protocol such as UDP to send segments without assurance of delivery
- Uses port addressing
- Responsible for moving packets (data) from one end of the network to the other, called end-to-end communications
- Requires logical addresses such as IP addresses
- Device example: Router
- Routing is the ability of various network devices and their related software to move data packets from source to destination
- Is responsible for moving frames from node to node or computer to computer
- Can move frames from one adjacent computer to another, cannot move frames across routers
- Encapsulation = frame
- Requires MAC address or physical address
- Protocols defined include Ethernet Protocol and Point-to-Point Protocol (PPP)
- Device example: Switch,Bridge
- Two sublayers: Logical Link Control (LLC) and the Media Access Control (MAC)
- Data Link layer addressing, flow control, address notification, error control
- Determines which computer has access to the network media at any given time
- Determines where one frame ends and the next one starts, called frame
- synchronization
- Deals with all aspects of physically moving data from one computer to the next
- Converts data from the upper layers into 1s and 0s for transmission over media
- Defines how data is encoded onto the media to transmit the data
- Defined on this layer: Cable standards, wireless standards, and fiber optic standards.
- Copper wiring, fiber optic cable, radio frequencies, anything that can be used to transmit data is defined on the Physical layer of the OSI Model
- Device example: Hub, Repeater
- Used to transmit data
An exchange using the OSI model
A protocol suite is a large number of related protocols that work together to allow networked computers to communicate
Typical protocols:
- FTP – File Transfer Protocol
- For file transfer
- Telnet – Remote terminal protocol
- For remote login on any other computer on the network
- SMTP – Simple Mail Transfer Protocol
- For mail transfer
- HTTP – Hypertext Transfer Protocol
- For Web browsing
•TCP is a connection-oriented protocol
- Does not mean it has a physical connection between sender and receiver
- TCP provides the function to allow a connection virtually exists – also called virtual circuit
- Dividing a chunk of data into segments
- Reassembly segments into the original chunk
- Provide further the functions such as reordering and data resend
- Offering a reliable byte-stream delivery service
- Functions the same as the Transport layer in OSI
- Synchronize source and destination computers to set up the session between the respective computers
Host-to-network layer
The Host-to-network layer is the lowest layer of the TCP/IP reference model. It combines the link layer and the physical layer of the ISO/OSI model. At this layer, data is transferred between adjacent network nodes in a WAN or between nodes on the same LAN.
OSI Model Vs TCP/IP Model:
Introduction to Computer Networks
A network is a set of devices (often referred to as nodes) connected by communication links. A node can be a computer, printer, or any other device capable of sending and/or receiving data generated by other nodes on the network.
“Computer network’’ means a collection of autonomous computers interconnected by a single technology. Two computers are said to be interconnected if they are able to exchange information.
The connection need not be via a copper wire; fiber optics, microwaves, infrared, and communication satellites can also be used, with the Internet being the most well-known example of a network of networks.
There is considerable confusion in the literature between a computer network and a distributed system. The key distinction is that in a distributed system, a collection of independent computers appears to its users as a single coherent system. Usually, it has a single model or paradigm that it presents to the users. Often a layer of software on top of the operating system, called middleware, is responsible for implementing this model. A well-known example of a distributed system is the World Wide Web. It runs on top of the Internet and presents a model in which everything looks like a document (Web page).
A network must be able to meet certain criterias, these are mentioned below:
Reliability
Scalability
Performance: It can be measured in the following ways:
Transit time : It is the time taken to travel a message from one device to another.
Response time : It is defined as the time elapsed between enquiry and response.
Other ways to measure performance are :
· Efficiency of software
· Number of users
· Capability of connected hardware
Reliability: It decides the frequency at which network failure take place. More the failures are, less is the network's reliability.
Security: It refers to the protection of data from any unauthorized user or access. While travelling through network, data passes many layers of network, and data can be traced if attempted. Hence security is also a very important characteristic for Networks.
USES OF COMPUTER NETWORKS
1. Business Applications
• To distribute information throughout the company (resource sharing). sharing physical resources such as printers, and tape backup systems, is sharing information
• client-server model. It is widely used and forms the basis of much network usage.
• communication medium among employees. email (electronic mail), which employees generally use for a great deal of daily communication.
• Telephone calls between employees may be carried by the computer network instead of by the phone company. This technology is called IP telephony or Voice over IP (VoIP) when Internet technology is used.
• Desktop sharing lets remote workers see and interact with a graphical computer screen
• Doing business electronically, especially with customers and suppliers. This new model is called e-commerce (electronic commerce) and it has grown rapidly in recent years.
2.Home Applications
• peer-to-peer communication
• person-to-person communication
• electronic commerce
• entertainment.(game playing,)
3.Mobile Users
• Text messaging or texting
• Smart phones,
• GPS (Global Positioning System)
• m-commerce
• NFC (Near Field Communication)
4.Social Issues
With the good comes the bad, as this new-found freedom brings with it many unsolved social, political, and ethical issues.
Social networks, message boards, content sharing sites, and a host of other applications allow people to share their views with like-minded individuals. As long as the subjects are restricted to technical topics or hobbies like gardening, not too many problems will arise.
The trouble comes with topics that people actually care about, like politics, religion, or sex. Views that are publicly posted may be deeply offensive to some people. Worse yet, they may not be politically correct. Furthermore, opinions need not be limited to text; high-resolution color photographs and video clips are easily shared over computer networks. Some people take a live-and-let-live view, but others feel that posting certain material (e.g., verbal attacks on particular countries or religions, pornography, etc.) is simply unacceptable and that such content must be censored. Different countries have different and conflicting laws in this area. Thus, the debate rages.
Computer networks make it very easy to communicate. They also make it easy for the people who run the network to snoop on the traffic. This sets up conflicts over issues such as employee rights versus employer rights. Many people read and write email at work. Many employers have claimed the right to read and possibly censor employee messages, including messages sent from a home computer outside working hours. Not all employees agree with this, especially the latter part.
Another conflict is centered around government versus citizen’s rights.A new twist with mobile devices is location privacy. As part of the process of providing service to your mobile device the network operators learn where you are at different times of day. This allows them to track your movements. They may know which nightclub you frequent and which medical center you visit.
Phishing ATTACK: Phishing is a type of social engineering attack often used to steal user data, including login credentials and credit card numbers. It occurs when an attacker, masquerading as a trusted entity, dupes a victim into opening an email, instant message, or text message.
BOTNET ATTACK: Botnets can be used to perform distributed denial-of-service attack (DDoS attack), steal data, send spam, and allows the attacker to access the device and its connection.
Data Communications System :
The effectiveness of a data communications system depends on four fundamental characteristics: delivery, accuracy, timeliness, and jitter.
I. Delivery. The system must deliver data to the correct destination. Data must be received by the intended device or user and only by that device or user.
2 Accuracy. The system must deliver the data accurately. Data that have been altered in transmission and left uncorrected are unusable.
3.Timeliness. The system must deliver data in a timely manner. Data delivered late are useless. In the case of video and audio, timely delivery means delivering data as they are produced, in the same order that they are produced, and without significant delay. This kind of delivery is called real-time transmission.
4.Jitter. Jitter refers to the variation in the packet arrival time. It is the uneven delay in the delivery of audio or video packets. For example, let us assume that video packets are sent every 30 ms. If some of the packets arrive with 30-ms delay and others with 40-ms delay, an uneven quality in the video is the result.
Tuesday, 16 August 2022
Installation of contiki 3.0 on ubuntu20.04
root@ubuntu:/home/ubuntu$ sudo -s
root@ubuntu:/home/ubuntu#
root@ubuntu:/home/ubuntu# wget https://github.com/contiki-os/contiki/archive/3.0.zip
root@ubuntu:/home/ubuntu# unzip 3.0.zip
Monday, 15 August 2022
Instant contiki 2.7
Go to google search and type instant contiki 2.7 download
Friday, 12 August 2022
How to Install and Uninstall Java on Ubuntu
Step1: Installing Java on Ubuntu
You can install one or several Java packages. You can also decide which version you want on your system by installing a specific version number. The current default and LTS version is Java 11.
Install OpenJDK
1. Open the terminal (Ctrl+Alt+T) and update the package repository to ensure you download the latest software version:
sudo apt update
2. Then, you can confidently install the latest Java Development Kit with the following command:
sudo apt install default-jdk
Install Specific Version of OpenJDK
You may decide to use Open JDK 8, instead of the default OpenJDK 11.
To do so, open the terminal and type in the following command:
sudo apt install openjdk-8-jdk
Once the installation process is complete, verify the current Java version:
java -version; javac -version
How to find the OpenJDK directory with the following command:
readlink -f /usr/bin/javac
How to Set Default Java Version
As you can have multiple versions of Java installed on your system, you can decide which one is the default one.First, run a command that shows all the installed versions on your computer:
sudo update-alternatives --config java
step 2: Uninstall Java on Ubuntu
In case you need to remove any of the Java packages installed, use the apt remove or purge command. To remove Open JDK 11, run the command:
sudo apt remove default-jdk
To uninstall OpenJDK 8:
sudo apt remove openjdk-8-jdk
2nd Method:
1. sudo dpkg --list | grep -i jdk
2. sudo apt-get purge Oracle-java8-installer
Thursday, 11 August 2022
contiki ng -GNU Mode
Open the terminal
ctrl +alt + t
vl@ubuntu:~/contiki-ng$ cd tools
vl@ubuntu:~/contiki-ng/tools$ ls
vl@ubuntu:~/contiki-ng/tools$ cd cooja
vl@ubuntu:~/contiki-ng/tools/cooja$ update-alternatives --config java
// it may not change unless we do in root
vl@ubuntu:~/contiki-ng/tools/cooja$ sudo -s
[sudo] password for vl:
root@ubuntu:/home/vl/contiki-ng/tools/cooja# update-alternatives --config.java
root@ubuntu:/home/vl/contiki-ng/tools/cooja# ant run
contiki ng -Terminal mode
open the terminal
ctrl + alt + t
create a folder rk and copy helloworld.c and makefile from examples folder
vl@ubuntu:~/contiki-ng/examples$ mkdir rk
vl@ubuntu:~/contiki-ng/examples$ ls
6tisch ip64-router nullnet slip-radio
benchmarks ledprg platform-specific snmp-server
coap libs rk storage
cplusplus lwm2m-ipso-objects rpl-border-router websocket
dev mqtt-client rpl-udp
hello-world multicast sensniff
vl@ubuntu:~/contiki-ng/examples$ cd rk
vl@ubuntu:~/contiki-ng/examples/rk$ ls
vl@ubuntu:~/contiki-ng/examples/rk$ cp ../hello-world/hello-world.c .
vl@ubuntu:~/contiki-ng/examples/rk$ cp ../hello-world/Makefile .
vl@ubuntu:~/contiki-ng/examples/rk$ ls
hello-world.c Makefile
vl@ubuntu:~/contiki-ng/examples/rk$ mv hello-world.c myown.c
set the Makefile to myown as shown
Now create myown.c file
#include "contiki.h"
#include <stdio.h> /* For printf() */
/*---------------------------------------------------------------------------*/
PROCESS(myown_process, "I am on My Own");
AUTOSTART_PROCESSES(&myown_process);
/*---------------------------------------------------------------------------*/
//Protothread
PROCESS_THREAD(myown_process, ev, data)
{
static struct etimer timer;//static is used here to store the timer in RAM
PROCESS_BEGIN();
/* Setup a periodic timer that expires after 10 seconds. */
etimer_set(&timer, CLOCK_SECOND * 5);
while(1) { //super loop architecture
printf("Hello Friends Welcome to IoT\n");
/* Wait for the periodic timer to expire and then restart the timer. */
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&timer));
etimer_reset(&timer);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
Run:
vl@ubuntu:~/contiki-ng/examples/rk$ make
vl@ubuntu:~/contiki-ng/examples/rk$ ls
build Makefile myown.c myown.native
vl@ubuntu:~/contiki-ng/examples/rk$ make TARGET=native
make: Nothing to be done for 'all'.
vl@ubuntu:~/contiki-ng/examples/rk$ make clean
TARGET not defined, using target 'native'
vl@ubuntu:~/contiki-ng/examples/rk$ make TARGET=native
vl@ubuntu:~/contiki-ng/examples/rk$ ./myown.native
Wednesday, 10 August 2022
LED Display
create a folder ledprg in contiki/examples
copy the makefile from helloworld into the above created folder
create a file led.c in ledprg folder
//led.c
#include "contiki.h"
#include <stdio.h>
#include "dev/leds.h"
#include "dev/button-sensor.h"
PROCESS(led_process, "LED Process");
AUTOSTART_PROCESSES(&led_process);
PROCESS_THREAD(led_process,ev,data)
{
PROCESS_BEGIN();
SENSORS_ACTIVATE(button_sensor);
while(1)
{
printf("Press the Button of the sensor\n");
PROCESS_WAIT_EVENT_UNTIL(ev==sensors_event && data==&button_sensor);
leds_toggle(LEDS_GREEN);
}
printf("The sensor value is %u \n",leds_get());
PROCESS_END();
}
//Makefile
see that both the files are in the same folder ledprg
RUN THE PROGRAM:
vl@ubuntu:~/contiki-ng/examples/ledprg$ make TARGET=native
Note :
if there is an error regarding gcc version
wget http://www.netgull.com/gcc/releases/gcc-4.8.0/gcc-4.8.0.tar.bz2
To extract the file:
tar -xvjf gcc-4.8.0.tar.bz2
Install some additional libraries (sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev libc6-dev)
Compile the source: ./gcc-4.8.0/configure --prefix=/app/gcc/4.8.0
Run make (This will take some time to complete. Go make some coffee, or bake some cookies. ;-))
Install the code: sudo make install
sudo dpkg --add-architecture i386
sudo apt update
sudo apt upgrade
sudo apt-get install gcc-multilib libstdc++6:i386
wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2 --no-check-certificate
tar xf gcc-4.8.5.tar.bz2
# cd gcc-4.8.5
# ./contrib/download_prerequisites
# cd ..
sed -i -e 's/__attribute__/\/\/__attribute__/g' gcc-4.8.5/gcc/cp/cfns.h
sed -i 's/struct ucontext/ucontext_t/g' gcc-4.8.5/libgcc/config/i386/linux-unwind.h
mkdir xgcc-4.8.5
pushd xgcc-4.8.5
$PWD/../gcc-4.8.5/configure --enable-languages=c,c++ --prefix=/usr --enable-shared --enable-plugin --program-suffix=-4.8.5
make MAKEINFO="makeinfo --force" -j
sudo make install -jMonday, 8 August 2022
Contiki NG Installation in Ubuntu 20.04
Start by installing some necessary packages:
$ sudo apt update
$ sudo apt install build-essential doxygen git curl wireshark python3-serial srecord rlwrap
While installing Wireshark, select enable the feature that lets non-superuser capture packets (select "yes").
$ sudo apt install autoconf automake libxmu-dev
To install GCC for ARM controller
$ wget https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2
Extract this file in the home folder itself.
To open the above file using a terminal
vl@ubuntu:~/gcc-arm-none-eabi-5_2-2015q4-20151219-linux$ pwd
/home/vl/gcc-arm-none-eabi-5_2-2015q4-20151219-linux
vl@ubuntu:~/gcc-arm-none-eabi-5_2-2015q4-20151219-linux$ cd
vl@ubuntu:~$ pwd
/home/vl
vl@ubuntu:~$ gedit .bashrc
set the above in the PATH Environment.
/home/vl/.bashrc as:
export PATH=$PATH:/home/vl/gcc-arm-none-eabi-5_2-2015q4-20151219-linux/bin
To check the added path use the commnad
$ echo $PATH
Add this path in .bashrc file
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
CoAP Client
$ sudo apt-get install -y npm && sudo apt-get clean && sudo npm install coap-cli -g && sudo ln -s /usr/bin/nodejs /usr/bin/node
MQTT Clients
$ sudo apt-get install -y mosquitto mosquitto-clients
Configuration Completed.
Download Contiki NG
$ cd contiki-ng
Peer-to-Peer Networks
Peer-to-Peer (P2P) networks are a decentralized type of network architecture where each device (or node) on the network can act as both a...
-
In the Application Layer of the OSI model, protocols like MIME , SMTP , and IMAP play crucial roles in enabling communication through emai...
-
TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two fundamental transport layer protocols that define how data is t...
-
A Transport Protocol is responsible for ensuring reliable and efficient data transfer between two endpoints (e.g., computers or devices) acr...















































