# Revision history [back]

I couldn't find any way to achieve the above by means of neutron meter-label-rule which is a shame. If you find anything, please do contribute so others can benefit...

So I had to resort to configuring the guest to egress the traffic I need excluding via a separate source IP (here the intention is to use 192.168.1.5 but read below on IP assignment) so this traffic doesn't get metered. Here's how I did it:

$neutron port-list # figure out the right port then add an IP address (on the same subnet) as follows:$ neutron port-update --fixed-ip subnet_id=<subnet_id>,ip_address=192.168.1.4\

Now this gets a little tricky: the port has both IPs (check with neutron port-show <port_id>) but I haven't found a way to control how they get assigned to the VM (seems a "collaboration" between cloud-init and DHCP). In any case, what happened here is that the instance's eth0 got its IP address swapped pretty much instantly to the one I wanted to use for the separate traffic. It's a bit annoying because I had to reconfigure things (including the above metering-label-rule) but at least the behaviour appears deterministic, even after a number of reboots.
$cat << EOF | sudo tee /etc/network/interfaces.d/eth0:1.cfg auto eth0:1 iface eth0:1 inet static address 192.168.1.4/24 up ip route add 10.10.0.123 via 192.168.1.1 dev eth0:1 src 192.168.1.4 EOF$ sudo ifup eth0:1

Check with ip route list that the routing is as intended. A final check that the metering is working as expected is also highly recommended (if things don't behave, tcpdump is your friend, as ever...). Finally reboot the box a couple of times to ensure the IP assignment works across.