> For the complete documentation index, see [llms.txt](https://1nuxg33k.gitbook.io/1nuxg33k-sec/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://1nuxg33k.gitbook.io/1nuxg33k-sec/virtualbox-and-opnsense-setup/installing-opnsense/vlan-setup/configuring-opnsense/firewall-rules.md).

# Firewall Rules

Here I show how to configure OPNsense Firewall rules.

We need firewall rules so that only the kali vm can talk to whatever vulnerable machines we are pentesting and so that the vulnerable machines don't have access to the internet or your host OS.

We will first configure CyberRange.

Click Firewall > Rules > CyberRange then the red Plus (+)  to the right to add a rule.

<figure><img src="https://2271353664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc4yoWnnXV8DO0WadPB%2Fuploads%2Fe6K87Vt3J7psW8xjmjiE%2F330-37.png?alt=media&amp;token=a5ee75ba-fdd2-4abf-b3b5-5deb283e9627" alt=""><figcaption></figcaption></figure>

First Rule:

Action: Block

Interface: CyberRange

TCP/IP Version: IPv4+IPv6

Destination: WAN net

Description: Block access to any on same network as host OS

Click save.

<figure><img src="https://2271353664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc4yoWnnXV8DO0WadPB%2Fuploads%2F0pCuUDIDIi3J62R2K7v6%2F1.png?alt=media&amp;token=c7fad19f-ccd9-44b0-801e-4da731e4f743" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2271353664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc4yoWnnXV8DO0WadPB%2Fuploads%2FyT5dHCUsucbhcwZ2SKRp%2F330-38.png?alt=media&amp;token=84648add-a948-42e8-a6b3-e3854cf4b3b7" alt=""><figcaption><p>Should look like this.</p></figcaption></figure>

## Cyber Range Isolated Rules

Action: Pass

Interface CyberRangeIsolated

TCP/IP Version: IPv4

Destination: Single host or Network = 10.0.0.2/32

Description: Allow packets to kali vm

Click save and add another rule.

<figure><img src="https://2271353664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc4yoWnnXV8DO0WadPB%2Fuploads%2FiAjTyfNc64YtY7vcWGpy%2F330-40.png?alt=media&amp;token=5063f56d-ea6a-457f-ad1a-efb990c04ec4" alt=""><figcaption><p>Set to 32 for single host</p></figcaption></figure>

Second Isolated Rule:

TCP/IP Version: IPv4+IPv6

Protocol: TCP/UDP

Source: CyberRangeIsolated net

Destination: CyberRangeIsolated address

Destination Port range: DNS (53)

Description: Allow local DNS lookups.

Click save and add one more rule.

Last Rule for Cyber Range Isolated:

Action: Block

TCP/IP Version: IPv4+IPv6

Source: CyberRangeIsolated net

Description: Block access to everything.

<figure><img src="https://2271353664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc4yoWnnXV8DO0WadPB%2Fuploads%2FCkLLxD2dADrpYHwFlrvm%2F330-41.png?alt=media&amp;token=86d0dc5a-babc-4e67-b441-9cb7fff830ca" alt=""><figcaption><p>Yours should look similar</p></figcaption></figure>

## AD-LAB Rules

Action: Block

Interface: AD\_LAB

TCP/IP Versio&#x6E;**:** IPv4 + IPv6

Destination:Isolated net

Description: Block packets to Isolated network

Click Save

Add another rule:

Action: Block

TCP/IP Version: IPv4+IPv6

Destination: WAN net

Description: Block packets to host network.

Click save

Add one final rule:

Action: Pass

TCP/IP Version: IPv4+IPv6

Description: Allow access to all other subnets and internet

Click Save and Apply changes.

<figure><img src="https://2271353664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc4yoWnnXV8DO0WadPB%2Fuploads%2F2nPUGFPcJvxHdlbPLDMw%2F330-42.png?alt=media&amp;token=cf4cfadc-6624-4d7e-b79e-95cc3949bc12" alt=""><figcaption><p>Yours should look similar</p></figcaption></figure>
