This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Thursday, March 3, 2016

How can I add more ethernet interface to a guest Linux server after installation?

Add more ethernet interface to a guest after installation

Issue 

When a guest OS was created using virt-manager or virt-install, it created one ethernet interface for the guest. How do I create a second and third interface and attach them to the guest post insatllation?

Resolution
 

Xen

Using virt-manager. (Recommended)
  •     Right Click the Guest in virt-manager and select "Open" an dselect "Hardware" tab
  •     Click on "Add Hardware"
  •     Select "Network" as the "Hardware Type" and click Forward.
  •     Select "Virtual Network" or "Shared physical device" depending upon the requirement. Set fixed MAC address if needed. Select "Hypervisor default" or another appropriate Deivce Model. Click Forward
  •     Then Click "Finish".
  •     New network will be attached to the guest on the next reboot.

By manually editing the guest configuration file. (Not recommended)

    Edit the configuration file for that guest at /etc/xen/guestname and add nic = 2 for two interfaces and or nic = 3 for three interfaces.
    Change the vif = entry.

     vif = [ 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0' ]
     To (For two interfaces)
     vif = [ 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0', 'mac=xx:xx:xx:xx:xx:xx:xx,

    bridge=xenbr0' ]
     OR To (For three interfaces)
     vif = [ 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0', 'mac=xx:xx:xx:xx:xx:xx:xx,
    bridge=xenbr0', 'mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0' ]

    For fully virtualised guests it should be as below:

     vif = [ 'type=ioemu,mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0',
    'type=ioemu,mac=xx:xx:xx:xx:xx:xx:xx, bridge=xenbr0',
    'type=ioemu,mac=xx:xx:xx:xx:xx:xx, bridge=xenbr0' ]

    Configure eth1 and eth2 inside the guest OS as usual.

Note: xx:xx:xx:xx:xx:xx needs to be replaced by a unique mac address.


KVM

Using virt-manager.
  •     Right Click the Guest in virt-manager and select "Open" an dselect "Hardware" tab
  •     Click on "Add Hardware"
  •     Select "Network" as the "Hardware Type" and click Forward.
  •     Select "Virtual Network" or "Shared physical device" depending upon the requirement. Set fixed MAC address if needed. Select "Hypervisor default" or another appropriate Deivce Model. Click Forward
  •     Then Click "Finish".
    New network will be attached to the guest on the next reboot.

No comments:

Post a Comment