HOW TO ADD AN ADDITIONAL WORKING IP FOR A VM?

SixSense

New Member
Nov 10, 2023
3
0
1
I have 2 websites working fine on the same IP (92.46.87.48). Is a ubuntu server on a VM. Now I need to assign one ip for every website. I edit the /etc/hosts fine, I just buy an additional IP and now I need to config the network.
All servers are working fine, I just can't reach the new IP (92.46.87.15). With my actual config, If i ping, I recieve the "pong" only from the same machine (92.46.87.48). No ping from outside.


"**PROXMOX DEBIAN SERVER**" IP = **92.46.87.52** (only 1 VM with 2 IPs)

"**VM UBUNTU 22 SERVER**" IP = **92.46.87.48** (subnet 92.46.87.48/27)

Gateway: 92.46.87.33
Netmask: 255.255.255.224


"**VM UBUNTU 22 SERVER**" **ADDITIONAL IP** = **92.46.87.15** (subnet 92.46.87.15/27)

Gateway: 92.46.87.1
Netmask: 255.255.255.224


---------------------------------------------------
"PROXMOX SERVER" /etc/network/interface


Code:
source /etc/network/interfaces.d/*
    
    auto lo
    iface lo inet loopback
    
    auto eno1
    iface eno1 inet manual
    
    auto vmbr0
    iface vmbr0 inet static
            address 92.46.87.52/27
            gateway 92.46.87.33
            bridge-ports eno1
            bridge-stp off
            bridge-fd 0
            up ip route add 92.46.87.15 dev vmbr0
            
            #Kvm bridged mode TCP/IP network performance fix (hardware hangup)
            pre-up /sbin/ethtool --offload eno1 gso off tso off sg off gro off


---------------------------------------------------
"PROXMOX SERVER" route -n (NO PING TO THE NEW ADDITIONAL IP)


Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         92.46.87.33     0.0.0.0         UG    0      0        0 vmbr0
    92.46.87.32     0.0.0.0         255.255.255.224 U     0      0        0 vmbr0

"PROXMOX SERVER": **ip route add 92.46.87.15 dev vmbr0**

"PROXMOX SERVER (ping ok now)" ping 92.46.87.15

Code:
64 bytes from 92.46.87.15: icmp_seq=1 ttl=64 time=0.259 ms

"PROXMOX SERVER" route -n

Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         92.46.87.33     0.0.0.0         UG    0      0        0 vmbr0
    92.46.87.15     0.0.0.0         255.255.255.255 UH    0      0        0 vmbr0
    92.46.87.32     0.0.0.0         255.255.255.224 U     0      0        0 vmbr0

---------------------------------------------------
"PROXMOX SERVER" ip addr show vmbr0

Code:
3: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
        link/ether a0:36:bc:29:89:e1 brd ff:ff:ff:ff:ff:ff
        inet 92.46.87.52/27 scope global vmbr0
           valid_lft forever preferred_lft forever

---------------------------------------------------
"UBUNTU SERVER" /etc/network/interface

Code:
source /etc/network/interfaces.d/*
        
    auto lo
    iface lo inet lookback
    
    auto ens18
    iface ens18 inet static
            address 00:50:56:00:35:D3
            gateway 92.46.87.33

---------------------------------------------------
"UBUNTU SERVER" /etc/netplan/00-installer-config.yaml


Code:
network:
      renderer: networkd
      ethernets:
        ens18:
          dhcp4: false
          dhcp6: false
          optional: true
          addresses:
            - 92.46.87.48/27
            - 92.46.87.15/27
          nameservers:
            addresses: [1.1.1.1,8.8.8.8]
          routes:
            - to: default
              via: 92.46.87.33
              metric: 100
              on-link: true
      version: 2

---------------------------------------------------
"UBUNTU SERVER" ip a

Code:
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 00:50:56:00:35:d3 brd ff:ff:ff:ff:ff:ff
        altname enp0s18
        inet 92.46.87.48/27 brd 92.46.87.63 scope global ens18
           valid_lft forever preferred_lft forever
        inet 92.46.87.15/27 brd 92.46.87.31 scope global ens18
           valid_lft forever preferred_lft forever

---------------------------------------------------
"UBUNTU SERVER" route -n

Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         92.46.87.33     0.0.0.0         UG    100    0        0 ens18
    92.46.87.0      0.0.0.0         255.255.255.224 U     0      0        0 ens18
    92.46.87.32     0.0.0.0         255.255.255.224 U     0      0        0 ens18

---------------------------------------------------
"UBUNTU SERVER" ping 92.46.87.15

Code:
64 bytes from 92.46.87.15: icmp_seq=1 ttl=64 time=0.007 ms

---------------------------------------------------------------------------

So, what do you think guys? What is the reason that I can't reach 92.46.87.15 from outside? Thank you!
 
I found the problem. On Hetzer if you config the "Bridged Network" you have:
IP addresses from additional subnets can only be used on the host system or on a single VM with a single IP

The solution must be the "Routed Network"
Multiple single IP addresses and subnets can be used on one VM.

So I tried to configure multiple IPs on bridge network..