Skip to content

Commit 2ab49fb

Browse files
committed
updated Cent OS section
1 parent f018f94 commit 2ab49fb

File tree

1 file changed

+59
-13
lines changed

1 file changed

+59
-13
lines changed

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

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
author: asudbring
66
ms.service: virtual-network
77
ms.topic: include
8-
ms.date: 09/05/2022
8+
ms.date: 09/06/2022
99
ms.author: allensu
1010
ms.custom: include file
1111
---
@@ -355,13 +355,14 @@ ip route add default via 10.1.0.1 dev eth2 table custom
355355
<summary>Expand</summary>
356356

357357
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:
359360

360361
```bash
361362
sudo -i
362363
```
363364

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:
365366
366367
```bash
367368
cd /etc/sysconfig/network-scripts
@@ -373,7 +374,7 @@ ip route add default via 10.1.0.1 dev eth2 table custom
373374
ls ifcfg-*
374375
```
375376
376-
You should see *ifcfg-eth0* as one of the files.
377+
You should see **ifcfg-eth0** as one of the files.
377378
378379
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.
379380
@@ -387,13 +388,13 @@ ip route add default via 10.1.0.1 dev eth2 table custom
387388
vi ifcfg-eth0:0
388389
```
389390
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.
391392
392393
```bash
393394
DEVICE=eth0:0
394395
BOOTPROTO=static
395396
ONBOOT=yes
396-
IPADDR=192.168.101.101
397+
IPADDR=10.1.0.5
397398
NETMASK=255.255.255.0
398399
```
399400
@@ -403,37 +404,82 @@ ip route add default via 10.1.0.1 dev eth2 table custom
403404
:wq
404405
```
405406
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+
406430
9. Restart the network services and make sure the changes are successful by running the following commands:
407431
408432
```bash
409-
/etc/init.d/network restart
433+
systemctl restart NetworkManager.service
410434
ifconfig
411435
```
412436
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
441+
inet 10.1.0.4 netmask 255.255.255.0 broadcast 10.1.0.255
442+
inet6 fe80::6245:bdff:fe7d:704a prefixlen 64 scopeid 0x20<link>
443+
ether 60:45:bd:7d:70:4a txqueuelen 1000 (Ethernet)
444+
RX packets 858 bytes 244215 (238.4 KiB)
445+
RX errors 0 dropped 0 overruns 0 frame 0
446+
TX packets 1021 bytes 262077 (255.9 KiB)
447+
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
448+
449+
eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
450+
inet 10.1.0.5 netmask 255.255.255.0 broadcast 10.1.0.255
451+
ether 60:45:bd:7d:70:4a txqueuelen 1000 (Ethernet)
452+
453+
eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
454+
inet 10.1.0.6 netmask 255.255.255.0 broadcast 10.1.0.255
455+
ether 60:45:bd:7d:70:4a txqueuelen 1000 (Ethernet)
456+
```
414457
415458
#### Validation (Red Hat, CentOS, and others)
416459
417-
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:
418461

419462
```bash
420463
ping -I 10.0.0.5 outlook.com
421464
```
422465
>[!NOTE]
423466
>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.
424467

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:
426469

427470
```bash
428471
echo 150 custom >> /etc/iproute2/rt_tables
429472
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
432475
```
433476

434-
- Be sure to replace:
477+
- Ensure to replace:
478+
435479
- **10.0.0.5** with the private IP address that has a public IP address associated to it
480+
436481
- **10.0.0.1** to your default gateway
482+
437483
- **eth2** to the name of your secondary NIC
438484

439485

0 commit comments

Comments
 (0)