Setting up 2 ip with one interface

eXtre

New Member
Dec 29, 2024
1
0
1
Setting up 2 ip with one interface

There is a vps on which there is a main ip(address 185.XXX.XX.XX6/24 gateway 185.XXX.XX.1 mask 255.255.255.0) and an additional ip(address 193.XX.XX.X3/25 gateway 193.XX.XX.1 mask 255.255.255.125 ) was purchased. Help to configure the network interface in proxmox. Tried different ways, no way to run the second ip as a bridge. Here are my settings

Code:
auto lo
iface lo inet loopback
iface lo inet6 loopback

iface ens18 inet manual

auto vmbr0
iface vmbr0 inet static
        address 185.XXX.XX.XX6/24
        gateway 185.XXX.XX.1
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up echo 1 > /proc/sys/net/ipv4/conf/ens18/proxy_arp

auto vmbr1
iface vmbr1 inet static
        address  193.XX.XX.X3/25
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        up ip route add 193.XX.XX.X3/25 via 193.XX.XX.1 dev ens18

auto vmbr2
iface vmbr2 inet static
        bridge-ports none
        bridge-stp off
        мост-fd 0


Also I tried to configure different routes for different ip's

Code:
# Interface (ens18)
auto ens18
iface ens18 inet manual

#1ip
auto vmbr0
iface vmbr0 inet static
        address         185.XXX.XX.XX6
        netmask         255.255.255.0
        gateway         185.XXX.XX.1
        bridge_ports    ens18
        bridge_stp      off
        bridge_fd       0
        post-up ip route add default via 185.XXX.XX.1 table vmbr0_table
        post-up ip rule add from 185.XXX.XX.XX6 table vmbr0_table

# 2ip
auto vmbr1
iface vmbr1 inet static
        address         193.XX.XX.X3
        netmask         255.255.255.128
        bridge_ports    none
        bridge_stp      off
        bridge_fd       0
        post-up ip route add default via 193.XX.XX.1 table vmbr1_table
        post-up ip rule add from 193.XX.XX.X3 table vmbr1_table


/etc/iproute2/rt_tables

Code:
100 vmbr0_table
200 vmbr1_table
 
Last edited: