Letting the VM access internet through the Masquerading configuration (OVH)

ATX

New Member
Nov 5, 2019
20
0
1
36
Hi

Context
One OVH dedicated server, 1 public IP.
I tried to configure a NAT for my VM to share the same public IP.

Issue
I do try to install a ubuntu light image on a VM.
However I am not able to reach the outside internet from the VM and:
- Automatic DHCP configuration wont work.
- Setting a manual IP 192.168.1.2(192.168.1.1 Gateway) wont work.


Config
Code:
# The loopback network interface
auto lo
iface lo inet loopback


# vmbr0: Bridging. Make sure to use only MAC adresses that were assigned to you.
auto vmbr0
iface vmbr0 inet static
    address xxxxxxxx/24 # Public ip
    gateway xxxxxx.254
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

# added

auto vmbr1
#private sub network
iface vmbr1 inet static
        address  192.168.1.1
        netmask  255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0
 
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '192.168.1.0/24' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.1.0/24' -o vmbr0 -j MASQUERADE


Could you please advice ? I am not sure how to investigate this issue.
Thanks
 
hey you're having the same issue I have. Feel free to follow this thread that I started so in case I find a solution (meaning that the setup fully works, with firewall setup, multiple natted subnets, etc...) I will post a followup reply there ^-^

(edit1) - added link to the mentioned thread. Forgot to do that before posting the reply.