Skip to content

Commit 9f19a97

Browse files
committed
fixes
1 parent 8f7f58d commit 9f19a97

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

includes/virtual-network-multiple-ip-addresses-os-config.md

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,17 @@ ping -S 10.1.0.5 outlook.com
121121
We recommend looking at the latest documentation for your Linux distribution.
122122

123123
1. Open a terminal window.
124-
2. Make sure you're the root user. If you aren't, enter the following command:
124+
125+
2. Ensure you're the root user. If you aren't, enter the following command:
125126

126127
```bash
127128
sudo -i
128129
```
129130

130-
3. Update the configuration file of the network interface (assuming ‘eth0’).
131+
3. Update the configuration file of the network interface (assuming **‘eth0’**).
131132

132133
* Keep the existing line item for dhcp. The primary IP address remains configured as it was previously.
134+
133135
* Add a configuration for an additional static IP address with the following commands:
134136

135137
```bash
@@ -138,20 +140,32 @@ We recommend looking at the latest documentation for your Linux distribution.
138140
```
139141

140142
You should see a .cfg file.
141-
4. Open the file. You should see the following lines at the end of the file:
142143

144+
4. Open the file. You should see the following lines at the end of the file:
145+
a
143146
```bash
144147
auto eth0
145148
iface eth0 inet dhcp
146149
```
147150

148-
5. Add the following lines after the lines that exist in this file:
151+
5. Add the following lines after the lines that exist in the file. Replace **`10.1.0.5`** with your private IP address and subnet mask.
149152

150153
```bash
151154
iface eth0 inet static
152-
address <your private IP address here>
153-
netmask <your subnet mask>
155+
address 10.1.0.5
156+
netmask 255.255.255.0
154157
```
158+
159+
To add additional private IP addresses, edit the file and add the new private IP addresses on subsequent lines:
160+
161+
```bash
162+
iface eth0 inet static
163+
address 10.1.0.5
164+
netmask 255.255.255.0
165+
iface eth0 inet static
166+
address 10.1.0.6
167+
netmask 255.255.255.0
168+
```
155169

156170
6. Save the file by using the following command:
157171

@@ -162,11 +176,11 @@ We recommend looking at the latest documentation for your Linux distribution.
162176
7. Reset the network interface with the following command:
163177

164178
```bash
165-
sudo ifdown eth0 && sudo ifup eth0
179+
ifdown eth0 && ifup eth0
166180
```
167181

168182
> [!IMPORTANT]
169-
> Run both ifdown and ifup in the same line if using a remote connection.
183+
> Execute both ifdown and ifup in the same line if using a remote connection.
170184
>
171185

172186
8. Verify the IP address is added to the network interface with the following command:
@@ -175,31 +189,47 @@ We recommend looking at the latest documentation for your Linux distribution.
175189
ip addr list eth0
176190
```
177191

178-
You should see the IP address you added as part of the list.
192+
You should see the IP address you added as part of the list. Example:
193+
194+
```bash
195+
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
196+
link/ether 00:0d:3a:04:45:16 brd ff:ff:ff:ff:ff:ff
197+
inet 10.1.0.5/24 brd 10.1.0.255 scope global eth0
198+
valid_lft forever preferred_lft forever
199+
inet 10.1.0.6/24 brd 10.1.0.255 scope global secondary eth0
200+
valid_lft forever preferred_lft forever
201+
inet 10.1.0.4/24 brd 10.1.0.255 scope global secondary eth0
202+
valid_lft forever preferred_lft forever
203+
inet6 fe80::20d:3aff:fe04:4516/64 scope link
204+
valid_lft forever preferred_lft forever
205+
```
179206

180207
#### Validation (Ubuntu 14/16)
181208

182-
To ensure you're able to connect to the internet from your secondary IP configuration via the public IP associated it, use the following command:
209+
To ensure you're able to connect to the internet from your secondary IP configuration via the public IP associated with it, use the following command:
183210
184211
```bash
185-
ping -I 10.0.0.5 outlook.com
212+
ping -I 10.1.0.5 outlook.com
186213
```
187214
188215
> [!NOTE]
189216
> For secondary IP configurations, you can only ping to the Internet if the configuration has a public IP address associated with it. For primary IP configurations, a public IP address is not required to ping to the Internet.
190217
191-
For Linux VMs, when trying to validate outbound connectivity from a secondary NIC, you may need to add appropriate routes. There are many ways to do this. Please see appropriate documentation for your Linux distribution. The following is one method to accomplish this:
218+
For Linux VMs, when attempting to validate outbound connectivity from a secondary NIC, you may need to add appropriate routes. See appropriate documentation for your Linux distribution. The following is one method to accomplish this:
192219
193220
```bash
194221
echo 150 custom >> /etc/iproute2/rt_tables
195222
196-
ip rule add from 10.0.0.5 lookup custom
197-
ip route add default via 10.0.0.1 dev eth2 table custom
223+
ip rule add from 10.1.0.5 lookup custom
224+
ip route add default via 10.1.0.1 dev eth2 table custom
198225
```
199226
200-
- Be sure to replace:
201-
- **10.0.0.5** with the private IP address that has a public IP address associated to it
202-
- **10.0.0.1** to your default gateway
227+
- Ensure to replace:
228+
229+
- **10.1.0.5** with the private IP address that has a public IP address associated to it
230+
231+
- **10.1.0.1** to your default gateway
232+
203233
- **eth2** to the name of your secondary NIC
204234
205235
</details>
@@ -291,7 +321,7 @@ Ubuntu 18.04 and above have changed to **`netplan`** for OS network management.
291321

292322
#### Validation (Ubuntu 18.04+)
293323

294-
To ensure you're able to connect to the internet from your secondary IP configuration via the public IP associated it, use the following command:
324+
To ensure you're able to connect to the internet from your secondary IP configuration via the public IP associated with it, use the following command:
295325
296326
```bash
297327
ping -I 10.1.0.5 outlook.com

0 commit comments

Comments
 (0)