2007년 12월 20일 목요일

Why 3-way Handshake is needed for TCP?

A Connection-Oriented Protocol, such as TCP, exchanges Control Information(called a Handshake) with the remote computer to verify that it is ready to receive data before sending it. When the handshaking is successful, the computers are said to have established a connection.
In contrast, a Connectionless Protocol, such as IP, doesn't exchange Control Information to establish an end-to-end connection before transmitting data.

TCP Connection Establishing: 3-Way Handshake

TCP Connection이 성립되기 위해서는 먼저 Server가 Connection을 수락할 준비상태에 들어가 있어야 하는데, 이를 'Passive open'이라 한다. Client는 Server로의 Connection Establishment를 요구하며, 이것은 'Active open'이다.

사용자 삽입 이미지

1. SYN Segment(Client의 Synchronization Information 전송): Client는 Source Port에 자신을 나타내는 Port Number를 넣고, Destination Port에는 Server를 가리키는 Port Number를 넣는다.(그림에서 Destination Port가 23이므로 Telnet Server로 Connection Request하는 경우이다). Sequence Number에는 Client의 ISN(Initialization Sequence Number)를 넣고, Acknowledgment Number는 0을 넣고, Flag는 SYN bit를 1로 설정하여 전송한다.

2. SYN+ACK Segment(Server의 Synchronization Information 전송 + SYN Segment 수신 확인): Server는 Source Port에 자신을 나타내는 Port Number를 넣고, Destination Port에는 Sender 나타내는 Port Number를 넣는다.(Telnet Server를 예로 들고 있으므로 Source Port에는 23번이 들어간다, Sender의 Port Number는 첫번째 단계에서 수신한 SYN Segment에서 있다. 결과적으로 보면 Sender가 보낸 SYN Segment에서 Source Port와 Destination Port가 서로 바뀌어 들어간 것과 같다). Sequence Number에는 Server의 ISN를 넣고, Acknowledgment Number에는 “Client의 ISN + 1”의 값을 넣고, Flag는 SYN 와 ACK bit를 모두 1로 설정하여 전송한다.

3. ACK Segment(SYN Segment 수신 확인): Client는 첫번째 단계와 동일하게 Source Port와 Destination Port를 설정하고, Acknowledgment Number에는 “Server의 ISN + 1”의 값을 넣고, Flag는 ACK bit를 1로 설정하여 전송한다.

TCP is a connection oriented protocol. It has to establish a connection between two parties (host and server) before it can start transmitting data (as opposed to for example, IP). The 3-way handshake verifies that both ends are connected properly.


[Related Articles]
[DOC] AMAN2002를 활용한 TCP 연결 설정과 연결 종료 분석 by NetMan
2007/11/08 - [Network] - [scrap] TCP/IP Sliding Window
2007/10/23 - [Network/Network Story] - Network Selfstudy
2007/10/21 - [Network/cisco.com] - [cisco.com] Understanding TCP/IP
2007/09/28 - [Network/Link for Network] - [Link] TCP/IP의 이해(IP Address & Subnet)

2007년 12월 15일 토요일

Dynamips / Dynagen Tutorial

Dynamips / Dynagen Tutorial
Documentation Revision 1.11.2

한 블로그에서 Tutorial의 번역판을 우연히 찾게 되었다.
번역이 불완전하긴 하지만 원본의 문서가 양이 많아서 읽어보려면 상당한 시간이 걸리므로
우선은 시간을 좀 절약할 수 있지 않을까 해서 스크랩해둔다.
이것은 Documentation Revision 1.9.1을 번역한 것이다.

more..


[Related Article]
2007/12/17 - [Network/Router Simulation] - Dynamips / Dynagen Tutorial 번역/요약
2007/12/13 - [Network/Router Simulation] - Cisco 7200 Simulator - Dynamips

2007년 12월 13일 목요일

Cisco 7200 Simulator - Dynamips

[Project Homepage]

Introduction

