VM has no connection to the outside

Discussion in 'Installation/Configuration' started by webhunter, Oct 21, 2017.

  1. webhunter

    webhunter Member

    Hi!
    I have some trouble routing traffic to/from my VM.
    I know, this - or similiar problems - are discussed all over the net but I checked out a lot of tutorials and forum posts. Unfortunately, none of the configurations discussed are working for me - or I didn't get it. :/

    Goal: I want to make all of my created VMs/LXCs accessible from the internet. Every VM/LXC should have its own IP. These IPs are in another net than the main IP of the server. Host is running Debian 9.1.

    Host has 62.xxx.xxx.99
    Netmask 255.255.255.0
    Gateway 62.xxx.xxx.1

    Additional IPs are from 82.xxx.xxx.10 to 82.xxx.xxx.20
    Netmask 255.255.254.0
    Gateway 82.xxx.yyy.1

    This is my current config of

    /etc/network/interfaces (host):

    Code:
    auto lo
    iface lo inet loopback
    
    iface eno1 inet manual
    
    auto eno2
    iface eno2 inet static
    address 62.xxx.xxx.99
    netmask 255.255.255.0
    gateway 62.xxx.xxx.1
    post-up echo 1 > /proc/sys/net/ipv4/conf/eno2/proxy_arp
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    
    auto vmbr0
    iface vmbr0 inet static
    address 192.168.0.1
    netmask 255.255.255.0
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    
    (taken from https://forum.proxmox.com/threads/i...cannot-access-the-internet.36061/#post-176699)

    Here, the contetnt of "interfaces" at my test VM (Ubuntu 16.04):

    Code:
    auto lo
    iface lo inet loopback
    
    auto ens18
    iface ens18 inet static
    address 82.xxx.xxx.10
    netmask 255.255.254.0
    gateway 192.168.0.1
    dns-nameservers 4.4.4.4 8.8.8.8
    
    
    Result: VM can't be reached from the outside nor is the gateway (or any other address) reachable by the VM.

    Can someone push me in the right direction, pls?

    Thanks a lot.
     
  2. webhunter

    webhunter Member

    Got it! This config isn't possible at all. You can't route additional IPs which weren't assigned by your provider! :oops: (I guess, I do need some reading about networking stuff :rolleyes:)

    Whatsoever, now I've got my additional IP by my provider. But the same question came up: How can I add the additional IP to my VM?
    I didn't get it.
    What I've done so far:
    /etc/network/interfaces (HOST):
    Code:
    auto lo
    iface lo inet loopback
    
    auto eno1
    iface eno1 inet manual
    
    auto eno2
    iface eno2 inet static
      address   62.xxx.xxx.99     # <--- the servers main IP
      netmask   255.255.255.255
      gateway   62.xxx.xxx.1     # <--- the gateway IP
      pointopoint 62.xxx.xxx.1   # <--- again, the gateway IP
    
    auto br0
    iface br0 inet static
      address 62.xxx.xxx.99   # <--- the server's main IP, iface br0 is routing all the traffic to the outside world
      netmask 255.255.255.255
      bridge_stp off
      bridge_ports none
      bridge_fd 0
      bridge_maxwait 0
    
      up route add -host 188.xxx.xxx.xxx dev br0   # <--- add and route additional IP to iface br0
    
    /etc/network/interfaces (GUEST):
    Code:
    auto ens18
    iface ens18 inet static
      address   188.xxx.xxx.xx     # <--- the additional IP
      netmask   255.255.255.255
      gateway   62.xxx.xxx.99     # <--- the IP of iface br0 in host config
      pointopoint 62.xxx.xxx.99   # <--- the IP of iface br0 in host config
    
    The VM doesn't have any connection to the outside world. What do I miss?
     

Share This Page