Creating internal network with multiple public ips

Discussion in 'Proxmox VE: Networking and Firewall' started by Tetrabyte, Jan 8, 2019.

  1. Tetrabyte

    Tetrabyte New Member

    Joined:
    Jan 8, 2019
    Messages:
    2
    Likes Received:
    0
    Okay so I have setup so I can have an internal private network accept connections in and send connections out through a specific public IP in my block. (Seen in the config below)

    I have two ip blocks and I want to use an ip from the other block, that block being the block the system was rented with (the main block) but for some reason I cannot get any IPs from the main block 69.x.x.x to work.

    All the IPs in the 63.x.x.x block work fine with this config.


    Code:
    auto lo
    iface lo inet loopback
    
    allow-hotplug eth0
    
    iface eth0 inet static
            broadcast 69.*.*.207
            network 69.*.*.200
    
    auto vmbr0
    iface vmbr0 inet static
            address  69.*.*.202
            gateway  69.*.*.201
            netmask  255.255.255.248
            bridge-ports eth0
            bridge-stp off
            bridge-fd 0
    
    # 63.*.*.142 <-> 10.0.1.0
    auto vmbr1
    iface vmbr1 inet static
            address 10.0.1.254
            netmask 255.255.255.0
            bridge-ports none
            bridge-stp off
            bridge-fd 0
    
            # Enable ip forwarding on the Host OS
            post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    
            # Create POST/PREROUTING rules on interface up
            post-up iptables -t nat -A PREROUTING -s 10.0.1.0/24 -i vmbr0 -j DNAT --to 63.*.*.142
            post-up iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -o vmbr0 -j SNAT --to-source 63.*.*.142
            post-up iptables -t nat -A POSTROUTING -s '10.0.1.0/24' -o vmbr0 -j MASQUERADE
    
            # Remove POST/PREROUTING rules on interface down
            post-down iptables -t nat -D PREROUTING -s 10.0.1.0/24 -i vmbr0 -j DNAT --to 63.*.*.142
            post-down iptables -t nat -D POSTROUTING -s 10.0.1.0/24 -o vmbr0 -j SNAT --to-source 63.*.*.142
            post-down iptables -t nat -D POSTROUTING -s '10.0.1.0/24' -o vmbr0 -j MASQUERADE
    
            # Forward port 80 on public IP to 10.0.1.2
            post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.0.1.2:80
            post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.0.1.2:80
    
    This is the config that does not work (The one attempting to use 69.*.*.205 in the same way)

    Code:
    auto lo
    iface lo inet loopback
    
    allow-hotplug eth0
    
    iface eth0 inet static
            broadcast 69.*.*.207
            network 69.*.*.200
    
    auto vmbr0
    iface vmbr0 inet static
            address  69.*.*.202
            gateway  69.*.*.201
            netmask  255.255.255.248
            bridge-ports eth0
            bridge-stp off
            bridge-fd 0
    
    # 69.*.*.205 <-> 10.0.1.0
    auto vmbr1
    iface vmbr1 inet static
            address 10.0.1.254
            netmask 255.255.255.0
            bridge-ports none
            bridge-stp off
            bridge-fd 0
    
            # Enable ip forwarding on the Host OS
            post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    
            # Create POST/PREROUTING rules on interface up
            post-up iptables -t nat -A PREROUTING -s 10.0.1.0/24 -i vmbr0 -j DNAT --to 69.*.*.205
            post-up iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -o vmbr0 -j SNAT --to-source 69.*.*.205
            post-up iptables -t nat -A POSTROUTING -s '10.0.1.0/24' -o vmbr0 -j MASQUERADE
    
            # Remove POST/PREROUTING rules on interface down
            post-down iptables -t nat -D PREROUTING -s 10.0.1.0/24 -i vmbr0 -j DNAT --to 69.*.*.205
            post-down iptables -t nat -D POSTROUTING -s 10.0.1.0/24 -o vmbr0 -j SNAT --to-source 69.*.*.205
            post-down iptables -t nat -D POSTROUTING -s '10.0.1.0/24' -o vmbr0 -j MASQUERADE
    
            # Forward port 80 on public IP to 10.0.1.2
            post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.0.1.2:80
            post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.0.1.2:80
    
     
  2. wolfgang

    wolfgang Proxmox Staff Member
    Staff Member

    Joined:
    Oct 1, 2014
    Messages:
    4,321
    Likes Received:
    276
    Hi,

    I guess your second IP block has another gateway?
    If so you have to set the route manual.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Tetrabyte

    Tetrabyte New Member

    Joined:
    Jan 8, 2019
    Messages:
    2
    Likes Received:
    0
    Yes both of my blocks have a different gateway

    Correct me if I'm wrong but I'm going to need a different interface for that I presume for the second block?

    The odd part about that is the main ip block of the system (The one that is defined at the top in vmbr0 and eth0) is the one that is having issues.

    The second block that does not have any definition in the file at all besides in this new interface works fine.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice