Linux – Interface Eth1 not visible in Virtual Machine

ethernetlinuxnetwork-interfacenetworkingvirtualbox

I am new to linux networking. Basically I wanted to use eth1 interface of my PC in VirtualBox but I simply don't find the eth1 interface. Below are the ifconfig and sudo ifconfig eth1 outputs. Please help me with valuable ideas.

Thanks.

o/p from Host :

sameer@sameer-Vostro-1015:~$ ifconfig
eth0  Link encap:Ethernet  HWaddr b8:ac:6f:6b:18:62  
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo    Link encap:Local Loopback  
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:2338 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2338 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:314892 (314.8 KB)  TX bytes:314892 (314.8 KB)

wlan0 Link encap:Ethernet  HWaddr 20:7c:8f:07:a6:58  
      inet6 addr: fe80::227c:8fff:fe07:a658/64 Scope:Link
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:23408 errors:0 dropped:0 overruns:0 frame:0
      TX packets:17505 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:15494141 (15.4 MB)  TX bytes:2203889 (2.2 MB) 


sameer@sameer-Vostro-1015:~$ sudo ifconfig eth1
eth1: error fetching interface information: Device not found

o/p from Virtual Box :

O/P from VirtualBox

Best Answer

The guest VM does not have direct access to the network interfaces of your host PC, it has a virtual network adapter. If you want all traffic from your VM to use a specific interface, you need to enter the VirtualBox network settings for that VM and configure Bridged Mode with the interface in question. The default mode is NAT, where VirtualBox will essentially act as a router for your virtual machines and the network complexity is hidden to the guests; in bridged mode, the VM is essentially allowed to use the interface directly, and from a network perspective it is as if a second interface is connected to the port. See https://www.virtualbox.org/manual/ch06.html, specifically section 6.5, "Bridged Networking".

Bear in mind that you can add multiple network adapters in the VirtualBox config, so if you want multiple interfaces on your host to be available to your VM in this way, you'd just set up multiple bridged interfaces, each bound to a different interface on the host.

Related Question