DHCP works better with vlans, added some puzzles

This commit is contained in:
Tim Young 2016-10-28 10:17:13 -05:00
parent 58ce4f64fa
commit b945f93eaf
20 changed files with 8806 additions and 56 deletions

View File

@ -278,6 +278,12 @@
<None Include="Resources\Level5_WirelessRepeater.enbx" /> <None Include="Resources\Level5_WirelessRepeater.enbx" />
<None Include="Resources\Level5_WirelessRepeater2.enbx" /> <None Include="Resources\Level5_WirelessRepeater2.enbx" />
<None Include="Resources\Level5_WirelessRouters.enbx" /> <None Include="Resources\Level5_WirelessRouters.enbx" />
<None Include="Resources\Level6_ForbiddenVLAN.enbx" />
<None Include="Resources\Level6_TaggedBetweenSwitches.enbx" />
<None Include="Resources\Level6_VLANRouting.enbx" />
<None Include="Resources\Level6_VLANRouting2.enbx" />
<None Include="Resources\Level6_VLAN_Intro.enbx" />
<None Include="Resources\Level6_VLAN_Intro2.enbx" />
<None Include="Resources\OneNet.enbx" /> <None Include="Resources\OneNet.enbx" />
<None Include="Resources\ThreeNets.enbx" /> <None Include="Resources\ThreeNets.enbx" />
<None Include="Resources\TwoNets.enbx" /> <None Include="Resources\TwoNets.enbx" />
@ -344,6 +350,7 @@
<None Include="Resources\noBeep.wav" /> <None Include="Resources\noBeep.wav" />
<None Include="Resources\tablet.png" /> <None Include="Resources\tablet.png" />
<None Include="Resources\PC.png" /> <None Include="Resources\PC.png" />
<None Include="Resources\VLAN.enbx" />
<None Include="Resources\WRepeater.png" /> <None Include="Resources\WRepeater.png" />
<None Include="Resources\WBridge.png" /> <None Include="Resources\WBridge.png" />
<None Include="Resources\WRouter.png" /> <None Include="Resources\WRouter.png" />

View File

@ -70,7 +70,10 @@ namespace EduNetworkBuilder
Level4_DualWans, Level4_SinglesLife, Level4_SmallSubnets, Level4_OneRoute, Level4_RouterReplacement, Level4_DualWans, Level4_SinglesLife, Level4_SmallSubnets, Level4_OneRoute, Level4_RouterReplacement,
Level4_InternalSubnetting, Level4_Internalhemorrhage, Level4_InternalSubnetting, Level4_Internalhemorrhage,
Level5_WirelessRouters, Level5_WirelessDevices, Level5_WirelessBridge, Level5_WirelessRepeater, Level5_WirelessRepeater2, Level5_WirelessRouters, Level5_WirelessDevices, Level5_WirelessBridge, Level5_WirelessRepeater, Level5_WirelessRepeater2,
Level5_WirelessAccessPoint, Level5_WirelessCorruption, Level5_Failed, Level5_LostPacket, Level5_HereComesTrouble Level5_WirelessAccessPoint, Level5_WirelessCorruption, Level5_Failed, Level5_LostPacket, Level5_HereComesTrouble,
Level6_VLAN_Intro, Level6_VLAN_Intro2, Level6_ForbiddenVLAN, Level6_TaggedBetweenSwitches, Level6_VLANRouting,
Level6_VLANRouting2,
} }
public enum DebugPausePoint { none=0, packet_create=1, packet_kill=2, public enum DebugPausePoint { none=0, packet_create=1, packet_kill=2,
packet_in=4, packet_out=8, packet_duplicate=16, all=63, packet_in=4, packet_out=8, packet_duplicate=16, all=63,
@ -233,7 +236,7 @@ namespace EduNetworkBuilder
public static string ZeroIPString = "0.0.0.0"; public static string ZeroIPString = "0.0.0.0";
public static string LoopbackIPString = "127.0.0.1"; public static string LoopbackIPString = "127.0.0.1";
public static int LinkStep = 8;//The percentage of the link we move at each "tick" public static int LinkStep = 8;//The percentage of the link we move at each "tick"
public static int PacketPixelSize = 8; //The size of the packet pixel public static int PacketPixelSize = 16; //The size of the packet pixel
public static int PacketVersionNum = 2; //2 uses the new stuff. Anything else uses the old stuff public static int PacketVersionNum = 2; //2 uses the new stuff. Anything else uses the old stuff
public const int GridSize = 10; public const int GridSize = 10;
public static string[,] LanguageChoices = { { NB.Translate("NB_NBEn"), "en" }, { NB.Translate("NB_NBFr"), "fr" } }; public static string[,] LanguageChoices = { { NB.Translate("NB_NBEn"), "en" }, { NB.Translate("NB_NBFr"), "fr" } };

View File

@ -525,7 +525,6 @@ namespace EduNetworkBuilder
if (TheTest == NetTestType.NeedsForbiddenVLAN && vi.Tag == VLANTagType.Forbidden) return true; if (TheTest == NetTestType.NeedsForbiddenVLAN && vi.Tag == VLANTagType.Forbidden) return true;
if (TheTest == NetTestType.NeedsUntaggedVLAN && vi.Tag == VLANTagType.Untagged) return true; if (TheTest == NetTestType.NeedsUntaggedVLAN && vi.Tag == VLANTagType.Untagged) return true;
if (TheTest == NetTestType.NeedsTaggedVLAN && vi.Tag == VLANTagType.Tagged) return true; if (TheTest == NetTestType.NeedsTaggedVLAN && vi.Tag == VLANTagType.Tagged) return true;
return false;
break; break;
case NetTestType.LockAll: case NetTestType.LockAll:
case NetTestType.LockDHCP: case NetTestType.LockDHCP:

View File

@ -9,6 +9,7 @@ using System.Xml;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing.Imaging;
namespace EduNetworkBuilder namespace EduNetworkBuilder
@ -55,6 +56,9 @@ namespace EduNetworkBuilder
private bool previously_had_packets = false; //used on "tick" to determine if we are starting from scratch private bool previously_had_packets = false; //used on "tick" to determine if we are starting from scratch
private List<Color> PacketColors = new List<Color>();
private List<Image> PacketImages = new List<Image>();
public Network(string Name) public Network(string Name)
{ {
TheNetImage = new Bitmap(myWidth, myHeight); TheNetImage = new Bitmap(myWidth, myHeight);
@ -180,9 +184,19 @@ namespace EduNetworkBuilder
{ {
int ID; int ID;
int.TryParse(Individual.Attributes["ID"].Value, out ID); int.TryParse(Individual.Attributes["ID"].Value, out ID);
string colorname = "Blue";
if (Individual.Attributes["Color"] != null)
colorname = Individual.Attributes["Color"].Value;
Color PacketColor = Color.FromName(colorname);
if (ID > 1) if (ID > 1)
{ {
VlanNames.Add(new VLANName(ID, Individual.InnerText)); VlanNames.Add(new VLANName(ID, Individual.InnerText, PacketColor));
VLANsEnabled = true;
}
else
{
VlanNames.RemoveAt(0);
VlanNames.Insert(0,new VLANName(ID, Individual.InnerText, PacketColor));
VLANsEnabled = true; VLANsEnabled = true;
} }
} }
@ -292,6 +306,7 @@ namespace EduNetworkBuilder
{ {
writer.WriteStartElement("VLANName"); writer.WriteStartElement("VLANName");
writer.WriteAttributeString("ID", VLAN.ID.ToString()); writer.WriteAttributeString("ID", VLAN.ID.ToString());
writer.WriteAttributeString("Color", VLAN.PacketColorString);
writer.WriteString(VLAN.Name); writer.WriteString(VLAN.Name);
writer.WriteEndElement(); writer.WriteEndElement();
} }
@ -1404,6 +1419,72 @@ namespace EduNetworkBuilder
} }
} }
} }
public Image GetPacketImage(Color PacketColor)
{
if(PacketColors.Contains(PacketColor))
{
return PacketImages[PacketColors.IndexOf(PacketColor)];
}
PacketColors.Add(PacketColor);
Image newPacketImage = new Bitmap(NB.PacketPixelSize, NB.PacketPixelSize);
using (Graphics G = Graphics.FromImage(newPacketImage))
{
G.Clear(Color.Transparent);
// Pen myPen = new Pen(PacketColor, NB.PacketPixelSize);
Brush tBrush = new SolidBrush(PacketColor);
G.FillEllipse(tBrush, 0,0, NB.PacketPixelSize, NB.PacketPixelSize);
}
PacketImages.Add(newPacketImage);
return newPacketImage;
}
public Color ColorFromPacketVLAN(int id)
{
foreach(VLANName VN in VlanNames)
{
if (VN.ID == id)
return VN.PacketColor;
}
return Color.Blue;
}
//This function heavily borrowed from: http://stackoverflow.com/questions/1563038/fast-work-with-bitmaps-in-c-sharp
public Image ColoredImage(Image BaseImage, Color MorphColor)
{
Bitmap b = new Bitmap(BaseImage);
BitmapData bData = b.LockBits(new Rectangle(0, 0, BaseImage.Width, BaseImage.Height), ImageLockMode.ReadWrite, b.PixelFormat);
/* GetBitsPerPixel just does a switch on the PixelFormat and returns the number */
int bitsPerPixel = Image.GetPixelFormatSize(bData.PixelFormat);
/*the size of the image in bytes */
int size = bData.Stride * bData.Height;
/*Allocate buffer for image*/
byte[] data = new byte[size];
/*This overload copies data of /size/ into /data/ from location specified (/Scan0/)*/
System.Runtime.InteropServices.Marshal.Copy(bData.Scan0, data, 0, size);
for (int i = 0; i < size; i += bitsPerPixel / 8)
{
//double magnitude = 1 / 3d * (data[i] + data[i + 1] + data[i + 2]);
//data[i] is the first of 3 bytes of color
data[i] = (byte)((data[i] + MorphColor.B) / 2);
data[i + 1] = (byte)((data[i + 1] + MorphColor.G) / 2);
data[i + 2] = (byte)((data[i + 2] + MorphColor.R) / 2);
}
/* This override copies the data back into the location specified */
System.Runtime.InteropServices.Marshal.Copy(data, 0, bData.Scan0, data.Length);
b.UnlockBits(bData);
return b;
}
} }
} }

View File

@ -78,6 +78,8 @@
this.HelpPanel = new System.Windows.Forms.Panel(); this.HelpPanel = new System.Windows.Forms.Panel();
this.cbViewTitles = new System.Windows.Forms.CheckBox(); this.cbViewTitles = new System.Windows.Forms.CheckBox();
this.myProgressBar = new System.Windows.Forms.ProgressBar(); this.myProgressBar = new System.Windows.Forms.ProgressBar();
this.VLANToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SolvedVLANToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.msMainMenuStrip.SuspendLayout(); this.msMainMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit();
this.HelpPanel.SuspendLayout(); this.HelpPanel.SuspendLayout();
@ -94,8 +96,8 @@
this.samplesToolStripMenuItem}); this.samplesToolStripMenuItem});
this.msMainMenuStrip.Location = new System.Drawing.Point(0, 0); this.msMainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.msMainMenuStrip.Name = "msMainMenuStrip"; this.msMainMenuStrip.Name = "msMainMenuStrip";
this.msMainMenuStrip.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2); this.msMainMenuStrip.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
this.msMainMenuStrip.Size = new System.Drawing.Size(463, 28); this.msMainMenuStrip.Size = new System.Drawing.Size(617, 28);
this.msMainMenuStrip.TabIndex = 0; this.msMainMenuStrip.TabIndex = 0;
this.msMainMenuStrip.Text = "msMainMenuStrip"; this.msMainMenuStrip.Text = "msMainMenuStrip";
// //
@ -287,7 +289,7 @@
// puzzlesToolStripMenuItem // puzzlesToolStripMenuItem
// //
this.puzzlesToolStripMenuItem.Name = "puzzlesToolStripMenuItem"; this.puzzlesToolStripMenuItem.Name = "puzzlesToolStripMenuItem";
this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.puzzlesToolStripMenuItem.Text = "Puzzles"; this.puzzlesToolStripMenuItem.Text = "Puzzles";
this.puzzlesToolStripMenuItem.Click += new System.EventHandler(this.puzzlesToolStripMenuItem_Click); this.puzzlesToolStripMenuItem.Click += new System.EventHandler(this.puzzlesToolStripMenuItem_Click);
// //
@ -298,9 +300,10 @@
this.oneNetworkToolStripMenuItem, this.oneNetworkToolStripMenuItem,
this.twoNetworksToolStripMenuItem, this.twoNetworksToolStripMenuItem,
this.threeNetworksToolStripMenuItem, this.threeNetworksToolStripMenuItem,
this.firewallsToolStripMenuItem}); this.firewallsToolStripMenuItem,
this.VLANToolStripMenuItem});
this.solvedToolStripMenuItem.Name = "solvedToolStripMenuItem"; this.solvedToolStripMenuItem.Name = "solvedToolStripMenuItem";
this.solvedToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.solvedToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.solvedToolStripMenuItem.Text = "Solved"; this.solvedToolStripMenuItem.Text = "Solved";
// //
// dHCPToolStripMenuItem // dHCPToolStripMenuItem
@ -345,9 +348,10 @@
this.solvedOneNetworkToolStripMenuItem, this.solvedOneNetworkToolStripMenuItem,
this.solvedTwoNetworksToolStripMenuItem, this.solvedTwoNetworksToolStripMenuItem,
this.SolvedThreeNetworksToolStripMenuItem, this.SolvedThreeNetworksToolStripMenuItem,
this.firewallsToolStripMenuItem1}); this.firewallsToolStripMenuItem1,
this.SolvedVLANToolStripMenuItem1});
this.toSolveToolStripMenuItem.Name = "toSolveToolStripMenuItem"; this.toSolveToolStripMenuItem.Name = "toSolveToolStripMenuItem";
this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(140, 26); this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.toSolveToolStripMenuItem.Text = "To Solve"; this.toSolveToolStripMenuItem.Text = "To Solve";
// //
// solvedDHCPToolStripMenuItem // solvedDHCPToolStripMenuItem
@ -389,10 +393,10 @@
// //
this.panelChoices.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.panelChoices.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.panelChoices.Location = new System.Drawing.Point(10, 25); this.panelChoices.Location = new System.Drawing.Point(13, 31);
this.panelChoices.Margin = new System.Windows.Forms.Padding(2); this.panelChoices.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panelChoices.Name = "panelChoices"; this.panelChoices.Name = "panelChoices";
this.panelChoices.Size = new System.Drawing.Size(59, 300); this.panelChoices.Size = new System.Drawing.Size(79, 369);
this.panelChoices.TabIndex = 2; this.panelChoices.TabIndex = 2;
// //
// lbMessages // lbMessages
@ -402,10 +406,10 @@
this.lbMessages.Font = new System.Drawing.Font("Courier New", 8F); this.lbMessages.Font = new System.Drawing.Font("Courier New", 8F);
this.lbMessages.FormattingEnabled = true; this.lbMessages.FormattingEnabled = true;
this.lbMessages.ItemHeight = 16; this.lbMessages.ItemHeight = 16;
this.lbMessages.Location = new System.Drawing.Point(74, 329); this.lbMessages.Location = new System.Drawing.Point(99, 405);
this.lbMessages.Margin = new System.Windows.Forms.Padding(2); this.lbMessages.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lbMessages.Name = "lbMessages"; this.lbMessages.Name = "lbMessages";
this.lbMessages.Size = new System.Drawing.Size(366, 52); this.lbMessages.Size = new System.Drawing.Size(487, 52);
this.lbMessages.TabIndex = 3; this.lbMessages.TabIndex = 3;
this.lbMessages.DoubleClick += new System.EventHandler(this.lbMessages_DoubleClick); this.lbMessages.DoubleClick += new System.EventHandler(this.lbMessages_DoubleClick);
// //
@ -413,10 +417,9 @@
// //
this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.lblStatus.Location = new System.Drawing.Point(74, 400); this.lblStatus.Location = new System.Drawing.Point(99, 492);
this.lblStatus.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblStatus.Name = "lblStatus"; this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(365, 14); this.lblStatus.Size = new System.Drawing.Size(487, 17);
this.lblStatus.TabIndex = 4; this.lblStatus.TabIndex = 4;
this.lblStatus.Text = "lblStatus"; this.lblStatus.Text = "lblStatus";
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -427,10 +430,10 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pbNetworkView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pbNetworkView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pbNetworkView.Location = new System.Drawing.Point(74, 25); this.pbNetworkView.Location = new System.Drawing.Point(99, 31);
this.pbNetworkView.Margin = new System.Windows.Forms.Padding(2); this.pbNetworkView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pbNetworkView.Name = "pbNetworkView"; this.pbNetworkView.Name = "pbNetworkView";
this.pbNetworkView.Size = new System.Drawing.Size(366, 300); this.pbNetworkView.Size = new System.Drawing.Size(487, 369);
this.pbNetworkView.TabIndex = 1; this.pbNetworkView.TabIndex = 1;
this.pbNetworkView.TabStop = false; this.pbNetworkView.TabStop = false;
this.pbNetworkView.DoubleClick += new System.EventHandler(this.pbNetworkView_DoubleClick); this.pbNetworkView.DoubleClick += new System.EventHandler(this.pbNetworkView_DoubleClick);
@ -441,10 +444,10 @@
// btnHelp // btnHelp
// //
this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnHelp.Location = new System.Drawing.Point(2, 27); this.btnHelp.Location = new System.Drawing.Point(3, 33);
this.btnHelp.Margin = new System.Windows.Forms.Padding(2); this.btnHelp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnHelp.Name = "btnHelp"; this.btnHelp.Name = "btnHelp";
this.btnHelp.Size = new System.Drawing.Size(21, 20); this.btnHelp.Size = new System.Drawing.Size(28, 25);
this.btnHelp.TabIndex = 5; this.btnHelp.TabIndex = 5;
this.btnHelp.Text = "?"; this.btnHelp.Text = "?";
this.btnHelp.UseVisualStyleBackColor = true; this.btnHelp.UseVisualStyleBackColor = true;
@ -454,8 +457,8 @@
// //
this.rbHelp4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.rbHelp4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.rbHelp4.AutoSize = true; this.rbHelp4.AutoSize = true;
this.rbHelp4.Location = new System.Drawing.Point(5, 53); this.rbHelp4.Location = new System.Drawing.Point(13, 65);
this.rbHelp4.Margin = new System.Windows.Forms.Padding(2); this.rbHelp4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.rbHelp4.Name = "rbHelp4"; this.rbHelp4.Name = "rbHelp4";
this.rbHelp4.Size = new System.Drawing.Size(17, 16); this.rbHelp4.Size = new System.Drawing.Size(17, 16);
this.rbHelp4.TabIndex = 6; this.rbHelp4.TabIndex = 6;
@ -466,8 +469,8 @@
// //
this.rbHelp3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.rbHelp3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.rbHelp3.AutoSize = true; this.rbHelp3.AutoSize = true;
this.rbHelp3.Location = new System.Drawing.Point(5, 69); this.rbHelp3.Location = new System.Drawing.Point(13, 85);
this.rbHelp3.Margin = new System.Windows.Forms.Padding(2); this.rbHelp3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.rbHelp3.Name = "rbHelp3"; this.rbHelp3.Name = "rbHelp3";
this.rbHelp3.Size = new System.Drawing.Size(17, 16); this.rbHelp3.Size = new System.Drawing.Size(17, 16);
this.rbHelp3.TabIndex = 7; this.rbHelp3.TabIndex = 7;
@ -478,8 +481,8 @@
// //
this.rbHelp2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.rbHelp2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.rbHelp2.AutoSize = true; this.rbHelp2.AutoSize = true;
this.rbHelp2.Location = new System.Drawing.Point(5, 87); this.rbHelp2.Location = new System.Drawing.Point(13, 107);
this.rbHelp2.Margin = new System.Windows.Forms.Padding(2); this.rbHelp2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.rbHelp2.Name = "rbHelp2"; this.rbHelp2.Name = "rbHelp2";
this.rbHelp2.Size = new System.Drawing.Size(17, 16); this.rbHelp2.Size = new System.Drawing.Size(17, 16);
this.rbHelp2.TabIndex = 8; this.rbHelp2.TabIndex = 8;
@ -491,8 +494,8 @@
this.rbHelp1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.rbHelp1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.rbHelp1.AutoSize = true; this.rbHelp1.AutoSize = true;
this.rbHelp1.Checked = true; this.rbHelp1.Checked = true;
this.rbHelp1.Location = new System.Drawing.Point(5, 105); this.rbHelp1.Location = new System.Drawing.Point(13, 129);
this.rbHelp1.Margin = new System.Windows.Forms.Padding(2); this.rbHelp1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.rbHelp1.Name = "rbHelp1"; this.rbHelp1.Name = "rbHelp1";
this.rbHelp1.Size = new System.Drawing.Size(17, 16); this.rbHelp1.Size = new System.Drawing.Size(17, 16);
this.rbHelp1.TabIndex = 9; this.rbHelp1.TabIndex = 9;
@ -509,16 +512,17 @@
this.HelpPanel.Controls.Add(this.rbHelp1); this.HelpPanel.Controls.Add(this.rbHelp1);
this.HelpPanel.Controls.Add(this.rbHelp3); this.HelpPanel.Controls.Add(this.rbHelp3);
this.HelpPanel.Controls.Add(this.rbHelp2); this.HelpPanel.Controls.Add(this.rbHelp2);
this.HelpPanel.Location = new System.Drawing.Point(438, 25); this.HelpPanel.Location = new System.Drawing.Point(584, 31);
this.HelpPanel.Margin = new System.Windows.Forms.Padding(2); this.HelpPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HelpPanel.Name = "HelpPanel"; this.HelpPanel.Name = "HelpPanel";
this.HelpPanel.Size = new System.Drawing.Size(25, 300); this.HelpPanel.Size = new System.Drawing.Size(33, 369);
this.HelpPanel.TabIndex = 10; this.HelpPanel.TabIndex = 10;
// //
// cbViewTitles // cbViewTitles
// //
this.cbViewTitles.AutoSize = true; this.cbViewTitles.AutoSize = true;
this.cbViewTitles.Location = new System.Drawing.Point(5, 7); this.cbViewTitles.Location = new System.Drawing.Point(7, 9);
this.cbViewTitles.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbViewTitles.Name = "cbViewTitles"; this.cbViewTitles.Name = "cbViewTitles";
this.cbViewTitles.Size = new System.Drawing.Size(18, 17); this.cbViewTitles.Size = new System.Drawing.Size(18, 17);
this.cbViewTitles.TabIndex = 10; this.cbViewTitles.TabIndex = 10;
@ -528,18 +532,32 @@
// myProgressBar // myProgressBar
// //
this.myProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.myProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.myProgressBar.Location = new System.Drawing.Point(10, 329); this.myProgressBar.Location = new System.Drawing.Point(13, 405);
this.myProgressBar.Margin = new System.Windows.Forms.Padding(2); this.myProgressBar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.myProgressBar.Name = "myProgressBar"; this.myProgressBar.Name = "myProgressBar";
this.myProgressBar.Size = new System.Drawing.Size(59, 19); this.myProgressBar.Size = new System.Drawing.Size(79, 23);
this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.myProgressBar.TabIndex = 11; this.myProgressBar.TabIndex = 11;
// //
// VLANToolStripMenuItem
//
this.VLANToolStripMenuItem.Name = "VLANToolStripMenuItem";
this.VLANToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.VLANToolStripMenuItem.Text = "VLAN";
this.VLANToolStripMenuItem.Click += new System.EventHandler(this.VLANToolStripMenuItem_Click);
//
// SolvedVLANToolStripMenuItem1
//
this.SolvedVLANToolStripMenuItem1.Name = "SolvedVLANToolStripMenuItem1";
this.SolvedVLANToolStripMenuItem1.Size = new System.Drawing.Size(187, 26);
this.SolvedVLANToolStripMenuItem1.Text = "VLAN";
this.SolvedVLANToolStripMenuItem1.Click += new System.EventHandler(this.SolvedVLANToolStripMenuItem1_Click);
//
// BuilderWindow // BuilderWindow
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(463, 412); this.ClientSize = new System.Drawing.Size(617, 507);
this.Controls.Add(this.myProgressBar); this.Controls.Add(this.myProgressBar);
this.Controls.Add(this.lblStatus); this.Controls.Add(this.lblStatus);
this.Controls.Add(this.lbMessages); this.Controls.Add(this.lbMessages);
@ -549,7 +567,7 @@
this.Controls.Add(this.HelpPanel); this.Controls.Add(this.HelpPanel);
this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco; this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco;
this.MainMenuStrip = this.msMainMenuStrip; this.MainMenuStrip = this.msMainMenuStrip;
this.Margin = new System.Windows.Forms.Padding(2); this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "BuilderWindow"; this.Name = "BuilderWindow";
this.Text = "Network Builder"; this.Text = "Network Builder";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BuilderWindow_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BuilderWindow_FormClosing);
@ -618,6 +636,8 @@
private System.Windows.Forms.ProgressBar myProgressBar; private System.Windows.Forms.ProgressBar myProgressBar;
private System.Windows.Forms.ToolStripMenuItem changeLanguageToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem changeLanguageToolStripMenuItem;
private System.Windows.Forms.CheckBox cbViewTitles; private System.Windows.Forms.CheckBox cbViewTitles;
private System.Windows.Forms.ToolStripMenuItem VLANToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem SolvedVLANToolStripMenuItem1;
} }
} }

