Saturday, 4 August 2018

Configuring Layer3,NAT,DHCP and Sub Interface and layer 2 configuration

Getting Started: Layer 3, NAT, and DHCP


by Community Manager  ‎10-21-2015 05:02 PM - edited ‎08-04-2017 01:07 AM(78,690 Views)

I've unpacked my firewall and did what you told me, now what?


In the previous installment, Getting StartedPreparing the Firewall, I've unpacked my firewall, now what?, we described the first steps after unpacking your firewall and getting it up and running. This week, we'll take a look at where to go from here and configure Layer 3 interfaces, set up proper routing, and enable NAT so the firewall can function as an internet gateway.


Before we get started, I'll outline a few things that may be different in your network that you'll want to note:

In the examples below, my ISP has assigned me the internet IP subnet of 198.51.100.0/28 which I want to start using on the untrust interface of the firewall instead of the router. To achieve this, NAT will need to be disabled and maybe some other things need to be changed to accomplish this. As the steps to accomplish this will vary, depending on several factors, you may need some assitance from your ISP to reconfigure your router. As it is not absolutely necessary to use a public IP range, you can simply keep using the IP range your ISP provided.

Please note these parameters for your network:
My router's IP will be: 198.51.100.1
My firewall's IP will be: 198.51.100.2
My firewall's internal IP will be: 10.0.0.1
My client's DHCP range will be: 10.0.0.50-10.0.0.250

network.png

1. Preparing the zones


To get started, we'll first reconfigure the zones we're currently using for our Virtual Wire so we can reuse the same zones. If you prefer to change the names, you can make new zones or simply rename the existing ones.

  1. Navigate to the Network tab.
  2. Open Zones from the left pane.
  3. Proceed to open the trust zone objects and change the Type to Layer3, then click OK. Repeat this for the untrust zone.
2015-10-21_10-57-07.png


2015-10-21_10-57-38.png
Don't worry if the interfaces box is empty after this changewe'll fix that in the next step.

2. Preparing the interfaces


  1. Navigate to the Network tab.
  2. Open Interfaces from the left pane. We'll see our 2 VWire interfaces that are already connected to the internet but are currently lacking zone configuration, due to the step above.
  3. Start by opening ethernet1/1, which will be our external, or untrust, interface. 
2015-10-21_11-06-38.png


On the Interface Type dropdown, change Virtual Wire to Layer3.

2015-10-21_11-09-23.png

Next, set the Virtual Router to default and the Security Zone to untrust.
2015-10-21_11-10-37.png

Next we'll add an IP address to the interface.
  1. Navigate to the IPv4 tab.
  2. Click Add.
  3. Enter the external IP address your ISP provided.
2015-10-21_11-12-55.png

Click OK and proceed to ethernet1/2. Set the Interface to Layer3, Virtual Router to default and Security Zone to trust.
2015-10-21_11-16-48.png

In the IPv4 tab, set the IP address of the interface to 10.0.0.1/24 and open the Advanced tab.
2015-10-21_11-16-48.png

In this tab, we're going to set a Management Profile which will allow us to ping the interface, which might come in handy if we ever need to troubleshoot internal network issues. In the Management Profile dropdown, click the Management Profile link:
2015-10-21_11-19-20.png

For now, we will only allow the ping service on the interface.
2015-10-21_11-23-43.png

Return to the interfaces page by clicking OK on the two configuration dialogs. The interfaces page should now look like this:
2015-10-21_11-29-47.png

3. Configuring routing


Next, we need to make sure the firewall will be able to reach the Internet, so it will need a default gateway.
  1. Navigate to the Network tab.
  2. Open Virtual Routers from the left pane.
  3. Open the default VR (virtual router).

2015-10-21_11-33-10.png


This will bring up the configuration for the Virtual Router we will be using for our new Layer 3 interfaces. It is called a virtual router because the firewall does not employ one single routing instance, but can have several, all bound to different interfaces. This allows for routing instances to be very different from each other, and makes network segregation at the routing level possible. For now, we'll stick to the one we have:

