Skip to content

Commit 1b293c8

Browse files
authored
Merge pull request #223416 from fcabrera23/eflow-virtual-switch
Update for 172.20.X.X examples
2 parents d80eb87 + a4c496a commit 1b293c8

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed

articles/iot-edge/how-to-create-virtual-switch.md

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ Note that if you're using an Azure VM, the virtual switch can't be **External**.
3434

3535
1. Open PowerShell in an elevated session. You can do so by opening the **Start** pane on Windows and typing in "PowerShell". Right-click the **Windows PowerShell** app that shows up and select **Run as administrator**.
3636

37-
2. Check the virtual switches on the Windows host and make sure you don't already have a virtual switch that can be used. You can do so by running the following [Get-VMSwitch](/powershell/module/hyper-v/get-vmswitch) command in PowerShell:
37+
1. Check the virtual switches on the Windows host and make sure you don't already have a virtual switch that can be used. You can do so by running the following [Get-VMSwitch](/powershell/module/hyper-v/get-vmswitch) command in PowerShell:
3838

3939
```powershell
4040
Get-VMSwitch
4141
```
4242
4343
If a virtual switch named **Default Switch** is already created and you don't need a custom virtual switch, you should be able to install IoT Edge for Linux on Windows without following the rest of the steps in this guide.
4444
45-
3. Create a new VM switch with a name of your choice and an **Internal** or **Private** switch type by running the following [New-VMSwitch](/powershell/module/hyper-v/new-vmswitch) command, replacing the placeholder values:
45+
1. Create a new VM switch with a name of your choice and an **Internal** or **Private** switch type by running the following [New-VMSwitch](/powershell/module/hyper-v/new-vmswitch) command, replacing the placeholder values:
4646
4747
```powershell
4848
New-VMSwitch -Name "{switchName}" -SwitchType {switchType}
4949
```
5050
51-
4. To get the IP address for the switch you created, you must first get its interface index. You can get this value by running the following [Get-NetAdapter](/powershell/module/netadapter/get-netadapter) command, replacing the placeholder value:
51+
1. To get the IP address for the switch you created, you must first get its interface index. You can get this value by running the following [Get-NetAdapter](/powershell/module/netadapter/get-netadapter) command, replacing the placeholder value:
5252
5353
```powershell
5454
(Get-NetAdapter -Name "{switchName}").ifIndex
@@ -59,30 +59,19 @@ Note that if you're using an Azure VM, the virtual switch can't be **External**.
5959
:::image type="content" source="media/how-to-create-virtual-switch/get-netadapter-output.png" alt-text="Screenshot of the output from running the Get-NetAdapter command, highlighting the interface index value." lightbox="media/how-to-create-virtual-switch/get-netadapter-output.png":::
6060
6161
Take note of the interface index value, as you'll need to use it in future steps.
62+
63+
6. The resulting virtual switch IP address will be different for each environment. Note that for the rest of the commands in this guide you will make use of IP addresses that are derived from the *172.20.X.Y* family. However, you can you use your own address family and IP addresses.
6264
63-
5. Using the interface index from the previous step, get the IP address of the created switch network adapter by running the following [Get-NetIPAddress](/powershell/module/nettcpip/get-netipaddress) command, replacing the placeholder value:
64-
65-
```powershell
66-
Get-NetIPAddress -AddressFamily IPv4 -InterfaceIndex {interfaceIndex}
67-
```
68-
69-
Running this command should output information similar to the following example:
70-
71-
:::image type="content" source="media/how-to-create-virtual-switch/get-netipaddress-output.png" alt-text="Screenshot of the output from running the Get-NetIPAddress command, highlighting the IP address." lightbox="media/how-to-create-virtual-switch/get-netipaddress-output.png":::
72-
73-
The resulting virtual switch IP address will be different for each environment. Take note of the IP address, as the rest of the commands in this guide will make use of more IP addresses that are derived from this outputted address.
74-
75-
6. For the other IP addresses, you'll need to create variations where the last octet (the number separated by each dot in an IP address) is replaced by a different value. You'll create and use the following IP addresses:
65+
You'll create and use the following IP addresses:
7666
77-
| IP address | Template | Example |
78-
|-------------------|-----------------|-----------------|
79-
| Virtual switch IP | xxx.xxx.xxx.yyy | 169.254.229.39 |
80-
| Gateway IP | xxx.xxx.xxx.1 | 169.254.229.1 |
81-
| NAT IP | xxx.xxx.xxx.0 | 169.254.229.0 |
82-
| Start IP | xxx.xxx.xxx.100 | 169.254.229.100 |
83-
| End IP | xxx.xxx.xxx.200 | 169.254.229.200 |
67+
| IP address | Template | Example |
68+
|-------------------|-----------------|-----------------|
69+
| Gateway IP | xxx.xxx.xxx.1 | 172.20.0.1 |
70+
| NAT IP | xxx.xxx.xxx.0 | 172.20.0.0 |
71+
| Start IP | xxx.xxx.xxx.100 | 172.20.0.100 |
72+
| End IP | xxx.xxx.xxx.200 | 172.20.0.200 |
8473
85-
7. Set the **gateway IP address** by replacing the last octet of your virtual switch IP with a new numerical value, for example 1. Run the following [New-NetIPAddress](/powershell/module/nettcpip/new-netipaddress) command to set the new gateway IP address, replacing the placeholder values:
74+
1. Set the **gateway IP address** by replacing the last octet of your virtual switch IP address family with a new numerical value. For example, replace last octet with 1 and get the address 172.20.0.1. Run the following [New-NetIPAddress](/powershell/module/nettcpip/new-netipaddress) command to set the new gateway IP address, replacing the placeholder values:
8675
8776
```powershell
8877
New-NetIPAddress -IPAddress {gatewayIp} -PrefixLength 24 -InterfaceIndex {interfaceIndex}
@@ -92,7 +81,7 @@ Note that if you're using an Azure VM, the virtual switch can't be **External**.
9281
9382
:::image type="content" source="media/how-to-create-virtual-switch/new-netipaddress-output.png" alt-text="Screenshot of the output from running the New-NetIPAddress command." lightbox="media/how-to-create-virtual-switch/new-netipaddress-output.png":::
9483
95-
8. Create a Network Address Translation (NAT) object that translates an internal network address to an external network. Use the same IPv4 family address from previous steps. Based on the table from step six, the **NAT IP address** corresponds to the original virtual switch IP address, except that the last octet is replaced with a new numerical value, for example 0. Run the following [New-NetNat](/powershell/module/netnat/new-netnat) command to set the NAT IP address, replacing the placeholder values:
84+
1. Create a Network Address Translation (NAT) object that translates an internal network address to an external network. Use the same IPv4 family address from previous steps. Based on the table from step six, the **NAT IP address** corresponds to the original IP address family, except that the last octet is replaced with a new numerical value, for example 0. Run the following [New-NetNat](/powershell/module/netnat/new-netnat) command to set the NAT IP address, replacing the placeholder values:
9685
9786
```powershell
9887
New-NetNat -Name "{switchName}" -InternalIPInterfaceAddressPrefix "{natIp}/24"
@@ -118,13 +107,13 @@ The switch is now created. Next, you'll set up the DNS.
118107
Get-WindowsFeature -Name 'DHCP'
119108
```
120109
121-
2. If the DHCP server isn't already installed, do so by running the following command:
110+
1. If the DHCP server isn't already installed, do so by running the following command:
122111
123112
```powershell
124113
Install-WindowsFeature -Name 'DHCP' -IncludeManagementTools
125114
```
126115
127-
3. Add the DHCP Server to the default local security groups and restart the server.
116+
1. Add the DHCP Server to the default local security groups and restart the server.
128117
129118
```powershell
130119
netsh dhcp add securitygroups
@@ -133,15 +122,15 @@ The switch is now created. Next, you'll set up the DNS.
133122
134123
You'll receive the following warning messages while the DHCP server is starting up: `WARNING: Waiting for service 'DHCP Server (dhcpserver)' to start...`
135124
136-
4. To configure the DHCP server range of IPs to be made available, you'll need to set an IP address as the **start IP** and an IP address as the **end IP**. This range is defined by the **StartRange** and the **EndRange** parameters in the [Add-DhcpServerv4Scope](/powershell/module/dhcpserver/add-dhcpserverv4scope) command. You'll also need to set the subnet mask when running this command, which will be 255.255.255.0. Based on the IP address templates and examples in the table from the previous section, setting the **StartRange** as 169.254.229.100 and the **EndRange** as 169.254.229.200 will make 100 IP addresses available. Run the following command, replacing the placeholders with your own values:
125+
1. To configure the DHCP server range of IPs to be made available, you'll need to set an IP address as the **start IP** and an IP address as the **end IP**. This range is defined by the **StartRange** and the **EndRange** parameters in the [Add-DhcpServerv4Scope](/powershell/module/dhcpserver/add-dhcpserverv4scope) command. You'll also need to set the subnet mask when running this command, which will be 255.255.255.0. Based on the IP address templates and examples in the table from the previous section, setting the **StartRange** as 169.254.229.100 and the **EndRange** as 169.254.229.200 will make 100 IP addresses available. Run the following command, replacing the placeholders with your own values:
137126
138127
```powershell
139128
Add-DhcpServerV4Scope -Name "AzureIoTEdgeScope" -StartRange {startIp} -EndRange {endIp} -SubnetMask 255.255.255.0 -State Active
140129
```
141130
142131
This command should produce no output.
143132
144-
5. Assign the **NAT** and **gateway IP** addresses you created in the earlier section to the DHCP server, and restart the server to load the configuration. The first command should produce no output, but restarting the DHCP server should output the same warning messages that you received when you did so in the third step of this section.
133+
1. Assign the **NAT** and **gateway IP** addresses you created in the earlier section to the DHCP server, and restart the server to load the configuration. The first command should produce no output, but restarting the DHCP server should output the same warning messages that you received when you did so in the third step of this section.
145134
146135
```powershell
147136
Set-DhcpServerV4OptionValue -ScopeID {natIp} -Router {gatewayIp}
410 KB
Loading
302 KB
Loading

0 commit comments

Comments
 (0)