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
+96-21Lines changed: 96 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,65 +47,140 @@ ping -S 10.0.0.5 hotmail.com
47
47
>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.
48
48
49
49
### Linux (Ubuntu 14/16)
50
-
We recommend looking at the latest the documentation for your Linux distribution.
50
+
51
+
We recommend looking at the latest documentation for your Linux distribution.
51
52
52
53
1. Open a terminal window.
53
54
2. Make sure you are the root user. If you are not, enter the following command:
54
55
55
-
```bash
56
-
sudo -i
57
-
```
56
+
```bash
57
+
sudo -i
58
+
```
58
59
59
60
3. Update the configuration file of the network interface (assuming ‘eth0’).
60
61
61
62
* Keep the existing line item for dhcp. The primary IP address remains configured as it was previously.
62
63
* Add a configuration for an additional static IP address with the following commands:
63
64
64
-
```bash
65
-
cd /etc/network/interfaces.d/
66
-
ls
67
-
```
65
+
```bash
66
+
cd /etc/network/interfaces.d/
67
+
ls
68
+
```
68
69
69
70
You should see a .cfg file.
70
71
4. Open the file. You should see the following lines at the end of the file:
71
72
73
+
```bash
74
+
auto eth0
75
+
iface eth0 inet dhcp
76
+
```
77
+
78
+
5. Add the following lines after the lines that exist in this file:
79
+
80
+
```bash
81
+
iface eth0 inet static
82
+
address <your private IP address here>
83
+
netmask <your subnet mask>
84
+
```
85
+
86
+
6. Save the file by using the following command:
87
+
88
+
```bash
89
+
:wq
90
+
```
91
+
92
+
7. Reset the network interface with the following command:
93
+
94
+
```bash
95
+
sudo ifdown eth0 && sudo ifup eth0
96
+
```
97
+
98
+
> [!IMPORTANT]
99
+
> Run both ifdown and ifup in the same line if using a remote connection.
100
+
>
101
+
102
+
8. Verify the IP address is added to the network interface with the following command:
103
+
104
+
```bash
105
+
ip addr list eth0
106
+
```
107
+
108
+
You should see the IP address you added as part of the list.
109
+
110
+
### Linux (Ubuntu 18.04+)
111
+
112
+
Ubuntu 18.04 and above have changed to `netplan`for OS network management. We recommend looking at the latest documentation for your Linux distribution.
113
+
114
+
1. Open a terminal window.
115
+
2. Make sure you are the root user. If you are not, enter the following command:
116
+
72
117
```bash
73
-
auto eth0
74
-
iface eth0 inet dhcp
118
+
sudo -i
75
119
```
76
120
77
-
5. Add the following lines after the lines that exist inthis file:
121
+
3. Create a file forthe second interface and open itina text editor:
78
122
79
123
```bash
80
-
iface eth0 inet static
81
-
address <your private IP address here>
82
-
netmask <your subnet mask>
124
+
vi /etc/netplan/60-static.yaml
83
125
```
84
126
85
-
6. Save the file by using the following command:
127
+
4. Add the following lines to the file, replacing `10.0.0.6/24` with your IP/netmask:
128
+
129
+
```bash
130
+
network:
131
+
version: 2
132
+
ethernets:
133
+
eth0:
134
+
addresses:
135
+
- 10.0.0.6/24
136
+
```
137
+
138
+
5. Save the file by using the following command:
86
139
87
140
```bash
88
141
:wq
89
142
```
90
143
91
-
7. Reset the network interface with the following command:
144
+
6. Test the changes using [netplan try](http://manpages.ubuntu.com/manpages/cosmic/man8/netplan-try.8.html) to confirm syntax:
92
145
93
146
```bash
94
-
sudo ifdown eth0 && sudo ifup eth0
147
+
netplan try
95
148
```
96
149
97
-
> [!IMPORTANT]
98
-
> Run both ifdown and ifup in the same line if using a remote connection.
99
-
>
150
+
> [!NOTE]
151
+
>`netplan try` will apply the changes temporarily and roll the changes back after 120 seconds. If there is a loss of connectivity, please wait 120 seconds, and then reconnect. At that time, the changes will have been rolled back.
152
+
153
+
7. Assuming no issues with `netplan try`, apply the configuration changes:
154
+
155
+
```bash
156
+
netplan apply
157
+
```
100
158
101
159
8. Verify the IP address is added to the network interface with the following command:
102
160
103
161
```bash
104
162
ip addr list eth0
105
163
```
106
164
107
-
You should see the IP address you added as part of the list.
165
+
You should see the IP address you added as part of the list. Example:
108
166
167
+
```bash
168
+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
0 commit comments