The Project was started in August 2005 to emulate a Cisco 7200 on a traditional PC.
Now, it also supports Cisco 3600 series (3620, 3640 and 3660), 3700 series (3725, 3745) and 2600 series (2610 to 2650XM, 2691).

The goals of this emulator are mainly:

    * To be used as a training platform, with software used in real world.
    * Test and experiment the numerous and powerful features of Cisco IOS.
    * Check quickly configurations to be deployed later on real routers.

Of course, this emulator cannot replace a real router: you should be able to get a performance of about 1 kpps (depending on your host machine), to be compared to the 100 kpps delivered by a NPE-100 (the oldest NPE model). So, it is simply a complementary tool to real labs for administrators of Cisco networks or people wanting to pass their CCNA/CCNP/CCIE exams.

Current status

At this time, the emulator I have programmed is able to boot a large number of Cisco IOS releases available for the 7200, 3600, 3700 and 2600 platforms, including the latest 12.2S and 12.4T.

The following devices are emulated in the current release (0.2.7):

  • MIPS64 and PowerPC CPU processors. The instruction sets are not completely emulated now (MIPS FPU support is lacking, TLB support is not finished and other minor things), but it is sufficient for IOS ;
  • DRAM and Packet SRAM memory ;
  • Non-Volatile Memory (NVRAM) ;
  • Signetics SCN 2681 DUART (C7200 Console and AUX ports) ;
  • National Semiconductors NS16552 DUART (C3600/C3700/C2600 Console and AUX ports) ;
  • Dallas DS1620 Temperature Sensors and Voltage Sensors, allowing the C7200 Environmental Monitor to work properly ;
  • NMC93C46 Serial EEPROM ;
  • Bootflash of 8 Mb (Intel 28F016SA) ;
  • Galileo GT64010/GT64120/GT96100 PCI controllers, DEC 21x50 PCI bridges and so ;
  • PCMCIA ATA disk emulation (C7200 only at this time).
  • ...

The following Cisco 7200 Port Adapters (PA) are currently supported:

  • FastEthernet cards "C7200-IO-FE" and "PA-FE-TX" based on DEC21140 chip
  • FastEthernet cards "C7200-IO-2FE" and "PA-2FE-TX" based on Intel i8254x chips
  • GigabitEthernet cards "C7200-IO-GE-E" and "PA-GE" based on Intel i8254x chips
  • Ethernet cards "PA-4E" and "PA-8E" based on AMD Am79c97x chips
  • ATM card "PA-A1" based on Texas Instruments Tneta1570 chip
  • Serial cards "PA-4T+" and "PA-8T"
  • POS (Packet over SONET) card "PA-POS-OC3" (experimental, only works with recent IOS images)

The following Cisco 3600 (3620,3640,3660) Network Modules (NM) are currently supported:

  • Ethernet cards: "NM-1E", "NM-4E" and "NM-1FE-TX", all based on AMD Am79c97x chips
  • Ethernet switching module: "NM-16ESW"
  • Serial card "NM-4T"

The following Cisco 2691/3725/3745 Network Modules (NM) are currently supported:

  • FastEthernet cards: "NM-1FE-TX"
  • Ethernet switching module: "NM-16ESW"
  • Serial card "NM-4T"

The following Cisco 2600 Network Modules (NM) are currently supported:

  • Ethernet cards: "NM-1E", "NM-4E" and "NM-1FE-TX"
  • Ethernet switching module: "NM-16ESW"

Lab simulation / "Hypervisor" mode

It is now possible to run the emulator as an "Hypervisor" to start and control many virtual router instances simultaneously.

Dynagen, is a front-end (written in Python) that makes lab simulation with the hypervisor very easy: it uses an INI-like configuration file to provision Dynamips emulator networks.
It takes care of specifying the right port adapters, generating and matching up those pesky NIO descriptors, specifying bridges, frame-relay, ATM switches, etc.
It also provides a management CLI for listing devices, suspending and reloading instances, etc.
You can also distribute virtual instances across different servers to set up complex labs. To begin with Dynagen, you can consult this very complete tutorial.

Dynagui is a graphical front-end. It uses Dynagen to communicate with the hypervisor.


How to use it ?

Very important remark: by default, an instance will take 100% of the host CPU.
To avoid this, please read the "idle-pc" section in the README.

Emulated hardware
The emulator currently supports the following platforms:
   - Cisco 7200 (NPE-100 to NPE-400)
   - Cisco 3600 (3620, 3640 and 3660)
   - Cisco 2691
   - Cisco 3725
   - Cisco 3745
   - Cisco 2600 (2610 to 2650XM)
   - Cisco 1700 (1710 to 1760)

By default, a Cisco 7206VXR with NPE-200 (256 Mb of DRAM) is emulated.
To emulate another platform, use the "-P" command line option
(for example, "-P 3725" or "-P 3600").

For the 7200, you can change the NPE type with the "-t" option.
It is possible to select "npe-100", "npe-150", "npe-175", "npe-200", "npe-225", "npe-300" and "npe-400". The "npe-g1" is not working.

For the 3600, a 3640 with 128 Mb is emulated by default.
You can change this with the "-t" option and by specifying "3620" or "3660".
Don't forget to set the chassis type depending on your IOS image, a c3660 image will not run on c3640 hardware and vice-versa.

Remark: PCMCIA card emulation is not supported yet with Cisco 3600.

Command Line Options details
--idle-pc <pc>
:
The "idle PC" feature allows you to run a router instance without having a 100% CPU load. This implies that you can run a larger number of instances per real machine.
To determine the "idle PC", start normally the emulator with your Cisco IOS image, and a totally IOS empty configuration (although not mandatory, this will give better results).
When the image is fully booted, wait for the "Press RETURN to get started!" message prompt, but do not press Enter key.
Wait about 5 seconds, then press "Ctrl-] + i".
Some statistics will be gathered during 10 seconds.
At the end, the emulator will display a list of possible values to pass to the "--idle-pc" option.
You may have to try some values before finding the good one.
To check if the idle PC value is good, just boot the Cisco IOS image, and check your CPU load when the console prompt is available.
If it is low, you have found a good value, keep it preciously.
Important remarks: 
* An "idle PC" value is *specific* to a Cisco IOS image.
   You cannot boot a different IOS image without proceeding as described above.
* Do not run the process while having the "autoconfiguration" prompt.

To boot quickly, the preferred method is to decompress the IOS image with the "unzip" utility.
It avoids to run the self-decompressing process in the emulator.

$ unzip -p c7200-advipservicesk9-mz.124-9.T.bin > image.bin
warning [c7200-advipservicesk9-mz.124-9.T.bin]: 27904 extra bytes at beginning or within zipfile
(attempting to process anyway)
$ file image.bin
image.bin: ELF 32-bit MSB executable, cisco 7200, version 1 (SYSV), statically linked, stripped

You can ignore the warning, unzip has just skipped the self-decompressing code at the beginning of the image.


Cisco 7200 Simulator FAQ

2007년 12월 6일 목요일

DynDNS의 WebHop Redirect Service 이용하기

www.dyndns.com에 Log-in합니다.

좌측메뉴에서 Host Services항목을 선택합니다.

Add New Hostname click하면 아래와 같이 나옵니다.

먼저 Service Type항목에서 WebHop Redirect를 선택해줍니다.

그럼 아래쪽에 WebHop Settings항목이 나타납니다.

우선 Hostname에는 새로이 사용할 주소를 지정해줍니다.

그 다음 WebHop Settings의 Redirect URL에 위에서 지정한 주소를 이용해

접근해야할 URL을 입력합니다.

http://mydyndns.homeip.net:8080/ 과 같이 Port Nr.도 함께 지정해 줍니다.

Yes, cloak this page항목을 체크하면 실제주소가 보여지지 않고

Cloaked title에 지정한 내용을 보여주게 됩니다.

Creat Host를 누르면 설정완료입니다.


이제 http://mydyndns.homeip.net:8080/ 대신 Web Browser의 주소창에

위에서 지정한 주소를 입력해주면 됩니다.