How to add network interface?

hg088

New Member
I have a kvm vps.

I bought an additional IP address and I'd like to assign it to an additional network interface for example eth1.

I contacted support and they told me to assign it to a virtual network interface like this eth0:1 but this way I can't use it as a default gateway which is what I need.
 

Quags

Administrator
Staff member
Usually it is assigned to the same interface. You could always change the main interface. Some things to consider:

you can't really have a second network card on most virtualization systems (like openvz). Not with our set up.

A dedicated server would need a second network port on the switch to do this.

There are some other options. Perhaps you could use a bridge (kvm only not openvz), a tap interface (openvz). Or depending on what you are doing you may just be able to bind to the second network port. Programs like wget have a bind-address in it to choose an ip, curl does as well.
 

hg088

New Member
Usually it is assigned to the same interface. You could always change the main interface. Some things to consider:

you can't really have a second network card on most virtualization systems (like openvz). Not with our set up.

A dedicated server would need a second network port on the switch to do this.

There are some other options. Perhaps you could use a bridge (kvm only not openvz), a tap interface (openvz). Or depending on what you are doing you may just be able to bind to the second network port. Programs like wget have a bind-address in it to choose an ip, curl does as well.
Hi there. Can you please go into more detail about using a bridge interface to solve this?
 

Quags

Administrator
Staff member
I'm actually not sure if this will help as I think about it more. But for bridge set up I use this type of config (centos example)

change ifcfg-eth0

/etc/sysconfig/network-scripts/ifcfg-eth0
<pre>
# br0
DEVICE=eth0
BOOTPROTO=static
ONBOOT="yes"
BRIDGE=br0
</pre>

then create

/etc/sysconfig/network-scripts/ifcfg-br0

<pre>
IPADDR=IP.address
NETMASK=IP.network
GATEWAY=IP.GATEWAY
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes
</pre>

This gives br0 and eth0 devices

As a bridge you may not be able to make a tap device:
ifconfig tap0 SECONDIP up

and have br0, eth0 and tap0
 

paulwilson2813

New Member
To add a network interface to your virtual machine:
Go to the Azure portal to find an existing virtual machine. Search for and select Virtual machines.
Select the name of your VM. The VM must support the number of network interfaces you want to add. To find out how many network interfaces each VM size supports, see the sizes in Azure for Linux VMs or Windows VMs.
In the VM command bar, select Stop, and then OK in the confirmation dialog box. Then wait until the Status of the VM changes to Stopped (deallocated).
From the VM menu bar, choose Networking > Attach network interface. Then in Attach existing network interface, choose the network interface you'd like to attach, and select OK.
If you don't have an existing network interface, you must first create one. To do so, select Create network interface. To learn more about how to create a network interface, see Create a network interface. To learn more about additional constraints when adding network interfaces to virtual machines, see Constraints.
From the VM menu bar, choose Overview > Start to restart the virtual machine.
Now you can configure the VM operating system to use multiple network interfaces properly. Learn how to configure Linux or Windows for multiple network interfaces.

I hope this information will be helpful to resolve your issues!
Paul Wilson
 
Top