Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2395  / 2 Years ago, mon, september 12, 2022, 8:35:19

I have a dedicated server with Ubuntu 13.10 installed and a basic installation with Virtualbox and phpvirtualbox to manage the guest OSs on it. I have two IP addresses pointing to the server and I would like to use one of them purely for a virtual OS I have with Ubuntu 12.04 on it.



This means that every port etc. would pass through the host server and be forwarded straight on to this guest OS.



I have looked at the different network methods on VirtualBox but none seem to be for me.



If I use NAT and port forwarding I can set the guest PC to only register calls to those ports through that 2nd IP which is great. However I cant use any standard ports that already are in use on the host PC like SSH or 80 as the host PC uses them on both IPs



How can I get the host OS to just pass everything through to a specific guest OS for a specific IP?



Have I done this wrong and I need to use a different hosting type?



EDIT:



From research and comments it seems bridging should be the way forward but again i am stuck, here is my /etc/network/interfaces file..



# Loopback device:
auto lo
iface lo inet loopback

# device: eth0
auto eth0
iface eth0 inet static
address 1.2.3.4
broadcast 1.2.3.5
netmask 255.255.255.200
gateway 1.2.3.1
# default route to access subnet
up route add -net 1.2.3.6 netmask 255.255.255.220 gw 1.2.3.1 eth0

iface eth0 inet6 static
address 2a01:4f8:161:9442::2
netmask 64
gateway fe80::1

#create bridge using additional IP
auto br1
iface br1 inet static
address 2.3.4.5
netmask 255.255.255.220
gateway 2.3.4.1
broadcast 2.3.4.7
bridge_ports br1 vbox0 vbox1


The server is a Hetzner EX with an additional IP thats on the same MAC address (i can get a different MAC from them if needs be?)



With the above settings i set my Win7 guest OS to be bridged to br1 and set the ip in windows to be static with the same settings i.e.



address 2.3.4.5
netmask 255.255.255.220
gateway 2.3.4.1


But it couldnt pick up a network



Lastly i have added to /etc/vbox/interfaces:



vbox0 vbox br1
vbox1 vbox br1

More From » virtualbox

 Answers
1

After a LOT of trial and error, this seems to be the most reliable option...



http://wiki.hetzner.de/index.php/Netzkonfiguration_Debian/en#Bridged




Bridged With a bridged configuration, packets are sent directly. The
guest system behaves as if independent. As this makes the MAC
addresses of the guest system visible from the outside, a virtual MAC
address needs to be requested via the Hetzner Robot and assigned to
the guest network card. The bridge gets the same network configuration
as eth0. The configuration of eth0 is omitted without replacement.




Get seperate MAC addresses for each of the additional IPs



Then use this for the hosts /etc/network/interfaces..



# remove or disable configuration for eth0
#auto eth0
#iface eth0 inet static
#
auto br0
iface br0 inet static
address (Main IP)
netmask (like eth0, e.g: 255.255.255.254)
gateway (same as that for the main IP)
bridge_ports eth0
bridge_stp off
bridge_fd 1
bridge_hello 2
bridge_maxage 12


Set up the Guest OS in virtualbox to use a bridged network and select br0, then in advanced settings set the mac of the network adapter to the MAC address that Hetzner gave you for the new IP (without any :)



Then in the Guest OS use this..



# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp

iface eth0 inet static
address (ADD IP 1)
broadcast (FOR ADD IP 1)
netmask (FOR ADD IP 1)
gateway (MAIN IP)
dns-nameservers 8.8.8.8

[#27318] Wednesday, September 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
afyess

Total Points: 437
Total Questions: 120
Total Answers: 107

Location: San Marino
Member since Fri, Jul 3, 2020
4 Years ago
afyess questions
;