0

I've recently configured my network using advice from this question but now I need to configure this a little different. I'm using Debian distribution.

I have one dedicated server with 3 IP addresses assigned to it from my provider. I want to configure it in such way that two IP are assigned to host and one is assigned to virtual machine:

My /etc/network/interfaces from host now looks like this:

auto lo br0
iface lo inet loopback

iface eth0 inet manual

iface br0 inet static
        bridge_ports eth0
        address 192.168.0.1
        broadcast 192.168.0.95
        netmask 255.255.255.224
        gateway 192.168.0.65
        bridge_stp off       # disable Spanning Tree Protocol
        bridge_waitport 0    # no delay before a port becomes available
        bridge_fd 0          # no forwarding delay

On my virtual machine:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.0.3
        netmask 255.255.255.224
        broadcast 192.168.0.1
        gateway 192.168.0.65
        hwaddress ether xx:xx:xx:xx:xx:xx
        post-up iptables-restore < /etc/iptables.up.rules

Now I want to add address 192.168.0.2 to point to host server (I want to assign separate apache configuration to this IP later). How can I achieve this?

2 Answers2

0

your VM IP has to be with this format:

 IP x.y.z.3
 MASK 255.255.255.255
 gateway x.y.z.1 (if it does gateway, else same ip and replace last number by 1)

by the way the ip are link to Mac address so carefuller to set correctly the mac address, some providers can block your machine if you send an incorrect mac address to the network

Froggiz
  • 3,043
  • 1
  • 19
  • 30
  • Actually this is not what I was asking for. I accidentaly found answer http://serverfault.com/questions/548310/how-to-setup-ip-alias-on-bridged-interface-in-ubuntu – Andrzej Pindor Feb 26 '15 at 15:22
0

Ok, I've figure it out. I've added this to /etc/network/interfaces:

 post-up /sbin/ifconfig br0:0 192.168.0.3 netmask 255.255.255.224

So now host /etc/network/interfaces looks like this:

auto lo br0
iface lo inet loopback

iface eth0 inet manual

iface br0 inet static
        bridge_ports eth0
        address 192.168.0.1
        broadcast 192.168.0.95
        netmask 255.255.255.224
        gateway 192.168.0.65
        bridge_stp off       # disable Spanning Tree Protocol
        bridge_waitport 0    # no delay before a port becomes available
        bridge_fd 0          # no forwarding delay
        post-up /sbin/ifconfig br0:0 192.168.0.2 netmask 255.255.255.224

It's important to add this virtual interface br0:0 in post-up because otherwise it's not respected.