How to add secondary ipv4 address in Virtual Machine?
Here you will be given the explanation on setting up the additional IPv4 on the VPS provided by HostingRaja.
For example the Main IP Address of the VPS provided to you will be 184.108.40.206
When you have purchased an additional IP address through HostingRaja control panel, you will be assigned another IP for example 220.127.116.11.
After purchasing an additional IPv4 address you will have to restart the VPS using the “Server Restart” feature which you can get within the HostingRaja control panel. One should remember that this must be done regardless of the operating system being used.
Here each of the examples will be able to configure the secondary IP address to become automatically available, and it will remain configured even after the server is being rebooted. You can even test if the IP address is being configured by pinging it with the ping utility being provided on the client computer.
Windows Server 2012
The main IPv4 address must be configured manually before adding the IPv4 address.
For configuring the main IPv4 manually:
- First and foremost step is by opening the command prompt(cmd.exe).
- Type: ipconfig/all
- There will be a page or two of the output. Now you have to find the page that is having the information about the primary ethernet adapter, which is an Ethernet adapter Ethernet 2”. Now you need to write down the values for IPv4 address, subnet mask, default gateway as well as DNS Servers.
Ethernet adapter Ethernet 2:
Connection-specific DNS Suffix . :
Physical Address. . . . . . . . . : 00-00-00-00-00-00
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 18.104.22.168(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.254.0
Default Gateway . . . . . . . . . : 22.214.171.124
DNS Servers . . . . . . . . . . . : 126.96.36.199
NetBIOS over Tcpip. . . . . . . . : Enabled
- Now you have to open the windows control panel. You will be able to access it from the start menu.
- Now you have to click on the "Network and Internet.”
- Then you have to Click on the “Network and Sharing Center.”
- After that you have to Click on “Change adapter settings”.
- Now you need to click on the primary ethernet adapter and then click on the “Properties”. Then the “Ethernet Properties” window will be opening.
- Then you need to select the "Internet Protocol Version 4 (TCP/IPv4)" and then you have to click on the “Properties” button. After that the “Internet Protocol Version 4 (tcp/ipV4) Properties windows will be opening.
- Then you need to Click ‘Advanced…” The Advanced TCP/IP Settings” windows will open.
- In the “IP address”group, you need to click “Add…”. The “TCP/IP Address” windows will be opening.
- After that Click “OK” on the “Advanced TCP/IP Settings” window. This window will then be closed.
- Now you need to click “OK” on the IPV4 Properties window. This window will then be closing.
- Then Click “OK” on the “Ethernet Properties” window. This window will then close and then the secondary IP address will then be configured.
You need to change the boot protocol from “dhcp” to static” on eth0. If you are already been using a static binding, then you have an option to skip this step. Otherwise follow the directions as it has been mentioned below:
- You have to open /etc/sysconfig/network-scripts/ifcfg-eth0 in a text editor.
- Now you need to change BOOTPROTO=dhcp to BOOTPROTO=static.
- Now you need to add the lines at the end of the file. Substitute "[mainip]", "[netmask]", and "[gateway]" with the values from the "IPv4" tab on your HostingRaja control panel.
Run ifup eth0.
Then you have to create the file /etc/sysconfig/network-scripts/ifcfg-eth0:1.
Now you need to populate the file with the following contents:
After that activate the alias with the following command:
- First step is to determine the name of the ethernet device. In the example provide we will be using the example eth0.
- Ip link show
- Now you have to add the following lines in /etc/network/interfaces:
iface eth0:0 inet static
- Then you have to activate the alias with the following command:
- First step is the determination of the name of the ethernet device. Here in this example ens0 will be used.
- Ip link show
- Now you need to add the following lines in/etc/network/interfaces:
iface ens3:0 inet static
Now you need to activate the alias with the following command being provided:
Note: You need to make it sure that the interfaces name is matched like eth0, ens3…. And one must make sure that example configuration is modified for using the correct interface name as well as IPs.
Free BSD 10
You need to add the following lines in /etc/rc.conf:
ifconfig_vtnet0_alias0="188.8.131.52 netmask 255.255.255.0"
Now you have to run the following command for restarting the networking:
/etc/rc.d/netif restart && /etc/rc.d/routing restart