You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: includes/virtual-network-multiple-ip-addresses-os-config.md
+59-13Lines changed: 59 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
author: asudbring
6
6
ms.service: virtual-network
7
7
ms.topic: include
8
-
ms.date: 09/05/2022
8
+
ms.date: 09/06/2022
9
9
ms.author: allensu
10
10
ms.custom: include file
11
11
---
@@ -355,13 +355,14 @@ ip route add default via 10.1.0.1 dev eth2 table custom
355
355
<summary>Expand</summary>
356
356
357
357
1. Open a terminal window.
358
-
2. Make sure you're the root user. If you are not, enter the following command:
358
+
359
+
2. Ensure you're the root user. If you aren't, enter the following command:
359
360
360
361
```bash
361
362
sudo -i
362
363
```
363
364
364
-
3. Enter your password and follow instructions as prompted. Once you're the root user, navigate to the network scripts folder with the following command:
365
+
3. Enter your password and follow instructions as prompted. Once you're the root user, go to the network scripts folder with the following command:
365
366
366
367
```bash
367
368
cd /etc/sysconfig/network-scripts
@@ -373,7 +374,7 @@ ip route add default via 10.1.0.1 dev eth2 table custom
373
374
ls ifcfg-*
374
375
```
375
376
376
-
You should see *ifcfg-eth0* as one of the files.
377
+
You should see **ifcfg-eth0** as one of the files.
377
378
378
379
5. To add an IP address, create a configuration file for it as shown below. Note that one file must be created for each IP configuration.
379
380
@@ -387,13 +388,13 @@ ip route add default via 10.1.0.1 dev eth2 table custom
387
388
vi ifcfg-eth0:0
388
389
```
389
390
390
-
7. Add content to the file, *eth0:0*in this case, with the following command. Be sure to update information based on your IP address.
391
+
7. Add content to the file, **eth0:0** in this case, with the following command. Replace **`10.1.0.5`** with your additional private IP address and subnet mask.
391
392
392
393
```bash
393
394
DEVICE=eth0:0
394
395
BOOTPROTO=static
395
396
ONBOOT=yes
396
-
IPADDR=192.168.101.101
397
+
IPADDR=10.1.0.5
397
398
NETMASK=255.255.255.0
398
399
```
399
400
@@ -403,37 +404,82 @@ ip route add default via 10.1.0.1 dev eth2 table custom
403
404
:wq
404
405
```
405
406
407
+
9. To add additional private IP addresses to the network configuration, create additional config files and add the IP information into the file.
408
+
409
+
```bash
410
+
touch ifcfg-eth0:1
411
+
```
412
+
413
+
414
+
```bash
415
+
vi ifcfg-eth0:1
416
+
```
417
+
418
+
```bash
419
+
DEVICE=eth0:1
420
+
BOOTPROTO=static
421
+
ONBOOT=yes
422
+
IPADDR=10.1.0.6
423
+
NETMASK=255.255.255.0
424
+
```
425
+
426
+
```bash
427
+
:wq
428
+
```
429
+
406
430
9. Restart the network services and make sure the changes are successful by running the following commands:
407
431
408
432
```bash
409
-
/etc/init.d/network restart
433
+
systemctl restart NetworkManager.service
410
434
ifconfig
411
435
```
412
436
413
-
You should see the IP address you added, *eth0:0*, in the list returned.
437
+
You should see the IP address or addresses you added in the list returned.
438
+
439
+
```bash
440
+
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
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:
460
+
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:
418
461
419
462
```bash
420
463
ping -I 10.0.0.5 outlook.com
421
464
```
422
465
>[!NOTE]
423
466
>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.
424
467
425
-
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:
468
+
For Linux VMs, when attempting to validate outbound connectivity from a secondary NIC, you may need to add appropriate routes. Please see appropriate documentation for your Linux distribution. The following is one method to accomplish this:
426
469
427
470
```bash
428
471
echo 150 custom >> /etc/iproute2/rt_tables
429
472
430
-
ip rule add from 10.0.0.5 lookup custom
431
-
ip route add default via 10.0.0.1 dev eth2 table custom
473
+
ip rule add from 10.1.0.5 lookup custom
474
+
ip route add default via 10.1.0.1 dev eth2 table custom
432
475
```
433
476
434
-
- Be sure to replace:
477
+
- Ensure to replace:
478
+
435
479
- **10.0.0.5** with the private IP address that has a public IP address associated to it
0 commit comments