The Laboratory of The Laboratory of Computer Communication Computer Communication and Networking and Networking LAN Auto LAN Auto Detection Detection PNP* Protocol PNP* Protocol
Dec 22, 2015
The Laboratory of The Laboratory of Computer Computer
Communication and Communication and NetworkingNetworking
LAN Auto LAN Auto DetectionDetection
PNP* ProtocolPNP* Protocol
Project TeamProject Team
Submitted by: – Oleg Toubenshlak [email protected]– Roy Peled [email protected] – Valentin Rozental [email protected]
Instructor: Michael Liflian– [email protected] CISCO
Lecturer: Danny Raz– [email protected] Technion
Supervisor: Itai Dabran– idabran@cs Technion
Project GoalProject Goal
Develop a discovery protocol Develop a discovery protocol that uses broadcast messages that uses broadcast messages over Ethernet in order to over Ethernet in order to support Plug-and-Play (PnP) for support Plug-and-Play (PnP) for local devices and services local devices and services attached via a LAN attached via a LAN
BackgroundBackground
Since home networks contain now Since home networks contain now multiple network devices, such as PC, multiple network devices, such as PC, play station, wireless laptop or web play station, wireless laptop or web appliance, video recorder, video appliance, video recorder, video camera and more, a simple network camera and more, a simple network connection between such devices connection between such devices becomes a problem. becomes a problem.
IntroductionIntroduction
The solution is PNP*, an automatic The solution is PNP*, an automatic auto detection service for machines auto detection service for machines via LANvia LAN
Introduction-exampleIntroduction-example
For instance, when turning on a For instance, when turning on a new PC connected to the home new PC connected to the home LAN, it will:LAN, it will:– find out what other devices are find out what other devices are
connected to the LAN (such as another connected to the LAN (such as another PC with a printer, modem, etc). PC with a printer, modem, etc).
– distribute its own features to the LAN.distribute its own features to the LAN.– auto-configure its IP.auto-configure its IP.
PNP* TopologyPNP* Topology
All stations will be connected through All stations will be connected through Ethernet. A single Gateway has outside Ethernet. A single Gateway has outside connection (Internet), and is able to connection (Internet), and is able to translate local IP’s to external IP’s and translate local IP’s to external IP’s and supplies the local subnet mask. supplies the local subnet mask.
PNP* provides stable behavior of the LAN, PNP* provides stable behavior of the LAN, even in case of topology changes. even in case of topology changes. Machines may connect\disconnect Machines may connect\disconnect dynamically.dynamically.
PNP* FeaturesPNP* Features
Clients require no manual configuration. Each client Clients require no manual configuration. Each client is able to discover local configuration parameters is able to discover local configuration parameters without user interventionwithout user intervention
PNP* includes the low level protocol itself, as well as PNP* includes the low level protocol itself, as well as a GUI that demonstrates its capabilities and offers a GUI that demonstrates its capabilities and offers debugging options. debugging options.
WinPCAP level FILTERING of packets (for both TYPE WinPCAP level FILTERING of packets (for both TYPE CODE and correct MAC destination)CODE and correct MAC destination)
Search for machines with specific equipment, IP, or Search for machines with specific equipment, IP, or by machine type.by machine type.
PNP* provides support for embedded s/w in smart PNP* provides support for embedded s/w in smart devices. devices.
NEW Features to PNP* Version NEW Features to PNP* Version 22
““Default subnet mask” (255.255.0.0), in the Default subnet mask” (255.255.0.0), in the case where the machine is alone in the LAN case where the machine is alone in the LAN and it is not a router. and it is not a router.
Simulated IP \ Change IP in OS – 2 modes: Simulated IP \ Change IP in OS – 2 modes: – Actually changing the IP setting in the OSActually changing the IP setting in the OS– Simulation mode- the OS itself will not be changed, Simulation mode- the OS itself will not be changed,
but the protocol will act as though it was. (Default)but the protocol will act as though it was. (Default)
Restore Previous IP Settings- This extra Restore Previous IP Settings- This extra feature enables the user to automatically feature enables the user to automatically undo the changes made by the protocol in undo the changes made by the protocol in “Change IP in OS” mode.“Change IP in OS” mode.
Data StructuresData Structures
Each machine maintains a “LAN_DB” Each machine maintains a “LAN_DB” with an entry per each device. with an entry per each device.
Flexibility: LAN_DB provides 2 Flexibility: LAN_DB provides 2 modes, on a per-machine, per-entry modes, on a per-machine, per-entry basis. basis. 1. memory-limited “smart devices”1. memory-limited “smart devices”: keeps : keeps
only minimal info (IP, MAC, and TYPE), only minimal info (IP, MAC, and TYPE), conserving space and communicationconserving space and communication
2. equipment list:2. equipment list: Optionally, an entry Optionally, an entry may also contain peripheral informationmay also contain peripheral information
PNP* Messages 1PNP* Messages 1
HELLO- informing other machines of this HELLO- informing other machines of this machines’ existence (and aliveness).machines’ existence (and aliveness).
SM_REQUEST – Message requesting subnet SM_REQUEST – Message requesting subnet mask.mask.
SM_REPLY - Reply containing subnet mask.SM_REPLY - Reply containing subnet mask.
GOODBYE – A message indicating that this GOODBYE – A message indicating that this machine is about to disconnect from the machine is about to disconnect from the network, and should be erased from all network, and should be erased from all LAN_DB’s. LAN_DB’s.
PNP* Messages 2PNP* Messages 2
WHO_I_AM – containing the MAC, IP (if WHO_I_AM – containing the MAC, IP (if known), TYPE of sender and INFO_REQUEST known), TYPE of sender and INFO_REQUEST containing one of 3 values:containing one of 3 values:– SEND_NOTHING - SEND_NOTHING - sender doesn’t need reply sender doesn’t need reply
message.message.– SEND_WIASEND_WIA - sender want to receive your WHO_I_AM - sender want to receive your WHO_I_AM
onlyonly..– SEND_EQUIP - SEND_EQUIP - (sender want to receive your (sender want to receive your
equipment details in addition to WHO_I_AM details).equipment details in addition to WHO_I_AM details).
MY_EQUIP – A message containing info about MY_EQUIP – A message containing info about all the equipment attached to this machine in all the equipment attached to this machine in a specific format, and contains a WHO_I_AM a specific format, and contains a WHO_I_AM message.message.
PNP* ModulesPNP* Modules
PNP Protocol
PNP Networking DB
Listener threadEraser thread
I’m Alive threadStart-up thread
MessageHandler
Messages
GUI
Auxiliary ModulesAuxiliary Modules
PNP Networking-PNP Networking- provides functions provides functions to send\receive unicast\broadcast to send\receive unicast\broadcast messages at MAC level. messages at MAC level. – Internally, uses WinPCap.Internally, uses WinPCap.
DBDB- provides functions to store and - provides functions to store and retrieve LAN info.retrieve LAN info.
MessagesMessages- describes message and - describes message and header structure and performs header structure and performs parsing.parsing.
Main ModuleMain Module
PNPProtocol’s “runProtocol()” runs 4 threads:PNPProtocol’s “runProtocol()” runs 4 threads:– I Am Alive ThreadI Am Alive Thread - broadcasts “HELLO” message - broadcasts “HELLO” message
every QUANTOM.every QUANTOM.
– Listener ThreadListener Thread -When an incoming message -When an incoming message arrives, creates an “Event Handler” thread.arrives, creates an “Event Handler” thread.
– Eraser ThreadEraser Thread - tests DB for stations that are not - tests DB for stations that are not responding for a long time , and removes them.responding for a long time , and removes them.
– Start-up ThreadStart-up Thread – Queries the LAN in order to – Queries the LAN in order to select an IP for itself, dealing with possible select an IP for itself, dealing with possible conflicts. conflicts.
PNP* ProtocolPNP* Protocol
Stable ConditionStable Condition
Events on local Events on local machinemachine
New connection New connection (“newbie” start (“newbie” start up)up)
DisconnectionDisconnection
ProtocolProtocolStable ConditionStable Condition
A periodic HELLO message is sent A periodic HELLO message is sent to all machines on the LAN. This to all machines on the LAN. This message is sent in a frequency message is sent in a frequency determined by QUANTOM.determined by QUANTOM.
Listening to all HELLO messages Listening to all HELLO messages from other machines. from other machines.
ProtocolProtocolEvents on local Events on local
machinemachine In case THIS machine wants to get a detailed report of In case THIS machine wants to get a detailed report of
specific machine resources and equipments (such as specific machine resources and equipments (such as printer, scanner, etc…): printer, scanner, etc…): – Sends WHO_I_AM message with Sends WHO_I_AM message with SEND_EQUIP SEND_EQUIP request request
In case of a change (adding/removing equipment)In case of a change (adding/removing equipment)– Broadcasts WHO_I_AM message with Broadcasts WHO_I_AM message with SEND_WIA SEND_WIA requestrequest– Other stations respond with WIA, asking for either Other stations respond with WIA, asking for either
NOTHING or EQUIP.NOTHING or EQUIP.– For each EQUIP request, answer with a message For each EQUIP request, answer with a message
containing the changes that occurred. containing the changes that occurred.
Getting SM_REQUESTGetting SM_REQUEST– replies by SM_REPLY message if knows subnet maskreplies by SM_REPLY message if knows subnet mask
ProtocolProtocol New connection New connection
Step 1-Acquire knowledge about the Step 1-Acquire knowledge about the existence of all machines in the LAN that are existence of all machines in the LAN that are directly running PNPdirectly running PNP– By broadcasting HELLO and listening for returned By broadcasting HELLO and listening for returned
WHO_I_AM messages WHO_I_AM messages
Step 2- Connection to IP networkStep 2- Connection to IP network– Picks an IP for itself from the subnet mask, and Picks an IP for itself from the subnet mask, and
broadcasts it to LAN using a WHO_I_AM broadcasts it to LAN using a WHO_I_AM – Synchronize with other potential new connection Synchronize with other potential new connection
that might choose the same IP.that might choose the same IP.– updates IP definition in operating system updates IP definition in operating system
IP SynchronizationIP SynchronizationGuidelinesGuidelines
In case of conflict between existing machine and a In case of conflict between existing machine and a new machine, the new machine must reselect IPnew machine, the new machine must reselect IP– Rational: Setting the IP in the OS is a long, heavy Rational: Setting the IP in the OS is a long, heavy
operation which we try to avoid. In addition, informing operation which we try to avoid. In addition, informing the LAN is a long process. Therefore, we prefer to change the LAN is a long process. Therefore, we prefer to change the IP of the newbie, which did not yet set a permanent the IP of the newbie, which did not yet set a permanent IP.IP.
In case of conflict between 2 new machines, the In case of conflict between 2 new machines, the machine with the lowest MAC “wins” (gets to keep machine with the lowest MAC “wins” (gets to keep its IP), and other one must retry.its IP), and other one must retry.– Rational: To break symmetry.Rational: To break symmetry.
IP SynchronizationIP SynchronizationImplementationImplementation
2 simultaneous newbies2 simultaneous newbies– Cause: Both connect at same time and choose same IPCause: Both connect at same time and choose same IP– Solution: Each receives message from the other. Breaking symmetry- Solution: Each receives message from the other. Breaking symmetry-
The machine with lowest MAC keeps its IP, and the other selects new The machine with lowest MAC keeps its IP, and the other selects new IP and broadcasts it.IP and broadcasts it.
1 newbie grabs IP of existing machine1 newbie grabs IP of existing machine– Cause: Existing machine delayed while newbie connecting, and the Cause: Existing machine delayed while newbie connecting, and the
formers MAC is larger. formers MAC is larger. – Solution: Newbie tries to break symmetry. Waits until the other selects Solution: Newbie tries to break symmetry. Waits until the other selects
new IP. If it times out, newbie relinquishes its IP and selects a new one.new IP. If it times out, newbie relinquishes its IP and selects a new one.
Conflict between 2 existing machinesConflict between 2 existing machines– Cause: Existing machine is delayed long enough for a new machine to Cause: Existing machine is delayed long enough for a new machine to
finish its startup stage, using the same IP.finish its startup stage, using the same IP.– Solution: The delayed machine detects that it did not send a message Solution: The delayed machine detects that it did not send a message
for a “long” time and goes into “newbie” status.for a “long” time and goes into “newbie” status.
ProtocolProtocol Disconnection Disconnection
If the machine initiated disconnection If the machine initiated disconnection intentionally- it broadcasts a GOODBYE intentionally- it broadcasts a GOODBYE message. Any machine receiving such message. Any machine receiving such a message should delete the matching a message should delete the matching entry from its DB. entry from its DB.
In case the connection if disrupted, the In case the connection if disrupted, the problem is detected when no messages problem is detected when no messages from the machines are received for a from the machines are received for a fixed number of quantums. fixed number of quantums.
GUIGUI
The GUI is composed of a window The GUI is composed of a window containing:This machines’ details, as will be containing:This machines’ details, as will be broadcast to others.A list of all other broadcast to others.A list of all other machines detected using the protocol machines detected using the protocol
For each machine, the GUI will give the For each machine, the GUI will give the option of presenting more details about it, option of presenting more details about it, including its available features and resources including its available features and resources (Connected peripherals, etc.) (Connected peripherals, etc.)
In addition, as a debug aid, the GUI enables In addition, as a debug aid, the GUI enables two options: two options: – Add a peripheral to this machine (virtual or a real Add a peripheral to this machine (virtual or a real
peripheral that was removed) peripheral that was removed) – remove a peripheral from this machine (virtual or remove a peripheral from this machine (virtual or
real) real)
GUI- main screenGUI- main screen
GUI- local settingsGUI- local settings
GUI- search panelGUI- search panel
DemoDemo
NEWBIE
LAN
HELLO
In Demo, NEWBIE initially doesn’t want to know about equipment
DemoDemo
NEWBIE
LAN
WIA_SEND_WIA
WIA_SEND_WIA
WIA_SEND_EQUIP
DemoDemo
NEWBIE
LAN
WIA_SEND_NOTHING
MY_EQUIP_SEND_NOTHING
WIA_SEND_NOTHING
DemoDemo
LAN
WIA_SEND_EQUIP
Now interested in m1’s equipment
m1
DemoDemo
NEWBIE
LAN
MY_EQUIP_SEND_NOTHING
DemoDemo
NEWBIE
LAN
HELLO
HELLO
HELLO
HELLO
STABLE CONDITION
DemoDemo
NEWBIE
LAN
GOODBYE
DemoDemo
LAN
HELLO
HELLO
HELLO
Test ResultsTest Results
Experiment IP Chosen
Detected machines
Detected Equipment
Was detected by others
Disconnected Correctly
GUI Operational
Router alone YES NO NO NO YES YES
M1 YES ROUTER ONLY
ROUTER ONLY
YES YES YES
M1+M2 connect at different times
YES YES YES YES YES YES
M1 connect/ disconnect. M2 connect/disconnect
YES ROUTER ONLY
ROUTER ONLY
YES YES YES
M1, M2, M3, M4 connect at different times
YES YES YES YES YES YES
M1 connected; M2 & M3 connect simultaneously
YES YES YES YES YES YES
M1 delayed; M2 connects and chooses same IP.
YES YES YES YES YES YES
M2 connectedM1 connect/ disconnect. M1 connects again
YES YES YES YES YES YES
Future extensionsFuture extensions
Device driver interaction for Device driver interaction for various standard devices, i.e to various standard devices, i.e to enable actual printing to a enable actual printing to a printer, or scanning using another printer, or scanning using another machine’s scanner, etc.machine’s scanner, etc.
Automatic detection of local Automatic detection of local peripheralsperipherals
Ports to other OS’sPorts to other OS’s
ConclusionsConclusions
PNP* can be the basis for a protocol, PNP* can be the basis for a protocol, incorporated into CISCO’s future incorporated into CISCO’s future networking equipment to provide a much networking equipment to provide a much more comfortable networking experience more comfortable networking experience for the home user.for the home user.
The project has provided us with real world The project has provided us with real world experience designing network protocols.experience designing network protocols.
Our thanks go to our advisors: Danny Raz, Our thanks go to our advisors: Danny Raz, Itai Dabran and Michael Liflian.Itai Dabran and Michael Liflian.