We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

HOWTO : Gentoo Virtual MAC config


hokapoka
14-04-2010, 20:01
Hey Iain

Yep, I made a mistake there. I _DO NOT_ use the IP if the physical machine, I either use the IP of the Vm or the Physical Gateway.

Indeed, as you pointed out it's /32 subnet, so yeah it _should_ be the IP address of the VM.

Having said that, whichever IP I use for the Default Gatway it still shows the source IP as VM's IP, never anything else.

Not had a chance to run any tests yet, will try the different configurations once I have some time.

IainK
13-04-2010, 19:05
With a netmask of 255.255.255.255 on a CIDR IP 'block' (a /32 subnet) the network should only contain 1 device. As such the "correct" way to set it up would be to use the IP address of the virtual machine as the gateway.

There may be some differences between each setup. For example when I set up my VMs to use their own IP address as the gateway and browse the Internet through them the IP address is reported as the VMs IP not the main server IP. With your configuration it may report the main server IP address.

hokapoka
13-04-2010, 18:06
Hey all.

Have been replacing my Debian Virtual Firewall/Gateway with a one built on gentoo. Not sure if anyone will need this, but as there's no guide on how to configure a gentoo box with the Virtual MAC Address, I thought I would make a quick post on how I have done it.

Modify your : /etc/conf.d/net

Code:
config_eth0=( " netmask 255.255.255.255 brd " )
dns_domain_eth0=""
dns_servers_eth0="213.186.33.99"

postup() {
   if [[ ${IFACE} == "eth0" ]]; then
      route add  dev eth0
      route add default gw 
   fi
}

postdown() {
   if [[ ${IFACE} == "eth0" ]]; then
      route del  dev eth0
      route del default gw 
   fi
}
Note, I'm using eth0, you maybe using another NIC.

There's some discussion over what the _should_ be set to, the IP of the Virtual Machine or the GW for the Physical machine. Personally I find that the IP of the Virtual machine works best.

Having said that I'm about to do so speed tests, so I might give the other options a try and see if there are any improvements over one another.

This is still WIP, I'll update it with a more in depth config file that contains additional Failover IPs and additional LAN IPs, once I havedone some additional tests.