2015-10-21_11-34-53.png

Add a static route.
  1. Open Static Routes from the left pane.
  2. Click Add to start a new route.

2015-10-21_11-41-24.png

We'll set the destination to 0.0.0.0/0, which encompasses all IP subnets that are not connected to the firewall and the egress interface to ethernet1/1 as this is the outside interface connected to the internet router. Lastly we'll set the router's IP address as the next hop.

2015-10-21_11-42-25.png

4. Configuring DHCP


Our next step will be to enable a DHCP server on the trust interface so any users connecting to the network without a statically configured IP address can get connected.

  1. Navigate to the Network tab.
  2. Open DHCP from the left pane.
  3. Click Add to start a new DHCP server configuration.

2015-10-21_11-52-50.png

We'll set the interface to ethernet1/2 as this is the inside interface. To prevent duplicate IP addresses in the network in case someone has set a static IP address configuration o their workstation, we can enable Ping IP when allocating new IP.  This option sends a ping to an IP address ready to be assigned a host. In case the ping receives a reply, the DHCP server chooses a different IP to assign and repeats the step. We'll set the Lease to 1 day and the IP Pools to '10.0.0.50-10.0.0.250' to provide users with 201 IP addresses.

2015-10-21_12-00-58.png

In the Options tab, we can configure which default gateway and DNS servers the clients receive when requesting a DHCP address. We need to set the Gateway as 10.0.0.1 as this its the firewall's internal IP address. I've set the DNS servers as Google's 4.2.2.2 and 8.8.8.8 but you can set your own ISP's DNS servers:
2015-10-21_12-02-23.png
Click OK to complete this bit and let's move to the last part where we configure NAT.

5. Configuring NAT


The last part of this setup is to configure Network Address Translation. This will make sure all internal hosts go out to the internet using the firewall's external IP address as source. This is required as the private network IP ranges 10.0.0.0/8 , 172.16.0.0/12 and 192.168.0.0/16 are not routed on the internet and can only be used on a private network behind a NAT enabled gateway.

  1. Navigate to the Policies tab.
  2. Open NAT from the left pane.
  3. Click Add to create a new NAT policy.
2015-10-21_13-20-03.png
 We'll give the NAT rule an easy-to-identify name:
2015-10-21_13-21-33.png

Next we'll go to the Original Packet tab, where we'll set the source and destination zones and the destination interface.
  1. Click Add to insert a new source zone.
  2. Select the trust zone from the dropdown.
  3. In the destination zone, choose untrust in the dropdown.
  4. For the destination interface, set ethernet1/1, as this is the outside interface.
  5. Leave everything else as is and move on to the Translated Packet tab.

2015-10-21_13-24-41.png

Lastly, from the Translated Packet tab, we will configure the Source Address Translation. Set the Translation Type to Dynamic IP And Port to ensure multiple internal clients can make simultaneous outbound connections hidden behind one IP address.

About the other options
  • Dynamic IP comes in handy to hide a group of IP addresses behind another group of IP addresses of equal size. This can happen if a connection is set up with a secondary network where IP addresses may overlap, or where routing to the LAN subnet is not possible.
  • Static IP is usually set if a single host will have exclusive use of a NAT IP address.
2015-10-21_13-26-46.png

As Address Type we'll choose to use the Interface Address
2015-10-21_13-34-34.png
and select ethernet1/1
2015-10-21_13-35-51.png
and select its configured IP address.
2015-10-21_13-36-23.png
Click OK to complete the NAT configuration.

6. Cleanup and commit


One last step before we go ahead and commit this configuration is to remove the previously used Virtual Wire object.
Navigate to the Network tab and open Virtual Wires from the left pane. Once there, highlight the default-VWire and click Delete.
2015-10-21_13-44-35.png

When the default-VWire is deleted, go ahead and commit the configuration.
2015-10-21_13-46-50.png
2015-10-21_13-41-01.png
2015-10-21_13-49-53.png
2015-10-21_13-51-03.png

7. Refresh client IP and ARP


