0% found this document useful (0 votes)
8 views4 pages

Untitled Document

The document provides an overview of networking basics, including definitions, commands, and the use of NS-2 for network simulation. It details basic networking commands such as ipconfig and ping, as well as the Tcl programming language used for scripting in NS-2. Key points emphasize the simulation capabilities of NS-2 and the simplicity of Tcl for writing network scripts.

Uploaded by

sohamkadam5505
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Untitled Document

The document provides an overview of networking basics, including definitions, commands, and the use of NS-2 for network simulation. It details basic networking commands such as ipconfig and ping, as well as the Tcl programming language used for scripting in NS-2. Key points emphasize the simulation capabilities of NS-2 and the simplicity of Tcl for writing network scripts.

Uploaded by

sohamkadam5505
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Networking Basics

A network is a group of computers connected together to share resources. It can be small


(home or office) or large (university, internet). Networking involves hardware and software
to enable communication between devices.

What are Networking Commands?

Networking commands help transfer data and connect computers. They are used for
diagnostics, communication, and troubleshooting.

How to Open Command Prompt or PowerShell:

● Press Win + R, type cmd or powershell, and press Enter.


● Or search for Command Prompt or PowerShell in the Start menu.

Basic Networking Commands:

1. ipconfig – Shows IP configuration (IP address, subnet, gateway).


○ Run: ipconfig
2. Get-NetIPAddress – Shows detailed IP addresses.
○ Run: Get-NetIPAddress
3. tracert – Traces the route packets take to a destination.
○ Run: tracert google.com
4. ping – Checks network connectivity by sending test packets.
○ Run: ping google.com
5. netstat – Shows active network connections.
○ Run: netstat
6. Get-NetTCPConnection – Displays active TCP connections.
○ Run: Get-NetTCPConnection
7. Resolve-DnsName – Resolves a domain name to an IP address.
○ Run: Resolve-DnsName google.com
8. Get-NetRoute – Displays the routing table (network routes).
○ Run: Get-NetRoute
9. hostname – Shows the name of the local computer.
○ Run: hostname
10. curl – Fetches data from a URL.
○ Run: curl http://google.com
11. Invoke-WebRequest – Retrieves web content or downloads files.
○ Run: Invoke-WebRequest -Uri "http://example.com"
12. Get-NetNeighbor – Displays the ARP table (IP to MAC mappings).
○ Run: Get-NetNeighbor

Would you like any part explained in more detail?


What is NS-2?

NS-2 is a network simulator used to test and study how networks work without using real
hardware. It helps researchers and students simulate network behavior like data transfer,
delays, and performance.

Features of NS-2:

● Simulates networks – Works with TCP, UDP, and wireless networks.


● Event-based simulation – Runs step by step in order.
● Custom networks – You can design your own network setup.
● Performance testing – Checks speed, delays, and packet loss.
● Supports coding – Uses Tcl (for scripts) and C++ (for main functions).

What is Tcl?

Tcl (Tool Command Language) is a simple programming language used in NS-2 to write
and run network simulations.

Why Use Tcl?

● Easy to learn and use


● Works on Windows, Mac, and Linux
● Used for writing NS-2 scripts

How to Run a Tcl Script in NS-2 (Ubuntu)


Open Gedit and write a Tcl script
tcl
CopyEdit
puts "Hello, World!"

1.
○ Save it as hello_world.tcl

Open Terminal, go to script location


bash
CopyEdit
cd /path/to/your/script

2.

Run the script in NS-2


nginx
CopyEdit
ns hello_world.tcl

3.

Output:
CopyEdit
Hello, World!

Simple Tcl Examples

1️⃣ Addition in Tcl

tcl
CopyEdit
set a 5
set b 10
set sum [expr $a + $b]
puts "Sum: $sum"

Output: Sum: 15

2️⃣ Loop Counting from 1 to 5

tcl
CopyEdit
set count 1
while {$count <= 5} {
puts "Count: $count"
incr count
}

Output: Count: 1, 2, 3, 4, 5

3️⃣ Sort a List of Numbers

tcl
CopyEdit
set numbers {5 2 8 1 9 3}
set sortedList [lsort $numbers]
puts "Sorted list: $sortedList"

Output: Sorted list: 1 2 3 5 8 9

4️⃣ Timer Example (Delay Message)

tcl
CopyEdit
puts "Start"
after 2000 { puts "2 seconds passed!" }

Output:
Start
(After 2 seconds)
2 seconds passed!

Key Points to Remember

● NS-2 helps test networks using simulation.


● Tcl is the scripting language used for writing NS-2 simulations.
● Scripts can run in Ubuntu using the NS-2 command (ns scriptname.tcl).
● Basic Tcl features include loops, lists, math operations, and timers.

Would you like me to simplify anything further? 😊

4o
O
Search
Reason

You might also like