1

I have a network of VMs each one having a LAN IP address and a public IP address. They each have a 1:1 NAT map for public access via the public IP for HTTP, SSH, etc. I'm trying to figure out a way to restrict the LAN IPs from communicate to each other, but there are some cases where a group of LAN IPs will need to communicate.

I'm using pfSense as a firewall / router on a 192.168.0.0/24 configuration.
It seems like I could assign each VM it's own subnet and add a static route to the firewall for that VM to get back to the firewall for internet access and other firewall rules. Is that right?

I assigned 1 VM with:

address 192.168.1.2
netmask 255.255.255.254
gateway 192.168.1.1

Then added a static route on the FW's LAN interface using 192.168.1.0/30 as the destination network and 192.168.1.1 as the gateway.

Nothing appears to be working, so anyone has any ideas? Please be aware I'm not that familiar with subnets.

Thanks!

3
  • as per your example: which host has the ip 192.168.1.1 that you refer to as gateway?
    – lepole
    May 11, 2010 at 20:24
  • none, how can I point it at the main FW? static route? Can I just list the main FW as the gateway on the VM?
    – bwizzy
    May 11, 2010 at 22:52
  • Is it just a typo or do you really have your firewall on 192.168.0.0/24 and your VMs on 192.168.1.0/30? If this is the case there is no way for your firewall to route because your VMs are not on the same subnet to start...
    – Clint
    Mar 28, 2011 at 6:13

4 Answers 4

0

What OS are you running on the VMs? It might be easier to just use internal firewalls on the machines. That way you can pick and choose what addresses each VM responds to.

1
  • All the hosts run linux, and while an iptables solution would work, I'd like to have something that can be managed in 1 place rather than updating / managing iptables rules on 100s of hosts.
    – bwizzy
    May 11, 2010 at 22:54
0

Mask = 255.255.255.254???? Take a look at this

Network           Net Broadcast     CIDR Mask              UsableHosts 
192.168.1.0       192.168.1.3       30   255.255.255.252   2           
192.168.1.4       192.168.1.7       30   255.255.255.252   2           
192.168.1.8       192.168.1.11      30   255.255.255.252   2           
192.168.1.12      192.168.1.15      30   255.255.255.252   2           

The output if from my Subnet Planner

1
  • Sorry that was a typo, my subnet is 255.255.255.252 as shown in your first example.
    – bwizzy
    May 14, 2010 at 13:32
0

I don't understand why you do this step:

"Then added a static route on the FW's LAN interface using 192.168.1.0/30 as the destination network and 192.168.1.1 as the gateway."

Create one VLAN per virtual machine or customer. Assign a proper network, /30 or larger. First address is network, second would be the Firewalls IP on that subnet - and the other or the rest until the broadcast are to be used by the VMs.

That's it, all you need is adding rules either for the VLAN interfaces, or if you prefer for the IP's within the VLANs.

1
  • The static route you added is not needed, perhaps not even functional. If FW has address 192.168.1.1 for VLAN 123 - then the FW already know how to route it's other networks there. For every interface with an IP, there is a route.
    – 3molo
    Sep 18, 2010 at 8:34
0

Most firewall rules use masks which work the same as subnet masks, but can be used to target multiple subnets, or blocks of IP addresses within a subnet.

So leave your gateways alone, but group your VM IP addresses together within your subnet so you can write masks that specify those VMs. You can target a single IP address with the mask 255.255.255.255. You can use a CIDR Calculator to help you figure this out, or take a look at the IP allocation diagram in Gary A. Donohue's excellent Network Warrior book.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .