Guest access in NAT mode with public IP

Discussions about using Linux guests in VirtualBox.
Post Reply
Blackninja
Posts: 1
Joined: 19. Nov 2015, 12:13
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian 8

Guest access in NAT mode with public IP

Post by Blackninja »

Hi,

I want to host some VMs (Debians) on a online dedicated server (Debian 8 without graphical interface).
I have public IP available for each one and I want them accessible by their public IP

The host server (1&1 provider) only accept NAT mode for virtualisation (if Bridge mode -> MAC spoofing -> host blocked)

My provider says I can access guest on their public IP by :

activate host IP forwarding:

Code: Select all

root@Host:~# sudo sh -c "echo 1 /proc/sys/net/ipv4/ip forward"
create a route to the NAT

Code: Select all

root@Host:~# route add -host 217.160.167.xxx dev virbr0
and then modify iptables

Code: Select all

root@Host:~# iptables -I FORWARD 1 -t filter -d 217.160.167.xxx/32 -o virbr0 -j ACCEPT
root@Host:~# iptables -I FORWARD 1 -t filter -s 217.160.167.xxx/32 -i virbr0 -j ACCEPT
I can't create the route because I don't know the NAT interface of VirtualBox (virbr0 in the example)
Is there a solution to create this route and next the iptables ?

I know that I can use port forwarding with NAT mode but I want each VM be accessible by their own IP because same service (same ports) on each VMs

Thanks a lot and sorry for my english ...
macro
Posts: 64
Joined: 11. Apr 2013, 05:02

Re: Guest access in NAT mode with public IP

Post by macro »

See if this helps:

https://www.virtualbox.org/manual/ch09.html#changenat

Start with the section entitled "9.11.1. Configuring the address of a NAT network interface"
Post Reply