VirtualBox - Public Static IP for a Debian Guest on a Dedicated Server
- by user86296
Goal:
I want to run a Debian-squeeze-Guest in VirtualBox and it's own public static ip.
I found tons of threads about this topic, but all in all I'm now trying for 10 hours (reading the manual, the forums, trying to learn about networking concepts & commands) to give a Guest his own public static ip (so that the Guest is similar to a vServer you can order from a hosting company), but wasn't able to.
Since I'm a big noob as far as networking stuff is concerned, I'm probably doing something wrong.(please bear with me :-) )
Situation:
VirtualBox 4.0.10 (headless no gui) is running on a dedicated Debian-Server, the Guest OS is Debian as well.
The server has a static ip and I ordered an additional ip for a VM.
Problem description:
Upto now I was able to use NAT to access the VM from the outside and to setup an internal network between
several Guests and all of this worked very well.
When setting NIC 1 to bridged and configuring a public static ip on the guest, the guest was unpingable. (neither from outside, nor from the host) I could connect to the guest via the internal network, from another vm, though.
( VBoxManage controlvm VMGuest nic1 bridged eth0 )
( configuration attempt of static-ip on the guest '/etc/network/interfaces' is below)
Please let me know what I'm doing wrong, or what I can try to get it to work, or if you need more info.
I think I've read that with a current VirtualBox-version for bridged networking no special host-configuration is necessary, is that accurate, or might that be the problem?
Additional Info
Info I got from the hosting company about the additional IP
Please note that you can use the IP address only for this server.
IP: 46.4.xx.xx
Gateway: 46.4.xx.xx
Mask: 255.255.255.248
VBoxManage showvminfo VMGuest |less
...
NIC 1: MAC: 080027D72F7B, Attachment: Bridged Interface 'eth0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0
NIC 2: MAC: 080027B03B75, Attachment: Internal Network 'InternalNet1', Cable connected: on, Trace: off (file: none), Type: Am79C973, Reported speed: 0 Mbps, Boot priority: 0
NIC 3: disabled
(...rest is disabled)
cat /etc/network/interfaces on the Host-machine
# Loopback device:
auto lo
iface lo inet loopback
# device: eth0
auto eth0
iface eth0 inet static
address 46.4.xx.xx
broadcast 46.4.xx.xx
netmask 255.255.255.224
gateway 46.4.xx.xx
post-up mii-tool -F 100baseTx-FD eth0
# default route to access subnet
up route add -net 46.4.xx.xx netmask 255.255.255.224 gw 46.4.xx.xx eth0
cat /etc/network/interfaces on the Guest-VM
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 46.4.xx.xx
netmask 255.255.255.248
gateway 46.4.xx.xx
auto eth1
iface eth1 inet dhcp
ifconfig -a on the Guest shows the correct static ip for eth0 but the Guest is unreachable "over eth0"
eth0 Link encap:Ethernet HWaddr 08:00:27:d7:2f:7b
inet addr:46.4.xx.xx Bcast:46.4.xx.xx Mask:255.255.255.248
inet6 addr: fe80::a00:27ff:fed7:2f7b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1260 (1.2 KiB) TX bytes:3114 (3.0 KiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:b0:3b:75
inet addr:192.168.10.3 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:feb0:3b75/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:142 errors:0 dropped:0 overruns:0 frame:0
TX packets:92 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15962 (15.5 KiB) TX bytes:14540 (14.1 KiB)
Interrupt:16 Base address:0xd240
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:16436 Metric:1
RX packets:123 errors:0 dropped:0 overruns:0 frame:0
TX packets:123 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:25156 (24.5 KiB) TX bytes:25156 (24.5 KiB)