Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Routing IP address on a network bridge
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Routing IP address on a network bridge

Hey,

I got a (probably stupid) question.

I have a dedicated server running with a second ip which is bridged to a vm. Everything is working fine.

Lets say its:

Main IP=96.97.98.99
Second IP=96.97.98.100
Gateway on the host is=96.97.98.97
Netmask=255.255.255.224

I set up a route to the 96.97.98.100 IP.

Now I ordered I third IP which I want to bridge, too. The problem is, that the IP is out of the range. Lets say it is:

Third IP=96.97.98.180

How do I setup the bridge, so all given IP addresses are reachable via Internet?

Thanks in advance!

Comments

  • Not a problem.

  • you want to have that on your dedi our assign it to a VM? proxmox by any chance? ;-)

    if the first three octets are the same I guess you could either go and simply change the netmask into some bigger 'subnet' or use /32 and pointopoint for everything (even if the first IPs are on the same subnet)

  • WSSWSS Member

    It's probably bridged as a pointopoint. Ask them how it's provisioned.

  • It's a hetzner machine. The host is running proxmox, but I assigned the IP address manually on the guest which should have the third ip, which seems to be assigned correctly.

    I also created a separate MAC address for the IP address, which I assigned to the network interface on the guest machine.

    Hetzner shows the gateway netmask and stuff at the IP address, but I don't know how to "combine" the settings on the host.

  • something like this should work... also if the new addon IPv4 is from totally different subnet.

    auto eth0
    iface eth0 inet static
            address 96.97.98.99
            netmask 255.255.255.255
            gateway 96.97.98.97
            pointopoint 96.97.98.97
    
    auto vmbr0
    iface vmbr0 inet manual
            address  96.97.98.99
            netmask  255.255.255.255
            bridge_ports none
            bridge_stp off
            bridge_fd 0
            up ip route add 96.97.98.100/32 dev vmbr0
            up ip route add 96.97.98.180/32 dev vmbr0
            down ip route del 96.97.98.100/32 dev vmbr0
            down ip route del 96.97.98.180/32 dev vmbr0
    

    remember that there will be no automatic assignment of that IP to a VM in a routed setup, so you need to set the IP in the guest correctly. also brings in the problem of possiblr IP hijacking if it is not you using the VM...

    of course you can assign directly to eth0 with 'ip addr add' instead, if you only want that be available on the hostnode and not the bridge/VMs ;-)

  • @nobizzle said:
    It's a hetzner machine. The host is running proxmox, but I assigned the IP address manually on the guest which should have the third ip, which seems to be assigned correctly.

    I also created a separate MAC address for the IP address, which I assigned to the network interface on the guest machine.

    Hetzner shows the gateway netmask and stuff at the IP address, but I don't know how to "combine" the settings on the host.

    sorry, already posted before I read this...

    if you have a bridge using a routed setup I suggest simply adding a second bridge for using a proper 'bridged' setup with the virtual mac. to help any further it might be helpful if you could post your redacted /etc/network/interfaces ;-)

  • This is my setting on the host:

    auto vmbr0
    iface vmbr0 inet static
    address 96.97.98.99
    netmask 255.255.255.224
    gateway 96.97.98.97
    pointopoint 96.97.98.97 
    bridge_ports enp4s0
    bridge_stp off
    bridge_maxwait 5
    
    up ip route add 96.97.98.100/32 dev vmbr0
    down ip route del 96.97.98.100/32 dev vmbr0
    
    up ip route add 96.97.98.180/32 dev vmbr0
    down ip route del 96.97.98.180/32 dev vmbr0
    

    so changing this to 255.255.255.255 should do the trick? on the guest the gateway stays the host ip *.99?

  • I always do use netmask 255.255.255.255 and pointopoint to the main gateway *.97 on the guest ...

  • Give me a second :)

  • nobizzlenobizzle Member
    edited August 2017

    So now I set up the host to use gateway 255.255.255.255, and on the guest with the second IP I changed the netmask from 224 to 255 and the gateway from 99 to 97, but it won't come up now :S

    This is so annoying...

    Even if i set it back to the previously working settings it wont come up. actually because of the second network interface with an internal network... FILE EXISTS.. had it before but no idea why.

  • Hey, back again..

    I tried it again.. I had to reboot the host (I probably didn't have to, but it solved the problem). In general you were right. I'm using pointopoint now on the guest, too. The VM i wanted to use was an Arch Linux system, but I don't know how to use pointopoint there. I'll just migrate the stuff to good ol' debian. Better solution anyway. Everything works just fine.

    Thank you!

    Thanked by 1Falzo
  • @nobizzle said:
    Hey, back again..

    I tried it again.. I had to reboot the host (I probably didn't have to, but it solved the problem). In general you were right. I'm using pointopoint now on the guest, too. The VM i wanted to use was an Arch Linux system, but I don't know how to use pointopoint there. I'll just migrate the stuff to good ol' debian. Better solution anyway. Everything works just fine.

    Thank you!

    you're welcome ;-) and yes changing the netmask on the hostnode probably requires a reboot or at least a network restart... glad you figured it out, as said before I use two different bridges for (routed) IPs that belong to a subnet and don't come with a virtual mac and another one for those single vmac IPs as those normally don't need any further routing on the hostnode itself - all as long as you do use the pointopoint setup anyways ^^

    for arch I have to admit I have no clue how this has to be done - never really worked with it. might suffice to declare IP, netmask *.255 and the external gateway to have the system notice that a static route is to be used...

Sign In or Register to comment.