Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-12-2014, 11:42 PM
|
#1
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Rep:
|
VM to connect Internet via Host
Hi all
Host Debian 7.3
VM Ubuntu 12.04
Oracle VirtualBox
Cable connection of Host
ISP -> PC
Static IP address
2 NICs
Host can access Internet
/etc/network/interfaces
Code:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
/etc/resolv.conf
Code:
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
Please advice how to make VM connect Intenet via Host?
Would following document relevant?
VirtualBox: Make your virtual machine accessible from your host system but not from the local network
http://slopjong.de/2013/05/14/virtua...local-network/
Thanks
Rgds
satimis
|
|
|
04-13-2014, 01:46 AM
|
#2
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348
Rep:
|
VirtualBox allows 6 different kinds of VM NICs: - NAT: The adapter is placed in a special IP subnet served by a virtual router. The router has a built-in DHCP server and DNS proxy, and will NAT outgoing traffic behind the IP address of the hypervisor host.
- NAT Network: The VM NIC is connected to a specific "NAT Network". Multiple networks may be created from the VirtualBox GUI, and port forwarding configured.
- Bridged Adapter: The VM NIC is bridged to a specific NIC on the hypervisor host. VirtualBox will suggest a MAC address for this NIC.
- Host-only Adapter: The VM NIC will appear in a virtual network shared with one of the host hypervisor's virtual adapters (and any number of other VMs). VirtualBox creates one such adapter on the hypervisor by default.
- Internal Network: The VM NIC is connected to a virtual, closed network. Any number of VM may share the same internal network, but this network is not accessible from the hypervisor host. One such network ("intnet") is created by default. Any number of internal networks can be created, simply by typing a name in the "Name:" box.
- Generic Driver: The VM NIC is connected to a specific driver on the hypervisor host (such as a "Virtual Distributed Ethernet" switch or a UDP Tunnel).
If you just want to access the Internet using the Internet connection of the host computer, try the NAT mode and configure the VM to use DHCP, not "static".
See the VirtualBox documentation/help file for more information.
|
|
|
04-13-2014, 02:48 AM
|
#3
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by Ser Olmy
- snip -
If you just want to access the Internet using the Internet connection of the host computer, try the NAT mode and configure the VM to use DHCP, not "static"
|
Thanks for your advice.
What I expect to achieve is without router would it be possible to assign static IP to the VM? So that the VM can be browsed on Internet
satimis
|
|
|
04-13-2014, 04:03 AM
|
#4
|
LQ Addict
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316
|
Quote:
Originally Posted by satimis
Thanks for your advice.
What I expect to achieve is without router would it be possible to assign static IP to the VM? So that the VM can be browsed on Internet
satimis
|
You don't need a static IP address to browse the internet. A DHCP one is exactly as useful as a static one.
If you choose NAT, your guest will get an address from Virtualbox via DHCP. This is why you have to set eth0 to DHCP in /etc/interfaces on the guest (assuming eth0 is the device connected to the NAT network).
If you need the same address each time you boot the guest, you should be able to configure VirtualBox and/or dnsmasq, the program that implements the DHCP server. I can't help with that, but VirtualBox documentation is pretty good.
|
|
|
04-13-2014, 05:28 AM
|
#5
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by berndbausch
- snip -
If you need the same address each time you boot the guest, you should be able to configure VirtualBox and/or dnsmasq, the program that implements the DHCP server. I can't help with that, but VirtualBox documentation is pretty good.
|
That what I expect to do. I'll run webserve on VM. I need static IP so that the domain DNS will point to it allowing visitor browsing the website.
I'll make some search on VirtualBox document. Do you have any idea under which heading? Thanks
satimis
|
|
|
04-13-2014, 05:32 AM
|
#6
|
LQ Addict
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316
|
Quote:
Originally Posted by satimis
That what I expect to do. I'll run webserve on VM. I need static IP so that the domain DNS will point to it allowing visitor browsing the website.
I'll make some search on VirtualBox document. Do you have any idea under which heading? Thanks
satimis
|
Not offhand, sorry. Try google as well
|
|
|
04-13-2014, 12:38 PM
|
#7
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348
Rep:
|
Quote:
Originally Posted by satimis
That what I expect to do. I'll run webserve on VM. I need static IP so that the domain DNS will point to it allowing visitor browsing the website.
|
Then configure the VM NIC as a bridged adapter, and give the VM a static IP address in the same network as the hypervisor host.
|
|
|
04-13-2014, 08:12 PM
|
#8
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by Ser Olmy
Then configure the VM NIC as a bridged adapter, and give the VM a static IP address in the same network as the hypervisor host.
|
Hi,
Thanks for your advice.
I did that before behind a router. But now there is no router I could not figure out how set Br0 on both Host and VM (a webserver). I want VM assigned a static IP so that it can be browsed on Internet.
Here below is my suggestion:
Host
Code:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
auto br0
iface br0 inet static
address 192.168.0.100 ?
network 192.168.0.0 ?
netmask 255.255.255.0 ?
broadcast 192.168.0.255 ?
gateway 192.168.0.1 ?
bridge_ports eth1 ?
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stop off
On VM
Code:
# The loopback network interface
auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.0.101 ?
network 192.168.0.0 ?
netmask 255.255.255.0 ?
broadcast 192.168.0.255 ?
gateway 192.168.0.1 ?
bridge_ports eth1 ?
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stop off
Please advise. Thanks
Rgds
satimis
|
|
|
04-13-2014, 09:22 PM
|
#9
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348
Rep:
|
Why are you creating bridges on the hypervisor and the VM?
|
|
|
04-13-2014, 09:27 PM
|
#10
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by Ser Olmy
Why are you creating bridges on the hypervisor and the VM?
|
Please advise what shall enter on /etc/network/interface of VM ?
Any mistake made on /etc/network/interface of Host ?
Thanks
satimis
|
|
|
04-13-2014, 09:33 PM
|
#11
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348
Rep:
|
I think there may have been a slight misunderstanding here. When I recommended using a "bridged interface", I was refering to the NIC setup for the VM in VirtualBox, not the configuration of the hypervisor or the VM OS.
If you're using the Oracle GUI to manage your virtual machines, you'll find the relevant setting under "Network". For each NIC on that tab, in the pulldown menu next to the text "Attached to:" you'll find the various operatin modes I mentioned earlier. That's where you'll need to select "Bridged adapter" for the VM NIC to appear on the same network as one of the physical adapters on the hypervisor.
Once you've done this, configure eth0 on the VM with a static IP address as you would any other host on that network.
|
|
|
04-13-2014, 10:45 PM
|
#12
|
LQ Addict
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316
|
In case you still want to use NAT, set the IP address according to instructions "9.11. Fine-tuning the VirtualBox NAT engine" in the VirtualBox help file.
|
|
|
04-14-2014, 10:56 AM
|
#13
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by Ser Olmy
I think there may have been a slight misunderstanding here. When I recommended using a "bridged interface", I was refering to the NIC setup for the VM in VirtualBox, not the configuration of the hypervisor or the VM OS.
If you're using the Oracle GUI to manage your virtual machines, you'll find the relevant setting under "Network". For each NIC on that tab, in the pulldown menu next to the text "Attached to:" you'll find the various operatin modes I mentioned earlier. That's where you'll need to select "Bridged adapter" for the VM NIC to appear on the same network as one of the physical adapters on the hypervisor.
Once you've done this, configure eth0 on the VM with a static IP address as you would any other host on that network.
|
Hi,
Performed following steps
Host
/etc/network/interfaces
Code:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address xx.xx.xx.xx
netmask 255.255.255.252
broadcast xx.xx.xx.xx
gateway xx.xx.xx.xx
auto br0
iface br0 inet static
address 192.168.0.100
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
bridge_ports eth1 (if select eth0, unable to connect broadband)
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stop off
VM
-> network
Adapter 1
Attached to: Bridged Adapter
Name eth0/br0/eth1
None of them can work, unable to access Internet.
B.R.
satimis
|
|
|
04-20-2014, 06:39 AM
|
#14
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by berndbausch
In case you still want to use NAT, set the IP address according to instructions "9.11. Fine-tuning the VirtualBox NAT engine" in the VirtualBox help file.
|
Hi,
Thanks for your advice.
I have to face 2 problems on using NAT
1)
Can I do port forwarding?
2)
On running FileZilla download folders/files the VM aborted automatically
log
Code:
....
GL_NV_texture_barrier GL_ARB_robustness GL_ARB_texture_storage
00:05:02.186305 NAT: ti is null. can't do any reseting connection actions
00:05:22.193662 NAT: ti is null. can't do any reseting connection actions
00:06:11.770888 NAT: ti is null. can't do any reseting connection actions
Having tried hours without a solution.
Rgds
satimis
Last edited by satimis; 04-20-2014 at 06:41 AM.
|
|
|
All times are GMT -5. The time now is 04:36 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|