{"id":301,"date":"2013-02-12T08:10:29","date_gmt":"2013-02-12T08:10:29","guid":{"rendered":"https:\/\/shan.info\/new\/setup-a-pfsense-20-firewall-when-default-gateway-is-on-a-different-subnet\/"},"modified":"2013-02-12T08:10:29","modified_gmt":"2013-02-12T08:10:29","slug":"setup-a-pfsense-20-firewall-when-default-gateway-is-on-a-different-subnet","status":"publish","type":"post","link":"https:\/\/shan.info\/new\/setup-a-pfsense-20-firewall-when-default-gateway-is-on-a-different-subnet\/","title":{"rendered":"Setup a pfSense 2.0 firewall when default gateway is on a different subnet"},"content":{"rendered":"<p>\n\thttp:\/\/blog.magiksys.net\/pfsense-firewall-default-gateway-different-subnet<\/p>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t&nbsp;<\/p>\n<p style=\"margin: 0px 0px 1.2em; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px; color: green;\">\n\t<b>I have written a better article, using the firewall in transparent mode&nbsp;<a href=\"http:\/\/magiksys.blogspot.be\/2012\/12\/pfsense-bridge-gateway-vmware-ovh-ip.html\" style=\"color: rgb(0, 113, 179);\">here&nbsp;<\/a>.<\/b><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThis article has been updated for&nbsp;<a href=\"http:\/\/www.pfsense.org\/\" style=\"color: rgb(0, 113, 179);\">pfSense<\/a>&nbsp;2.0. The original article about pfSense 1.2.X has moved&nbsp;<a href=\"http:\/\/blog.magiksys.net\/pfsense-firewall-1.2-default-gateway-different-subnet\" style=\"color: rgb(0, 113, 179);\">here<\/a>.<\/p>\n<p style=\"margin: 0px 0px 1.2em; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px; color: red;\">\n\tNews: It looks like the OVH gateway works like an universal ARP proxy or Captive portal. I means my OVH gateway replies to any ARP request. This means that for any given a.b.c.d\/32 failover IP, I can setup a host or virtual host using a mask \/24 (instead of \/32) and my gateway a.b.c.X where X can be anything not in ( 0, 255 or d ) and it will works. And It works, at least on the Kimsufi I have tested it. And it works even for IPs in a.b.c.0\/24. I think this is how OVH setup some (maybe all) of their routers to be able to support migration of failover IP or block without too much headache. What is fun is to<em>traceroute<\/em>&nbsp;some IPs in a.b.c.* and see how they are not directly attached to the WAN but are behind some routers.<br \/>\n\tOVH don&#8217;t say anything about this setup and then this&nbsp;<em>feature<\/em>&nbsp;is funny but cannot be used on a production server.<br \/>\n\tBe careful if you use a wrong setup and generate a lot of unexpected ARP requests, OVH can warn you to quickly fix the problem or even disable your network link.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tIf you buy a VMware server and an IP block from&nbsp;<a href=\"http:\/\/www.ovh.fr\/\" style=\"color: rgb(0, 113, 179);\">OVH<\/a>&nbsp;you will be surprised because the default gateway don&#8217;t match the IP block. Even if this setup is unusual, it is valid and give full satisfaction if you know how to configure your firewall and hosts.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThere are some advantages to use this technique for the provider\/WEB hoster: this make the router configuration a lot simpler (no need to setup an IP address for each underlying IP block, they can merge routes for adjacent IP blocks together) and the most important, this save one IP address in the block.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<strong>Windows<\/strong>&nbsp;host accepts this unusual configuration and just work, thanks Bill for this great job&nbsp;.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"pf-shellcmd\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-ovh-gw-windows.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<strong>Linux<\/strong>&nbsp;host requires a little trick.<\/p>\n<pre style=\"padding: 15px; font-size: 0.77em; font-family: Menlo, Consolas, 'Andale Mono', 'Lucida Console', 'Nimbus Mono L', 'DejaVu Sans Mono', monospace, 'Courier New'; background-color: rgba(40, 40, 0, 0.0588235); margin-top: 10px; margin-bottom: 10px; overflow: hidden; white-space: pre-wrap; color: rgb(59, 59, 59);\">[root@fc6-pmx ~]# route add default gw 192.168.23.254\r\n<strong>SIOCADDRT: Network is unreachable<\/strong>\r\n<\/pre>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tLinux refuses to add the route because it don&#8217;t know how to reach the gateway itself. Add the appropriate route for the gateway, before the default route, solves the problem.<\/p>\n<pre style=\"padding: 15px; font-size: 0.77em; font-family: Menlo, Consolas, 'Andale Mono', 'Lucida Console', 'Nimbus Mono L', 'DejaVu Sans Mono', monospace, 'Courier New'; background-color: rgba(40, 40, 0, 0.0588235); margin-top: 10px; margin-bottom: 10px; overflow: hidden; white-space: pre-wrap; color: rgb(59, 59, 59);\">[root@fc6-pmx ~]# route add -host 192.168.23.254 dev eth0\r\n[root@fc6-pmx ~]# route add default gw 192.168.23.254\r\n<\/pre>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThis works !<\/p>\n<pre style=\"padding: 15px; font-size: 0.77em; font-family: Menlo, Consolas, 'Andale Mono', 'Lucida Console', 'Nimbus Mono L', 'DejaVu Sans Mono', monospace, 'Courier New'; background-color: rgba(40, 40, 0, 0.0588235); margin-top: 10px; margin-bottom: 10px; overflow: hidden; white-space: pre-wrap; color: rgb(59, 59, 59);\">[root@fc6-pmx ~]# route -n\r\nKernel IP routing table\r\nDestination     Gateway         Genmask         Flags Metric Ref    Use Iface\r\n192.168.23.254  0.0.0.0         255.255.255.255 UH    0      0        0 eth0\r\n10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0\r\n0.0.0.0         192.168.23.254  0.0.0.0         UG    0      0        0 eth0\r\n<\/pre>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tTo configure a&nbsp;<strong>firewall<\/strong>, depending of the firewall, you will have to be imaginative !<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tDifferences with the 1.2.X config<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThe main ideas are the same as in the previous&nbsp;<a href=\"http:\/\/blog.magiksys.net\/pfsense-firewall-1.2-default-gateway-different-subnet\" style=\"color: rgb(0, 113, 179);\">article<\/a>&nbsp;, but the trick used to connect the gateway is different and finally&nbsp;<strong>a lot simpler<\/strong>. I recommend this setup !<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tSchema<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tHere is the schema I used to test this configuration.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Network schema\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-ovh-gw-network-schema.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tAll IPs are from the&nbsp;<a href=\"http:\/\/www.faqs.org\/rfcs\/rfc1918.html\" style=\"color: rgb(0, 113, 179);\">Address Allocation for Private Internets<\/a>&nbsp;but it is for testing ! Use the addresses you get from your provider or WEB hoster. For real, only the&nbsp;<em>172.22.22.1<\/em>&nbsp;and&nbsp;<em>19.168.1.0\/24<\/em>&nbsp;can be in a private network.<\/p>\n<ul style=\"margin: 1em 0px; padding: 0px 0px 0.25em 2.5em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n<li>\n\t\t<em>192.168.23.254<\/em>&nbsp;is the default&nbsp;<strong>gateway<\/strong>&nbsp;given by my provider.<\/li>\n<li>\n\t\t<em>10.0.0.0\/24<\/em>&nbsp;is the&nbsp;<strong>IP block given<\/strong>&nbsp;by my provider. I assign it to my DMZ.<\/li>\n<li>\n\t\t<em>192.168.1.0\/24<\/em>&nbsp;is a for a&nbsp;<strong>virtual LAN<\/strong>, to put machines that help to configure and manage the FW and servers in the DMZ.<\/li>\n<\/ul>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe gateway trick<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tInstead of creating an&nbsp;<strong>ARP<\/strong>&nbsp;entry using a command line at startup, I&nbsp;<em>force<\/em>&nbsp;a route to the gateway by using the&nbsp;<strong>route<\/strong>&nbsp;command twice. The trick is the identical to the one used for the Linux in the previous<a href=\"http:\/\/blog.magiksys.net\/pfsense-firewall-default-gateway-different-subnet\" style=\"color: rgb(0, 113, 179);\">article<\/a>. It is not possible to create such&nbsp;<em>routes<\/em>&nbsp;using the Web interface then once more the&nbsp;<strong>shellcmd<\/strong>module come to rescue to setup the route at startup.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tTo create a route up to&nbsp;<em>192.168.23.254<\/em>, on an interface having no IP in this range, I use the commands:<\/p>\n<pre style=\"padding: 15px; font-size: 0.77em; font-family: Menlo, Consolas, 'Andale Mono', 'Lucida Console', 'Nimbus Mono L', 'DejaVu Sans Mono', monospace, 'Courier New'; background-color: rgba(40, 40, 0, 0.0588235); margin-top: 10px; margin-bottom: 10px; overflow: hidden; white-space: pre-wrap; color: rgb(59, 59, 59);\">route add -net 192.168.23.254\/32 -iface em0\r\nroute add default 192.168.23.254  \r\n<\/pre>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThe first line tell the firewall that IP address&nbsp;<em>192.168.23.254<\/em>&nbsp;is on the side of the&nbsp;<em>em0<\/em>&nbsp;interface&nbsp;<em>(em0 is my&nbsp;<strong>WAN<\/strong>&nbsp;interface)<\/em>, the second one use this address as the default gateway.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThis time, their is no need to found the MAC address of the gateway like in the first&nbsp;<a href=\"http:\/\/blog.magiksys.net\/pfsense-firewall-default-gateway-different-subnet\" style=\"color: rgb(0, 113, 179);\">article<\/a>. But some operations like: disable the&nbsp;<em>em0<\/em>&nbsp;interface or setup a&nbsp;<strong>default<\/strong>&nbsp;gateway; can break the trick and would require to reload the route manually or reboot the firewall.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tTo&nbsp;<span style=\"color: red;\">remove<\/span>&nbsp;the route you can use:<\/p>\n<pre style=\"padding: 15px; font-size: 0.77em; font-family: Menlo, Consolas, 'Andale Mono', 'Lucida Console', 'Nimbus Mono L', 'DejaVu Sans Mono', monospace, 'Courier New'; background-color: rgba(40, 40, 0, 0.0588235); margin-top: 10px; margin-bottom: 10px; overflow: hidden; white-space: pre-wrap; color: red;\">route del default 192.168.23.254  \r\nroute del -net 192.168.23.254\/32 -iface em0\r\n<\/pre>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tYou can create the default route as soon has you have access to the firewall, using ssh, the console or by using the&nbsp;<em>Command prompt<\/em>&nbsp;in the&nbsp;<em>Diagnostics<\/em>&nbsp;menu of the Web interface. To be sure the routes are there, click the&nbsp;<em>Routes<\/em>&nbsp;option in the&nbsp;<em>Diagnostic<\/em>&nbsp;menu. An look for the two routes.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Routes\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-route.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<span style=\"color: red;\"><strong>Be careful<\/strong><\/span>&nbsp;You have to remove any&nbsp;<strong>default<\/strong>&nbsp;route before to run these two commands !<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThis will not give you access to the Internet forthwith, you need some more settings.<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe WAN interface<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tI don&#8217;t want to waste an IP address, I choose a completely unrelated address&nbsp;<em>172.22.22.1<\/em>, and don&#8217;t setup any gateway because the job is already done by the 2 commands above.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"WAN config\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-wan.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe DMZ interface (OPT1)<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThis is where the servers having a public address live. I give the&nbsp;<em>10.0.0.1<\/em>&nbsp;address to the firewall, this will be the default gateway for servers in the DMZ but also the public IP of the firewall on the WAN side.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"DMZ config\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-dmz.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe LAN interface<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThe LAN can be used if you need additional hosts that don&#8217;t need to be reachable from the Internet but are required to manage the DMZ or for any other purpose. These hosts can access the DMZ (and vice versa when required). This is where I put a virtual machine to configure this firewall. Machines in this zone can be accessed from the Internet too, see later.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"LAN config\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-lan.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tI keep the default settings of the firewall for this interface.<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tSetup the Proxy ARP<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThe&nbsp;<em>10.0.0.0\/24<\/em>&nbsp;subnet is on the DMZ side. To allow the firewall to reply to ARP requests for these addresses on the WAN interfaces, we have to add a&nbsp;<em>proxy ARP<\/em>&nbsp;entry.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Proxy ARP\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-proxy-arp.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tI do it for the full subnet at once, in previous&nbsp;<a href=\"http:\/\/blog.magiksys.net\/pfsense-firewall-default-gateway-different-subnet\" style=\"color: rgb(0, 113, 179);\">article<\/a>&nbsp;I did it address by address. This is faster but also bypass a&nbsp;<em>bug<\/em>&nbsp;or a&nbsp;<em>feature<\/em>&nbsp;in 2.0 that forbid the use of an address already used by an interface. I&#8217;m thinking here about DMZ address&nbsp;<em>10.0.0.1<\/em>. It is possible to go around this by creating the&nbsp;<em>Proxy ARP<\/em>before to assign the address to the DMZ interface. But using a subnet here bypass the problem !<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tMasquerade the source address<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tFor now, packets leaving the firewall have address&nbsp;<em>172.22.22.1<\/em>, replies will never come back ! We need to rewrite the source address for packet leaving the firewall. I use&nbsp;<strong>hide NAT<\/strong>&nbsp;to give them the&nbsp;<em>10.0.0.1<\/em>address. I assign this address for packet coming from the firewall, but also to&nbsp;<em>masquerade<\/em>&nbsp;the LAN zone.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Outbound NAT 1\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-outbound-nat-1.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tHere are the detail for the LAN, the config for the firewall is similar.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Outbound NAT 2\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-outbound-nat-2.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tNow any packets from the firewall or hosts from the LAN will leave the firewall with address&nbsp;<em>10.0.0.1<\/em><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tDouble check the rules for the LAN, and be sure the&nbsp;<em>&#8220;Default allow LAN to any rule&#8221;<\/em>&nbsp;permit outgoing connections :<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Rules LAN\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-rules-lan.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tDon&#8217;t hesitate to be more strict, for example my second rule block port 25 to the Internet, but not to the DMZ. Here I allow all protocols except some, but the good way when configuring a firewall is to block all traffic by default and permit only some protocols.<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe gateway: trick part 2<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tNow the firewall and the LAN have Internet access, at least after you have setup your&nbsp;<strong>DNS<\/strong>. You can now hardcode the gateway trick. You need to install the&nbsp;<em>shellcmd<\/em>&nbsp;package. The version 0.5 is for pfSense 1.0 but works well with 2.0 too. Install it from the package manager in the&nbsp;<em>System<\/em>&nbsp;menu!<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Package Manager\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-package-manager.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tAnd in the&nbsp;<em>Service<\/em>&nbsp;menu, select the&nbsp;<em>Shellcmd<\/em>&nbsp;option and setup the two commands :<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Shellcmd\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-shellcmd.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe DMZ zone (OPT1)<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tTo use your DMZ you have to add filter rules to allow packets to leave the DMZ to the WAN side. Here for&nbsp;<strong>outgoing<\/strong>&nbsp;packets&#8230;<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"DMZ outgoing rule\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-rules-dmz-outgoing.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tHere I block packets to the LAN, because the&nbsp;<strong>DMZ is no more than a part of the Internet itself<\/strong>, any access to the LAN from the DMZ or the Internet must be carefully thought through.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t.. and here&nbsp;<strong>incoming<\/strong>&nbsp;packets to my public WEB server&nbsp;<em>10.0.0.2<\/em>&nbsp;(the first rule)!<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"WAN Incoming rule\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-rules-wan-incoming.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tCreate other rules for your other servers and services inside your DMZ !<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tBecause we are using&nbsp;<strong>routing<\/strong>&nbsp;we don&#8217;t need any NAT rules between WAN and DMZ !<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tLAN has already a full access to the DMZ because of the rule&nbsp;<em>&#8220;Default allow LAN to any rule&#8221;<\/em>&nbsp;seen previously. !<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe LAN zone<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tIf you need to access some resources inside your LAN from Internet, you can NAT some ports from address&nbsp;<em>10.0.0.1<\/em>. Here I forward RDP to my&nbsp;<em>192.168.1.100<\/em>&nbsp;Windows host :<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"LAN NAT\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-lan-nat.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tDouble check, pfSense has created the appropriate filter rules.<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"WAN incoming rules\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-rules-wan-incoming.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThat&#8217;it !<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tThe final touch<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tTheir is lot of other thing to say and to do, but this is not a tutorial about firewall. Anyway I was very impatient to try the new&nbsp;<em>Floating<\/em>&nbsp;tab in the&nbsp;<em>Rules<\/em>&nbsp;screen ! I have added a rule to let DMZ hosts reply to ping request. Here it is:<\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\t<img decoding=\"async\" alt=\"Allows ICMP echo request\" src=\"https:\/\/shan.info\/new\/wp-content\/uploads\/images\/k2\/pfsense\/pfsense-nogw2-rules-floating.png\" style=\"border: 0px; outline: 0px;\" \/><\/p>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tBefore the&nbsp;<em>Floating<\/em>&nbsp;tab, you add to duplicate some rules in each&nbsp;<em>interface<\/em>&nbsp;tab. This was making pfSense 1.2.X a bit unsuitable for configuration with lot of interfaces and rules !<\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tAdd IP fail-over<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tIf you need to manage&nbsp;<strong>IP fail-over<\/strong>&nbsp;inside this configuration, take a look at this&nbsp;<a href=\"http:\/\/blog.magiksys.net\/adding-ovh-ip-fail-over-to-pfsense-configuration\" style=\"color: rgb(0, 113, 179);\">post<\/a><\/p>\n<h1 style=\"margin: 1em 0px 0.5em; font-weight: inherit; font-size: 1.357em; color: rgb(0, 0, 0); font-family: Georgia, 'Times New Roman', Times, serif;\">\n\tAdvantages of this configuration<\/h1>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tThe biggest advantage of this configuration is the use of&nbsp;<strong>routing<\/strong>&nbsp;instead of&nbsp;<strong>NAT<\/strong>&nbsp;to forward packets. The other are:<\/p>\n<ul style=\"margin: 1em 0px; padding: 0px 0px 0.25em 2.5em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n<li>\n\t\tthis config provide a zone for your hosts in your DMZ and your LAN with usual network settings (a gateway in the same LAN subnet).<\/li>\n<li>\n\t\tthis config is based on routing instead of NAT, this avoid problems with NAT&nbsp;<em>sensible<\/em>&nbsp;protocol like: ftp, pptp, &#8230;<\/li>\n<li>\n\t\tNAT drops connection if no packets are going through for too long. Routing don&#8217;t and don&#8217;t require any&nbsp;<em>keep alive<\/em>&nbsp;plaster!<\/li>\n<li>\n\t\tthe hosts in your DMZ use the public IP addresses, this make things simple and avoid confusion.<\/li>\n<li>\n\t\tLAN access your DMZ using public IP addresses.<\/li>\n<li>\n\t\tno need to define NAT rules, only the filter rules are required.<\/li>\n<li>\n\t\treduce the MEMORY and CPU usage of the firewall.<\/li>\n<\/ul>\n<p style=\"margin: 0px 0px 1.2em; color: rgb(59, 59, 59); font-family: Georgia, 'Times New Roman', Times, serif; font-size: 15px; line-height: 22px;\">\n\tHope this help !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/blog.magiksys.net\/pfsense-firewall-default-gateway-different-subnet &nbsp; &nbsp; I have written a better article, using the firewall in transparent mode&nbsp;here&nbsp;. This article has been updated for&nbsp;pfSense&nbsp;2.0. The original article about pfSense 1.2.X has moved&nbsp;here. News: It looks like the OVH gateway works like an universal ARP proxy or Captive portal. I means my OVH gateway replies to any ARP request. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[],"class_list":["post-301","post","type-post","status-publish","format-standard","hentry","category-pfsense"],"_links":{"self":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/comments?post=301"}],"version-history":[{"count":0,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/301\/revisions"}],"wp:attachment":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/media?parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/categories?post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/tags?post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}