View File

@ -1207,6 +1207,21 @@ namespace EduNetworkBuilder
UpdateMessages(); UpdateMessages();
} }
private void VLANToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadNetworkFromResource("VLAN");
UpdateMessages();
}
private void SolvedVLANToolStripMenuItem1_Click(object sender, EventArgs e)
{
LoadNetworkFromResource("VLAN");
myNetwork.DoAllClearIPs();
UpdateMessages();
UpdateVisuals();
}
private void threeNetworksToolStripMenuItem_Click(object sender, EventArgs e) private void threeNetworksToolStripMenuItem_Click(object sender, EventArgs e)
{ {
LoadNetworkFromResource("ThreeNets"); LoadNetworkFromResource("ThreeNets");
@ -1377,5 +1392,6 @@ namespace EduNetworkBuilder
UpdateVisuals(); UpdateVisuals();
} }
} }
} }
} }

View File

@ -464,11 +464,15 @@ namespace EduNetworkBuilder
case NicType.eth: case NicType.eth:
case NicType.wlan: case NicType.wlan:
//see if it the packet dest is local to this nic //see if it the packet dest is local to this nic
if (tPacket.MyType == PacketType.dhcp_answer)
Console.WriteLine("DHCP Answer");
foreach (NetworkInterface nf in interfaces.ToList()) foreach (NetworkInterface nf in interfaces.ToList())
{ {
if (tPacket.InboundNic != null && tPacket.InboundNic == this && if (tPacket.InboundNic != null && tPacket.InboundNic == this &&
tPacket.InboundInterface != null && tPacket.InboundInterface == nf) tPacket.InboundInterface != null && tPacket.InboundInterface == nf)
continue; //skip sending it out this interface if it came in this interface. continue; //skip sending it out this interface if it came in this interface.
if (tPacket.MyType == PacketType.dhcp_answer && tPacket.isFresh && tPacket.payloadIP != null && !nf.isLocal(tPacket.payloadIP))
continue; //If it is a dhcp broadcast, only send it out the interface it belongs to
if (tPacket.MyType == PacketType.arp_request && !nf.isLocal(tPacket.destIP)) if (tPacket.MyType == PacketType.arp_request && !nf.isLocal(tPacket.destIP))
continue; //only send out arp requests on local networks continue; //only send out arp requests on local networks
nPacket = new Packet(tPacket);//Creates a new packet but sets isfresh=false nPacket = new Packet(tPacket);//Creates a new packet but sets isfresh=false

View File

@ -1498,8 +1498,8 @@ namespace EduNetworkBuilder
if (BroadcastMatch && tPacket.MyType != PacketType.dhcp_answer) if (BroadcastMatch && tPacket.MyType != PacketType.dhcp_answer)
tPacket.OutboundDestMAC = NB.BroadcastMACString; tPacket.OutboundDestMAC = NB.BroadcastMACString;
tPacket.destMAC = tPacket.OutboundDestMAC; tPacket.destMAC = tPacket.OutboundDestMAC;
//wearehere; //set the vlan id to 1 probably so we adopt the outgoing vlan
if(nic.SendPacketOutNIC(tPacket)) if (nic.SendPacketOutNIC(tPacket))
{ {
count++; count++;
if (nic.GetNicType == NicType.wan) if (nic.GetNicType == NicType.wan)
@ -1821,12 +1821,14 @@ namespace EduNetworkBuilder
if (tPacket.InboundInterface == null) if (tPacket.InboundInterface == null)
{ {
dst = RequestDHCPLease(tPacket.sourceMAC, tPacket.OutboundIP); dst = RequestDHCPLease(tPacket.sourceMAC, tPacket.OutboundIP);
nPacket.OutboundIP = tPacket.OutboundIP;
} }
else else
{ {
dst = RequestDHCPLease(tPacket.sourceMAC, tPacket.InboundInterface.myIP); dst = RequestDHCPLease(tPacket.sourceMAC, tPacket.InboundInterface.myIP);
nPacket.OutboundIP = tPacket.InboundInterface.myIP;
} }
//if we the packet came in on a port... //if the packet came in on a port...
if (tPacket.InboundNic != null && (tPacket.InboundNic.GetNicType == NicType.wport || tPacket.InboundNic.GetNicType == NicType.port)) if (tPacket.InboundNic != null && (tPacket.InboundNic.GetNicType == NicType.wport || tPacket.InboundNic.GetNicType == NicType.port))
{ {
IPAddress theIP = HubManagementIP(); IPAddress theIP = HubManagementIP();
@ -2647,8 +2649,13 @@ namespace EduNetworkBuilder
} }
foreach(ArpEntry dhcp in DHCPLeases) foreach(ArpEntry dhcp in DHCPLeases)
{ {
if (dhcp.MACAddress == MAC && dhcp.IPAddr != NB.ZeroIPString && NIC_IP != null && gateway != null) if (dhcp.MACAddress == MAC && dhcp.IPAddr != NB.ZeroIPString && NIC_IP != null && gateway != null)
return new IPAddress(dhcp.IPAddr, NIC_IP.GetMask.ToIpString(), gateway.GetIP.ToIpString()); {
IPAddress addr = new IPAddress(dhcp.IPAddr, NIC_IP.GetMask.ToIpString(), gateway.GetIP.ToIpString());
if (addr.IsLocal(NIC_IP))
return addr;
}
} }
return null; return null;
} }
@ -2680,7 +2687,8 @@ namespace EduNetworkBuilder
if (NIC_IP == null) if (NIC_IP == null)
NIC_IP = HubManagementIP(); NIC_IP = HubManagementIP();
IPAddress tAddress = LookupDHCPLease(MAC, NIC_IP); IPAddress tAddress = LookupDHCPLease(MAC, NIC_IP);
if (tAddress != null) return tAddress; if (tAddress != null && NIC_IP.IsLocal(tAddress))
return tAddress;
//if we are here, we need to find an address to give. //if we are here, we need to find an address to give.
bool stillOK = true; bool stillOK = true;

View File

@ -191,6 +191,7 @@ namespace EduNetworkBuilder
VLANTagType What = VI.Tag; VLANTagType What = VI.Tag;
Network theNet = NB.GetNetwork(); Network theNet = NB.GetNetwork();
NetworkDevice HD = theNet.GetDeviceFromID(AttachedToHostNic); NetworkDevice HD = theNet.GetDeviceFromID(AttachedToHostNic);
if (HD == null) return; //Oops! Something went wrong.
string hostname = HD.hostname; string hostname = HD.hostname;
if (What == VLANTagType.Forbidden) if (What == VLANTagType.Forbidden)
@ -321,6 +322,7 @@ namespace EduNetworkBuilder
VLANTagType What = VI.Tag; VLANTagType What = VI.Tag;
Network theNet = NB.GetNetwork(); Network theNet = NB.GetNetwork();
NetworkDevice HD = theNet.GetDeviceFromID(AttachedToHostNic); NetworkDevice HD = theNet.GetDeviceFromID(AttachedToHostNic);
if (HD == null) return;
string hostname = HD.hostname; string hostname = HD.hostname;
if (What == VLANTagType.Forbidden) if (What == VLANTagType.Forbidden)

View File

@ -231,8 +231,24 @@ namespace EduNetworkBuilder
pencolor = Color.Orange; pencolor = Color.Orange;
break; break;
} }
Pen myPen = new Pen(pencolor, NB.PacketPixelSize); Network theNet = NB.GetNetwork();
Graphics.FromImage(BaseImage).DrawEllipse(myPen, PacketRectangle()); if (theNet == null)
{
Pen myPen = new Pen(pencolor, NB.PacketPixelSize);
Graphics.FromImage(BaseImage).DrawEllipse(myPen, PacketRectangle());
}
else
{
Color VLANPacketColor = theNet.ColorFromPacketVLAN(VLANID);
if (VLANPacketColor != Color.Blue)
pencolor = VLANPacketColor;
Image tImage = theNet.GetPacketImage(pencolor);
//if (VLANPacketColor != Color.Blue && VLANPacketColor != Color.Empty)
//{
// tImage = theNet.ColoredImage(tImage, VLANPacketColor);
//}
Graphics.FromImage(BaseImage).DrawImage(tImage, PacketRectangle());
}
} }
/// <summary> /// <summary>

View File

@ -142,7 +142,7 @@ namespace EduNetworkBuilder.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Calibri;}{\f2\fmodern\fprq1\fcharset0 Courier New;}{\f3\fmodern\fprq1\fcharset0 Consolas;}} /// Looks up a localized string similar to {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Calibri;}{\f2\fmodern\fprq1\fcharset0 Courier New;}{\f3\fmodern\fprq1\fcharset0 Consolas;}}
///{\colortbl ;\red0\green0\blue255;} ///{\colortbl ;\red0\green0\blue255;}
///{\*\generator Riched20 10.0.10240}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 ///{\*\generator Riched20 10.0.14393}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1
///\pard\widctlpar\sa200\sl276\slmult1\b\f0\fs22\lang9 Help:\b0\par ///\pard\widctlpar\sa200\sl276\slmult1\b\f0\fs22\lang9 Help:\b0\par
///This is a basic help document for EduNetworkBuilder. You can get to this by going to &quot;Help&quot; -&gt; [rest of string was truncated]&quot;;. ///This is a basic help document for EduNetworkBuilder. You can get to this by going to &quot;Help&quot; -&gt; [rest of string was truncated]&quot;;.
/// </summary> /// </summary>
@ -772,6 +772,66 @@ namespace EduNetworkBuilder.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] Level6_ForbiddenVLAN {
get {
object obj = ResourceManager.GetObject("Level6_ForbiddenVLAN", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] Level6_TaggedBetweenSwitches {
get {
object obj = ResourceManager.GetObject("Level6_TaggedBetweenSwitches", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] Level6_VLAN_Intro {
get {
object obj = ResourceManager.GetObject("Level6_VLAN_Intro", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] Level6_VLAN_Intro2 {
get {
object obj = ResourceManager.GetObject("Level6_VLAN_Intro2", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] Level6_VLANRouting {
get {
object obj = ResourceManager.GetObject("Level6_VLANRouting", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] Level6_VLANRouting2 {
get {
object obj = ResourceManager.GetObject("Level6_VLANRouting2", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
@ -842,8 +902,14 @@ namespace EduNetworkBuilder.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f34\fbidi \froman\fcharset1\fprq2{\*\panose 02040503050406030204}Cambria Math;} /// Looks up a localized string similar to {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}}
///{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}T [rest of string was truncated]&quot;;. ///{\*\generator Riched20 10.0.10586}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1
///\pard\nowidctlpar\sa200\sl276\slmult1\b\f0\fs22\lang9 Version 1.0.27\par
///\b0 * Made distribution easier by CD (does updates from web, but we also have a downloadable zip you can install from)\par
///\b Version 1.0.26\par
///\b0 * Major graphics overhaul\par
/// - Packets move on timer\par
/// - Graphics drawn &quot; [rest of string was truncated]&quot;;.
/// </summary> /// </summary>
internal static string ReleaseNotes { internal static string ReleaseNotes {
get { get {
@ -921,6 +987,16 @@ namespace EduNetworkBuilder.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] VLAN {
get {
object obj = ResourceManager.GetObject("VLAN", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View File

@ -391,4 +391,25 @@
<data name="Level1_AddingDevices" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Level1_AddingDevices" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Level1_AddingDevices.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\Resources\Level1_AddingDevices.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="Level6_ForbiddenVLAN" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Level6_ForbiddenVLAN.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Level6_TaggedBetweenSwitches" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Level6_TaggedBetweenSwitches.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Level6_VLANRouting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Level6_VLANRouting.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Level6_VLANRouting2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Level6_VLANRouting2.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Level6_VLAN_Intro" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Level6_VLAN_Intro.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Level6_VLAN_Intro2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Level6_VLAN_Intro2.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="VLAN" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VLAN.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root> </root>

View File

@ -0,0 +1,641 @@
<?xml version="1.0" encoding="utf-8"?>
<EduNetworkBuilder>
<!--This is a network file for EduNetworkBuilder.-->
<Network>
<en_message>Vlans are managed by double-clicking the networking device (the switch, for this puzzle), and clicking on the VLANs button. A VLAN has three states, tagged, untagged, and forbidden. Forbidden means it does not work. To fix this puzzle, change the switch VLAN ports to "untagged" for all of the, and then ping the other PC</en_message>
<en_title>Forbidden VLANs</en_title>
<height>1024</height>
<width>1024</width>
<itemsize>100</itemsize>
<showlabels>False</showlabels>
<level>6</level>
<sortorder>1</sortorder>
<uniqueidentifier>130</uniqueidentifier>
<startinghelplevel>full</startinghelplevel>
<vlansenabled>True</vlansenabled>
<device>
<hostname>laptop0</hostname>
<size>100</size>
<uniqueidentifier>103</uniqueidentifier>
<location>559,560</location>
<mytype>laptop</mytype>
<isdns>False</isdns>
<isdhcp>False</isdhcp>
<gateway>
<ip>192.168.1.1</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>gw</type>
</gateway>
<nic>
<nictype>lo</nictype>
<nicname>lo0</nicname>
<myid>
<hostid>103</hostid>
<nicid>104</nicid>
<hostname>laptop0</hostname>
<nicname>lo0</nicname>
</myid>
<nictype>lo</nictype>
<uniqueidentifier>104</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>lo0</nicname>
<myip>
<ip>127.0.0.1</ip>
<mask>255.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
<nic>
<nictype>eth</nictype>
<nicname>eth0</nicname>
<myid>
<hostid>103</hostid>
<nicid>105</nicid>
<hostname>laptop0</hostname>
<nicname>eth0</nicname>
</myid>
<nictype>eth</nictype>
<uniqueidentifier>105</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>eth0</nicname>
<myip>
<ip>192.168.1.3</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
</device>
<device>
<hostname>laptop1</hostname>
<size>100</size>
<uniqueidentifier>123</uniqueidentifier>
<location>680,147</location>
<mytype>laptop</mytype>
<isdns>False</isdns>
<isdhcp>False</isdhcp>
<gateway>
<ip>192.168.2.1</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>gw</type>
</gateway>
<nic>
<nictype>lo</nictype>
<nicname>lo0</nicname>
<myid>
<hostid>123</hostid>
<nicid>124</nicid>
<hostname>laptop1</hostname>
<nicname>lo0</nicname>
</myid>
<nictype>lo</nictype>
<uniqueidentifier>124</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>lo0</nicname>
<myip>
<ip>127.0.0.1</ip>
<mask>255.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
<nic>
<nictype>eth</nictype>
<nicname>eth0</nicname>
<myid>
<hostid>123</hostid>
<nicid>125</nicid>
<hostname>laptop1</hostname>
<nicname>eth0</nicname>
</myid>
<nictype>eth</nictype>
<uniqueidentifier>125</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>eth0</nicname>
<myip>
<ip>192.168.2.2</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
</device>
<device>
<hostname>net_switch0</hostname>
<size>100</size>
<uniqueidentifier>109</uniqueidentifier>
<location>406,328</location>
<mytype>net_switch</mytype>
<isdns>False</isdns>
<isdhcp>False</isdhcp>
<gateway>
<ip>192.168.1.1</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>gw</type>
</gateway>
<nic>
<nictype>lo</nictype>
<nicname>lo0</nicname>
<myid>
<hostid>109</hostid>
<nicid>110</nicid>
<hostname>net_switch0</hostname>
<nicname>lo0</nicname>
</myid>
<nictype>lo</nictype>
<uniqueidentifier>110</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>lo0</nicname>
<myip>
<ip>127.0.0.1</ip>
<mask>255.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
<nic>
<nictype>management_interface</nictype>
<nicname>management_interface0</nicname>
<myid>
<hostid>109</hostid>
<nicid>111</nicid>
<hostname>net_switch0</hostname>
<nicname>management_interface0</nicname>
</myid>
<nictype>management_interface</nictype>
<uniqueidentifier>111</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>management_interface0</nicname>
<myip>
<ip>192.168.1.4</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
<nic>
<nictype>port</nictype>
<nicname>port1</nicname>
<myid>
<hostid>109</hostid>
<nicid>112</nicid>
<hostname>net_switch0</hostname>
<nicname>port1</nicname>
</myid>
<nictype>port</nictype>
<uniqueidentifier>112</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>port1</nicname>
<myip>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Forbidden</VLAN>
</interface>
</nic>
<nic>
<nictype>port</nictype>
<nicname>port2</nicname>
<myid>
<hostid>109</hostid>
<nicid>113</nicid>
<hostname>net_switch0</hostname>
<nicname>port2</nicname>
</myid>
<nictype>port</nictype>
<uniqueidentifier>113</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>port2</nicname>
<myip>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Forbidden</VLAN>
</interface>
</nic>
<nic>
<nictype>port</nictype>
<nicname>port3</nicname>
<myid>
<hostid>109</hostid>
<nicid>114</nicid>
<hostname>net_switch0</hostname>
<nicname>port3</nicname>
</myid>
<nictype>port</nictype>
<uniqueidentifier>114</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>port3</nicname>
<myip>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Forbidden</VLAN>
</interface>
</nic>
<nic>
<nictype>port</nictype>
<nicname>port4</nicname>
<myid>
<hostid>109</hostid>
<nicid>115</nicid>
<hostname>net_switch0</hostname>
<nicname>port4</nicname>
</myid>
<nictype>port</nictype>
<uniqueidentifier>115</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>port4</nicname>
<myip>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Forbidden</VLAN>
</interface>
</nic>
<nic>
<nictype>port</nictype>
<nicname>port5</nicname>
<myid>
<hostid>109</hostid>
<nicid>116</nicid>
<hostname>net_switch0</hostname>
<nicname>port5</nicname>
</myid>
<nictype>port</nictype>
<uniqueidentifier>116</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>port5</nicname>
<myip>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Forbidden</VLAN>
</interface>
</nic>
<nic>
<nictype>port</nictype>
<nicname>port6</nicname>
<myid>
<hostid>109</hostid>
<nicid>117</nicid>
<hostname>net_switch0</hostname>
<nicname>port6</nicname>
</myid>
<nictype>port</nictype>
<uniqueidentifier>117</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>port6</nicname>
<myip>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Forbidden</VLAN>
</interface>
</nic>
<nic>
<nictype>port</nictype>
<nicname>port7</nicname>
<myid>
<hostid>109</hostid>
<nicid>118</nicid>
<hostname>net_switch0</hostname>
<nicname>port7</nicname>
</myid>
<nictype>port</nictype>
<uniqueidentifier>118</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>port7</nicname>
<myip>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Forbidden</VLAN>
</interface>
</nic>
</device>
<device>
<hostname>pc0</hostname>
<size>100</size>
<uniqueidentifier>100</uniqueidentifier>
<location>246,560</location>
<mytype>pc</mytype>
<isdns>False</isdns>
<isdhcp>False</isdhcp>
<gateway>
<ip>192.168.1.1</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>gw</type>
</gateway>
<nic>
<nictype>lo</nictype>
<nicname>lo0</nicname>
<myid>
<hostid>100</hostid>
<nicid>101</nicid>
<hostname>pc0</hostname>
<nicname>lo0</nicname>
</myid>
<nictype>lo</nictype>
<uniqueidentifier>101</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>lo0</nicname>
<myip>
<ip>127.0.0.1</ip>
<mask>255.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
<nic>
<nictype>eth</nictype>
<nicname>eth0</nicname>
<myid>
<hostid>100</hostid>
<nicid>102</nicid>
<hostname>pc0</hostname>
<nicname>eth0</nicname>
</myid>
<nictype>eth</nictype>
<uniqueidentifier>102</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>eth0</nicname>
<myip>
<ip>192.168.1.2</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
</device>
<device>
<hostname>router0</hostname>
<size>100</size>
<uniqueidentifier>119</uniqueidentifier>
<location>400,158</location>
<mytype>router</mytype>
<isdns>False</isdns>
<isdhcp>False</isdhcp>
<gateway>
<ip>0.0.0.0</ip>
<mask>0.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>gw</type>
</gateway>
<nic>
<nictype>lo</nictype>
<nicname>lo0</nicname>
<myid>
<hostid>119</hostid>
<nicid>120</nicid>
<hostname>router0</hostname>
<nicname>lo0</nicname>
</myid>
<nictype>lo</nictype>
<uniqueidentifier>120</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>lo0</nicname>
<myip>
<ip>127.0.0.1</ip>
<mask>255.0.0.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
<nic>
<nictype>eth</nictype>
<nicname>eth0</nicname>
<myid>
<hostid>119</hostid>
<nicid>121</nicid>
<hostname>router0</hostname>
<nicname>eth0</nicname>
</myid>
<nictype>eth</nictype>
<uniqueidentifier>121</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>eth0</nicname>
<myip>
<ip>192.168.1.1</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
<nic>
<nictype>eth</nictype>
<nicname>eth1</nicname>
<myid>
<hostid>119</hostid>
<nicid>122</nicid>
<hostname>router0</hostname>
<nicname>eth1</nicname>
</myid>
<nictype>eth</nictype>
<uniqueidentifier>122</uniqueidentifier>
<usesdhcp>False</usesdhcp>
<encryptionkey />
<ssid />
<interface>
<nicname>eth1</nicname>
<myip>
<ip>192.168.2.1</ip>
<mask>255.255.255.0</mask>
<gateway>0.0.0.0</gateway>
<type>ip</type>
</myip>
<VLAN
ID="1">Untagged</VLAN>
</interface>
</nic>
</device>
<link>
<SrcNic>
<hostid>100</hostid>
<nicid>102</nicid>
<hostname>pc0</hostname>
<nicname>eth0</nicname>
</SrcNic>
<DstNic>
<hostid>109</hostid>
<nicid>112</nicid>
<hostname>net_switch0</hostname>
<nicname>port1</nicname>
</DstNic>
<hostname />
<linktype>normal</linktype>
<uniqueidentifier>126</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>103</hostid>
<nicid>105</nicid>
<hostname>laptop0</hostname>
<nicname>eth0</nicname>
</SrcNic>
<DstNic>
<hostid>109</hostid>
<nicid>113</nicid>
<hostname>net_switch0</hostname>
<nicname>port2</nicname>
</DstNic>
<hostname />
<linktype>normal</linktype>
<uniqueidentifier>127</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>109</hostid>
<nicid>114</nicid>
<hostname>net_switch0</hostname>
<nicname>port3</nicname>
</SrcNic>
<DstNic>
<hostid>119</hostid>
<nicid>121</nicid>
<hostname>router0</hostname>
<nicname>eth0</nicname>
</DstNic>
<hostname />
<linktype>normal</linktype>
<uniqueidentifier>128</uniqueidentifier>
</link>
<link>
<SrcNic>
<hostid>119</hostid>
<nicid>122</nicid>
<hostname>router0</hostname>
<nicname>eth1</nicname>
</SrcNic>
<DstNic>
<hostid>123</hostid>
<nicid>125</nicid>
<hostname>laptop1</hostname>
<nicname>eth0</nicname>
</DstNic>
<hostname />
<linktype>normal</linktype>
<uniqueidentifier>129</uniqueidentifier>
</link>
<nettest>
<shost>pc0</shost>
<dhost>laptop0</dhost>
<thetest>SuccessfullyPings</thetest>
</nettest>
<nettest>
<shost>All</shost>
<dhost>All</dhost>
<thetest>LockVLANNames</thetest>
</nettest>
<tag>VLAN</tag>
<VLANName
ID="1">Default</VLANName>
</Network>
</EduNetworkBuilder>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
namespace EduNetworkBuilder namespace EduNetworkBuilder
{ {
@ -20,6 +20,11 @@ namespace EduNetworkBuilder
[DisplayName("Name")] [DisplayName("Name")]
public string Name { get { return _Name; } set { _Name = value; } } public string Name { get { return _Name; } set { _Name = value; } }
Color _Color = Color.Empty;
[DisplayName("ColorString")]
public string PacketColorString { get { return _Color.ToString(); } set { _Color = Color.FromName(value); } }
public Color PacketColor { get { return _Color; } set { _Color = value; } }
public VLANName() public VLANName()
{ {
} }
@ -28,6 +33,14 @@ namespace EduNetworkBuilder
{ {
ID = id; ID = id;
Name = name; Name = name;
PacketColor = Color.Blue; //The default for everything
}
public VLANName(int id, string name, Color ColorForPacket)
{
ID = id;
Name = name;
_Color = ColorForPacket;
} }
} }