We have now succesfully switched the firewall from virtual wire to Layer 3 deployment. One caveat to consider is that now the interfaces are no longer acting as a bump-in-the-wire—they have their own MAC address and some clients. Potentially, the router may need to have its ARP cache refreshed before the interfaces can succesfully communicate with the firewall.

On a windows host, this can be accomplished by starting a command prompt as administrator
2015-10-21_13-55-19.png

and executing 'arp -d' to clear the ARP cache and 'ipconfig /renew' to obtain a DHCP lease from the new DHCP server.

C:\>arp -d

C:\>ipconfig /renew

Windows IP Configuration

Ethernet adapter lablan:

        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 10.0.0.50
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.0.0.1

I hope you enjoyed this article. Please feel free to leave any comments below!

Regards,
Tom Piens
______________________________________________________________________________________________________________________

Getting Started: Layer 3 Subinterfaces



(46,011 Views)

I've unpacked my firewall and want to configure VLANs — subinterfaces


Now that your new Palo Alto Networks firewall is up and running, let's look at adding VLAN tags to the mix by creating Layer 3 subinterfaces. Our initial installments in the Get Started series described the first steps after unpacking your firewall and getting it updated and configured in VWire or Layer 3 mode. Check out I've unpacked my firewall, now what? and I've unpacked my firewall and did what you told me, now what? 

There may be several network segments in your organization to segregate user workstations from public webservers. A good way to prevent these networks from communicating with each other is by implementing VLANs on the core switch, preventing hosts located in one VLAN from communicating with hosts in another, without some form of bridge or gateway to connect both virtual networks.

The first configuration we'll look at builds on where we left off in the previous getting started guide. The firewall has Layer 3 interfaces and we're now going to change the trust interface so it can communicate with a trunked switch interface.

The difference between a regular, or access, switchport configuration and a trunked switchport, is that the access port will not tamper with the Ethernet header with any packets, whereas a trunk port will attach a VLAN tag in the form of a IEEE 802.1Q header to packets. This ensures that packets retain VLAN information outside the switch and should be treated as different LAN networks by the next host receiving these packets.

interface GigabitEthernet1/36
 switchport
 switchport access vlan 100
 switchport mode access
 switchport nonegotiate
 spanning-tree portfast

...reconfigure...

interface GigabitEthernet1/36
 switchport
 switchport trunk allowed vlan 100,200
 switchport mode trunk
 switchport nonegotiate
 spanning-tree portfast
We'll be switching our configuration from a regular interface to tagged subinterfaces.

1. Creating subinterfaces


The first step is to remove the IP configuration from the physical firewall.
  1. Navigate to the Network tab.
  2. Go to Interfaces on the left pane.
  3. Open the interface configuration.
  4. Navigate to the IPv4 tab.
  5. Select the subnet.
  6. Click Delete.
2015-10-28_09-06-19.png

We can now go ahead and add a subinterface.
2015-10-28_09-16-05.png

In the subinterface configuration, we need to assign an interface number and a tag. The tag needs to match the VLAN exactly, but the interface number may be different. For ease of management, it's best to set it the same id as the VLAN tag. Add the interfaceto the 'default' Virtual Router and assign it to the 'trust' Security Zone.

2015-10-28_09-18-56.png

Next, navigate to the IPv4 tab and add the IP to the interface.
2015-10-28_09-31-07.png

Then navigate to the Advanced tab and set the Management Profile to 'ping.'
2015-10-28_09-31-45.png

Next, we've added a webserver to the network and placed it in VLAN 200 on the switch.

2015-10-28_09-43-07.png
So we'll need to add a second subinterface and set it to VLAN tag 200. We'll also create a new Security Zone so we can apply different security policy to it.
2015-10-28_09-48-12.png

We'll call the new zone 'dmz'
2015-10-28_09-50-15.png

and assign the interface a different IP subnet
2015-10-28_09-51-12.png

and we'll also set the Management Profile to 'ping.'
2015-10-28_09-53-18.png

Your interface configuration should now look similar to this:
2015-10-28_09-53-53.png

2. Reconfigure DHCP


We will now need to move the DHCP server we created last time to the new subinterface.
  1. Navigate to the Network tab.
  2. Open DHCP menu from the left pane.
  3. Open the DHCP configuration for interface ethernet1/2.
  4. Change the Interface to ethernet1/2.100 to match the new subinterface.
2015-10-28_10-48-03.png

 

3. Create a new NAT policy


The next step is to create a NAT policy to allow hosts on the internet to reach the webserver via the external IP address of the firewall.
  1. Navigate to the Policies tab.
  2. Open NAT configuration from the left pane.
  3. Click Add to create a new NAT policy.

2015-10-28_11-03-18.png

In the Original Packet tab, we set the source and destination zones to untrust, and the destination address to the external IP address of the firewall. The destination zone is untrust because the firewall will try to determine the destination zone of a received packet based on its routing table. In this case, the original destination IP address, before NAT is applied, belongs to the untrust zone.
2015-10-28_11-05-57.png

In the Translated Packet tab, we add the physical IP addres of the webserver.
2015-10-28_11-07-09.png

4. Add security policy


The last step is to create security policies to allow the trust and untrust zone to access the webserver.
  1. Navigate to Policies.
  2. Open the Security policies from the left pane.
  3. Click Add to create a new rule and name it access_to_webserver.
2015-10-28_10-16-09.png
For now, we'll set the source zone to 'untrust.'
2015-10-28_10-29-58.png

We'll set the destination to 'dmz' and the destination address to the external IP of the firewall.
2015-10-28_11-07-45.png

We'll enable application web-browsing.
2015-10-28_10-17-49.png

Enable several security profiles to make sure the webserver is protected from attacks.
2015-10-28_10-18-25.png

Repeat this step for a security policy from the trust zone, so additional applications can be added.
2015-10-28_10-31-46.png

In the destination, we'll set Security Zone 'dmz' and the internal IP address of the webserver.
2015-10-28_11-00-29.png

Add additional applications for management.
2015-10-28_10-32-55.png

Your security policy should now look similar to this:
2015-10-28_11-12-49.png

After you commit this new configuration, interface ethernet1/2 will accept 'tagged' packets for VLAN 100 and 200 and the webserver will become available to the outside world.

Thank you for readingplease leave any comments in the comment section below.

Regards,
Tom


___________________________________________________________________________________________________________________

    Did you know you can see the translated content as per your choice?

Getting Started: Layer 2 Interfaces

by Community Manager  on ‎11-16-2015 07:02 AM - edited on ‎11-20-2015 11:07 AM by (51,263 Views)

What more can my firewall do? Layer 2 interfaces


In the previous installments of Getting Started, we covered how to set up the firewall from scratch. In this next series, we'll be covering more advanced configuration features that will help you fine tune your firewall to better suit your environment. This week, we'll take a look at Layer 2 interfaces and how the firewall can be set up to provide bridging between VLANs while enforcing security policies and providing threat prevention to keep your network secure.

We already covered VLAN tags as Layer 3 subinterfaces in Getting Started — Layer 3 Subinterfaces, but PAN-OS also enables you to create true Layer 2 interfaces that act the same way a switch would.

We'll start with a simple example where we have two Layer 2 interfaces in the same zone and the same VLAN. This scenario could be practical if, for example, you have both servers and clients on the same IP subnet and want to allow sessions to be formed, but need to control which applications are used, and/or need to provide threat prevention without changing the IP subnet.

On the switch, you could set each set of machines into a separate VLAN, for example, servers in VLAN 20 and clients in VLAN 30, and have the firewall serve as a bridge between these VLANS:

  1. First, you'll need to create a VLAN interface to be used by the physical interfaces we will set to Layer 2. Navigate to the Network tab, open Interfaces from the left pane and open the VLAN tab. There will already be one default VLAN interface present, which you can reuse if you like, but we'll create a new one by clicking the Add button. vlan interface 
    You'll assign the interface an ID, add any relevant comment and assign the interface to the default Virtual Router and add it to the Trust zone. Note that the ID is simply an identification number for the interface and does not influence any 802.1Q tagging.

    vlan interface 

    If you then try to assign a VLAN to the interface, you'll notice there aren't any available yet, so go ahead and click the new VLAN link to start creating a new VLAN object.

    vlan interface

    Simply give it a name and click OK for now.
    vlan interfacevlan interface
    The VLAN interface should look somewhat like this. Go ahead and click OK.
  2. From here, we're going to set interfaces ethernet1/2 Layer2 and set the proper VLAN configuration. Navigate to the Ethernet tab and open interface ethernet1/2's properties, then change the Interface Type to Layer2.ethernet layer2 


    After setting the interface to Layer2, set the VLAN to the newly created VLAN object, but notice that the security zone does not show any option. This is because we have not yet created any Layer 2 Security Zones. 

    ethernet interface 

    Any Security Zone configured on the firewall is also attached to a specific network type, like Layer 3, VWire, or Layer 2. In the VLAN configuration in Step 1, we added the VLAN.100 interface to the default router and Layer 3 Trust Security Zone. This is to allow traffic to pass from Layer 2 to Layer 3. We'll take a look at that after we've completed this phase of the Layer 2 introduction. 

    Click the new Zone link to create a new zone named L2-Trust:

    Layer 2 Security Zone
  3. Repeat the above step for interface ethernet1/3.

    interfaces
  4. The last stage is to create an intrazone security policy to allow more granular control over applications connecting both segments and applying security profiles to these sessions. Open the Policies tab and navigate to Security on the left pane. Click Add to create a new security policy. From the Rule Type dropdown, select 'intrazone' as the Type. 

    intrazone security policy
    Next, navigate to the Source tab, click Add, and set the source zone to L2-Trust.
    intrazone security policy 
    Because this is an intrazone Security Policy, the destination zone selection has been made inaccessible and is dependent on the source configuration.
    intrazone security policy 
    Set the applications to what is appropriate between the segments. These are solely the applications you want to allow between the internal hosts. This does not apply to any connections going to or coming from other networks.

    intrazone security policy 

    Lastly, set security profiles so any sessions between your internal hosts are also inspected for vulnerabilities, exploits, viruses, and so on.

    intrazone security policy

    Your security policy should now look similar to this:intrazone security policy

    Rule1, as seen above, will be used in the next segment, Layer2 Routing.

This configuration will ensure your hosts all remain on the same IP subnet, but can be segregated depending on their role.
layer2 diagram

More interfaces can be added to provide even more segments or tagged subinterfaces can be added in a similar fashion as described in Getting Started: Layer 3 — Subinterfaces.

layer2 subinterfaces

Layer 2 Routing


As the next step, you may want to enable internet access for the hosts in your network, so you will need to enable some Layer 3 functionality in the Layer2  config. You may have noticed some Layer 3-looking configuration in the VLAN configuration earlier, and this is where we will need to enable the functionality.

  1. Navigate back to the Network tab.
  2. Access Interfaces on the left pane.
  3. Open the VLAN tab.
  4. Edit the vlan.100 object.
  5. Navigate to the IPv4 tab.
  6. Click Add.
  7. Enter the IP address the hosts on your network will use as the default gateway, with its subnet mask.

vlan layer3
The VLAN interface now functions as a Layer 3 interface towards the outside world. Any sessions originating from your internal hosts to the outside world will be handled by the firewall as coming from the Layer 3 Trust zone going to the Layer 3 Untrust zone.

layer2 layer3 diagram

Please be aware you may need some additional configuration to allow for outbound connections, including the default route in your virtual router, NAT configuration so the internal IP subnet is translated to the public IP address of the firewall and maybe a DHCP server to automatically assign IP addresses to workstations joining your network. Please take a look at Getting Started — Layer 3, NAT, and DHCP where we cover these configuration steps in more detail.

The NAT policy required to reach the internet:
nat policy

The Virtual Router configuration:
virtual router


I hope you enjoyed this article and found it useful. Feel free to post any remarks or questions in the comment section below.


Regards,

No comments:

Post a Comment