From b6eaf00d6d15df61ad15b26d3b8d66310fc38e6a Mon Sep 17 00:00:00 2001 From: Tim Young Date: Fri, 28 Oct 2016 14:01:12 -0500 Subject: [PATCH] Dhcp and vlans work, colored packets, etc. Added puzzle --- EduNetworkBuilder/EduNetworkBuilder.csproj | 1 + EduNetworkBuilder/NB.cs | 2 +- .../Properties/Resources.Designer.cs | 10 + EduNetworkBuilder/Properties/Resources.resx | 3 + .../Resources/level6_UntaggedAndDHCP.enbx | 1477 +++++++++++++++++ EduNetworkBuilder/VLANConfig.cs | 9 +- EduNetworkBuilder/VLANStuff.cs | 2 +- 7 files changed, 1500 insertions(+), 4 deletions(-) create mode 100644 EduNetworkBuilder/Resources/level6_UntaggedAndDHCP.enbx diff --git a/EduNetworkBuilder/EduNetworkBuilder.csproj b/EduNetworkBuilder/EduNetworkBuilder.csproj index dd76daf..db464dd 100644 --- a/EduNetworkBuilder/EduNetworkBuilder.csproj +++ b/EduNetworkBuilder/EduNetworkBuilder.csproj @@ -280,6 +280,7 @@ + diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs index e973c08..832d0e5 100644 --- a/EduNetworkBuilder/NB.cs +++ b/EduNetworkBuilder/NB.cs @@ -72,7 +72,7 @@ namespace EduNetworkBuilder Level5_WirelessRouters, Level5_WirelessDevices, Level5_WirelessBridge, Level5_WirelessRepeater, Level5_WirelessRepeater2, Level5_WirelessAccessPoint, Level5_WirelessCorruption, Level5_Failed, Level5_LostPacket, Level5_HereComesTrouble, Level6_VLAN_Intro, Level6_VLAN_Intro2, Level6_ForbiddenVLAN, Level6_TaggedBetweenSwitches, Level6_VLANRouting, - Level6_VLANRouting2, + Level6_VLANRouting2, level6_UntaggedAndDHCP, } public enum DebugPausePoint { none=0, packet_create=1, packet_kill=2, diff --git a/EduNetworkBuilder/Properties/Resources.Designer.cs b/EduNetworkBuilder/Properties/Resources.Designer.cs index f64a79e..87ef8d2 100644 --- a/EduNetworkBuilder/Properties/Resources.Designer.cs +++ b/EduNetworkBuilder/Properties/Resources.Designer.cs @@ -792,6 +792,16 @@ namespace EduNetworkBuilder.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] level6_UntaggedAndDHCP { + get { + object obj = ResourceManager.GetObject("level6_UntaggedAndDHCP", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Byte[]. /// diff --git a/EduNetworkBuilder/Properties/Resources.resx b/EduNetworkBuilder/Properties/Resources.resx index 43bae63..537fe0e 100644 --- a/EduNetworkBuilder/Properties/Resources.resx +++ b/EduNetworkBuilder/Properties/Resources.resx @@ -397,6 +397,9 @@ ..\Resources\Level6_TaggedBetweenSwitches.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\level6_UntaggedAndDHCP.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + ..\Resources\Level6_VLANRouting.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/EduNetworkBuilder/Resources/level6_UntaggedAndDHCP.enbx b/EduNetworkBuilder/Resources/level6_UntaggedAndDHCP.enbx new file mode 100644 index 0000000..022a0f8 --- /dev/null +++ b/EduNetworkBuilder/Resources/level6_UntaggedAndDHCP.enbx @@ -0,0 +1,1477 @@ + + + + + This map shows how VLANs affect DHCP. Change the ports on net_switch1 that are connected to the wireless access point and laptop1. The WAP does not know how to do VLANS, so you control the VLAN that the accesspoint is connected to on net_switch1. Untag the port for the vlan that the laptop is supposed to be connected to do, doing a dhcp-request after you change it. +For this map, the VLAN packets are displayed with the color of the PC on that VLAN. That will help you visualize when the packet is tagged and when it is not. + Untagged ports and DHCP + 1024 + 1024 + 100 + True + 6 + 5 + 169 + full + True + + firewall0 + 100 + 133 + 130,210 + firewall + False + True + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 133 + 134 + firewall0 + lo0 + + lo + 134 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wan + wan0 + + 133 + 137 + firewall0 + wan0 + + wan + 137 + False + + wan0 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + eth + eth0 + + 133 + 135 + firewall0 + eth0 + + eth + 135 + False + + eth0 + + 192.168.1.1 + 255.255.255.0 + 0.0.0.0 + ip + + Tagged + + + eth0:1 + + 192.168.2.1 + 255.255.255.0 + 0.0.0.0 + ip + + Forbidden + Tagged + + + eth0:2 + + 192.168.3.1 + 255.255.255.0 + 0.0.0.0 + ip + + Forbidden + Tagged + + + + eth + eth1 + + 133 + 136 + firewall0 + eth1 + + eth + 136 + False + + eth1 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + 127.0.0.1 + 0.0.0.0 + 0.0.0.0 + route + + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + route + + + 192.168.1.1 + 192.168.1.5 + 192.168.1.10 + route + + + 192.168.2.1 + 192.168.2.5 + 192.168.2.10 + route + + + 192.168.3.1 + 192.168.3.5 + 192.168.3.10 + route + + + + laptop0 + 100 + 143 + 780,220 + laptop + False + False + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 143 + 144 + laptop0 + lo0 + + lo + 144 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + eth + eth0 + + 143 + 145 + laptop0 + eth0 + + eth + 145 + False + + eth0 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wlan + wlan2 + + 143 + 146 + laptop0 + wlan2 + + wlan + 146 + True + ThePassword + Wireless + + wlan2 + + 192.168.2.5 + 255.255.255.0 + 192.168.2.1 + route + + Untagged + + + + + laptop1 + 100 + 147 + 630,720 + laptop + False + False + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 147 + 148 + laptop1 + lo0 + + lo + 148 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + eth + eth0 + + 147 + 149 + laptop1 + eth0 + + eth + 149 + True + + eth0 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wlan + wlan2 + + 147 + 150 + laptop1 + wlan2 + + wlan + 150 + False + + wlan2 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + + net_switch0 + 100 + 100 + 130,390 + net_switch + False + False + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 100 + 101 + net_switch0 + lo0 + + lo + 101 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + management_interface + management_interface0 + + 100 + 102 + net_switch0 + management_interface0 + + management_interface + 102 + False + + management_interface0 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + port + port1 + + 100 + 103 + net_switch0 + port1 + + port + 103 + False + + port1 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + Forbidden + Forbidden + + + + port + port2 + + 100 + 104 + net_switch0 + port2 + + port + 104 + False + + port2 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Forbidden + Untagged + Forbidden + + + + port + port3 + + 100 + 105 + net_switch0 + port3 + + port + 105 + False + + port3 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Forbidden + Untagged + Forbidden + + + + port + port4 + + 100 + 106 + net_switch0 + port4 + + port + 106 + False + + port4 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Forbidden + Forbidden + Forbidden + + + + port + port5 + + 100 + 107 + net_switch0 + port5 + + port + 107 + False + + port5 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Forbidden + Forbidden + Forbidden + + + + port + port6 + + 100 + 108 + net_switch0 + port6 + + port + 108 + False + + port6 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Tagged + Tagged + Tagged + + + + port + port7 + + 100 + 109 + net_switch0 + port7 + + port + 109 + False + + port7 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Tagged + Tagged + Tagged + + + + + net_switch1 + 100 + 155 + 420,390 + net_switch + False + False + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 155 + 156 + net_switch1 + lo0 + + lo + 156 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + management_interface + management_interface0 + + 155 + 157 + net_switch1 + management_interface0 + + management_interface + 157 + False + + management_interface0 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + port + port1 + + 155 + 158 + net_switch1 + port1 + + port + 158 + False + + port1 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Tagged + Tagged + Tagged + + + + port + port2 + + 155 + 159 + net_switch1 + port2 + + port + 159 + False + + port2 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Forbidden + Forbidden + Untagged + + + + port + port3 + + 155 + 160 + net_switch1 + port3 + + port + 160 + False + + port3 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Forbidden + Untagged + Forbidden + + + + port + port4 + + 155 + 161 + net_switch1 + port4 + + port + 161 + False + + port4 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + Forbidden + Forbidden + + + + port + port5 + + 155 + 162 + net_switch1 + port5 + + port + 162 + False + + port5 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + Forbidden + Forbidden + + + + port + port6 + + 155 + 163 + net_switch1 + port6 + + port + 163 + False + + port6 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + Forbidden + Forbidden + + + + port + port7 + + 155 + 164 + net_switch1 + port7 + + port + 164 + False + + port7 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + Forbidden + Forbidden + + + + + pc0 + 100 + 110 + 30,570 + pc + False + False + Green + + 192.168.1.1 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 110 + 111 + pc0 + lo0 + + lo + 111 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + eth + eth0 + + 110 + 112 + pc0 + eth0 + + eth + 112 + False + + eth0 + + 192.168.1.2 + 255.255.255.0 + 0.0.0.0 + ip + + Untagged + + + + + pc1 + 100 + 113 + 130,630 + pc + False + False + Yellow + + 192.168.2.1 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 113 + 114 + pc1 + lo0 + + lo + 114 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + eth + eth0 + + 113 + 115 + pc1 + eth0 + + eth + 115 + False + + eth0 + + 192.168.2.2 + 255.255.255.0 + 0.0.0.0 + ip + + Untagged + + + + + pc2 + 100 + 116 + 230,570 + pc + False + False + Orange + + 192.168.3.1 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 116 + 117 + pc2 + lo0 + + lo + 117 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + eth + eth0 + + 116 + 118 + pc2 + eth0 + + eth + 118 + False + + eth0 + + 192.168.3.2 + 255.255.255.0 + 0.0.0.0 + ip + + Untagged + + + + + wap0 + 100 + 119 + 530,220 + wap + False + False + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + gw + + + lo + lo0 + + 119 + 122 + wap0 + lo0 + + lo + 122 + False + + lo0 + + 127.0.0.1 + 255.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + eth + eth1 + + 119 + 123 + wap0 + eth1 + + eth + 123 + False + + eth1 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wport + wport2 + + 119 + 124 + wap0 + wport2 + + wport + 124 + False + ThePassword + Wireless + + wport2 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wport + wport3 + + 119 + 125 + wap0 + wport3 + + wport + 125 + False + ThePassword + Wireless + + wport3 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wport + wport4 + + 119 + 126 + wap0 + wport4 + + wport + 126 + False + ThePassword + Wireless + + wport4 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wport + wport5 + + 119 + 127 + wap0 + wport5 + + wport + 127 + False + ThePassword + Wireless + + wport5 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wport + wport6 + + 119 + 128 + wap0 + wport6 + + wport + 128 + False + ThePassword + Wireless + + wport6 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + wport + wport7 + + 119 + 129 + wap0 + wport7 + + wport + 129 + False + ThePassword + Wireless + + wport7 + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + ip + + Untagged + + + + + + 133 + 135 + firewall0 + eth0 + + + 100 + 109 + net_switch0 + port7 + + + normal + 138 + + + + 155 + 159 + net_switch1 + port2 + + + 119 + 123 + wap0 + eth1 + + + normal + 166 + + + + 100 + 108 + net_switch0 + port6 + + + 155 + 158 + net_switch1 + port1 + + + normal + 165 + + + + 155 + 160 + net_switch1 + port3 + + + 147 + 149 + laptop1 + eth0 + + + normal + 167 + + + + 113 + 115 + pc1 + eth0 + + + 100 + 104 + net_switch0 + port2 + + + normal + 140 + + + + 110 + 112 + pc0 + eth0 + + + 100 + 103 + net_switch0 + port1 + + + normal + 139 + + + + 116 + 118 + pc2 + eth0 + + + 100 + 105 + net_switch0 + port3 + + + normal + 141 + + + + 143 + 146 + laptop0 + wlan2 + + + 119 + 124 + wap0 + wport2 + + + wireless + 168 + + + laptop0 + pc0 + NeedsLocalIPTo + + + laptop0 + wlan2 + LockNic + + + All + All + LockVLANNames + + + laptop1 + eth0 + LockNic + + + laptop1 + pc2 + NeedsLocalIPTo + + + pc0 + All + LockAll + + + pc1 + All + LockAll + + + pc2 + All + LockAll + + DHCP + VLAN + Default + Staff + Student + + \ No newline at end of file diff --git a/EduNetworkBuilder/VLANConfig.cs b/EduNetworkBuilder/VLANConfig.cs index 3e4b0ad..180cc39 100644 --- a/EduNetworkBuilder/VLANConfig.cs +++ b/EduNetworkBuilder/VLANConfig.cs @@ -216,6 +216,10 @@ namespace EduNetworkBuilder //if (dgv_VLANNames.RowCount == theNet.VlanNames.Count) return; //Nothing was added or removed. + BindingList oList = new BindingList(); + foreach (VLANName vn in theNet.VlanNames) + oList.Add(vn); //stash it for keeping colors for now + theNet.VlanNames.Clear(); //Remove them all. We will re-add them //add it if it was added @@ -230,10 +234,11 @@ namespace EduNetworkBuilder { if (!VLANNamesHasID(theNet.VlanNames, id)) { + Color tColor = oList[theNet.VlanNames.Count].PacketColor; if (DR.Cells["Name"].Value == null) //When we are still adding - theNet.VlanNames.Add(new VLANName(id, "----")); + theNet.VlanNames.Add(new VLANName(id, "----", tColor)); else - theNet.VlanNames.Add(new VLANName(id, DR.Cells["Name"].Value.ToString())); + theNet.VlanNames.Add(new VLANName(id, DR.Cells["Name"].Value.ToString(),tColor)); } } } diff --git a/EduNetworkBuilder/VLANStuff.cs b/EduNetworkBuilder/VLANStuff.cs index 062d02e..f6cee86 100644 --- a/EduNetworkBuilder/VLANStuff.cs +++ b/EduNetworkBuilder/VLANStuff.cs @@ -22,7 +22,7 @@ namespace EduNetworkBuilder Color _Color = Color.Empty; [DisplayName("ColorString")] - public string PacketColorString { get { return _Color.ToString(); } set { _Color = Color.FromName(value); } } + public string PacketColorString { get { return _Color.Name; } set { _Color = Color.FromName(value); } } public Color PacketColor { get { return _Color; } set { _Color = value; } } public VLANName()