Make host go out specific WAN interface

  • hi all,

    i have a pfsense firewall and i have two (x2) WAN addresses and atm all my traffic going out is coming from my WAN1

    if i want to make a single host go out WAN2

    is this possible

    many thanks,


  • I will try to answer this. Experts : Correct me if i am wrong

    You can setup a rule on LAN interface
    Within the rule, Under Source, select "Single Host or alias", Define the ip address of the machine which should go out through WAN2
    Next under Extra Options, click on "Display Advanced", Scroll down to "Gateway" and choose the one for WAN2

    Just ensure the rules are in correct order else this source will hit the default LAN rule first and follow the regular path

  • so i dont need to do it under "Firewall > NAT > Outbound" just make a simple rule under "Firewall > Rules"

    i just want this host to use WAN2 for traffic in/out

    and all other traffic to use WAN1 in/out

  • LAYER 8 Netgate

    As long as the source address is already covered in the normal outbound NAT rules on that WAN interface you are good.

    Outbound NAT only determines what NAT takes place. It has no bearing on what gets routed where.

    Policy route your source address with the desired gateway set (or no gateway if the default route is what you need) above any more general rules that would also match the traffic. The rules would be on "LAN"

  • This is exactly what im after

    I still really dont get what outband nat is as i thought it was exactly for this to make a host or network go out a different gateway or wan interface

  • LAYER 8 Netgate

    Outbound NAT has no effect on routing.

    It controls what NAT takes place when a new connection goes out a particular interface.

    Most simple networks can use Automatic NAT.

    Common uses for custom rules are for things like SIP PBXes that need static ports (if the source port from the PBX is 5060, if needs to be sourced from 5060 out the WAN interface (after NAT) too).

    It can be used if you have multiple WAN addresses. (If the connection is to destination TCP/25, set the source address to X.X.X.X, else use X.X.X.Y)

    If you have internal networks with public addresses that are routed to you, you might use a Do Not NAT rule for those source addresses so no NAT happens at all.

    In any case, the routing table or policy routing has already chosen that WAN as the interface to use for the connection. The outbound NAT rules have zero influence over that decision.

  • ok so below point 9 is what your saying "policy based route" so make that host use the WAN 2 gateway instead of the default one ie WAN1

    but why has he done point 8?




    There's a new(ish) hybrid mode for outbound NAT which makes this pretty easy.  Add the two rules shown in the screenshots and then set the Mode to Hybrid Outbound NAT.  I use the entire LAN subnet as the source address for these entries, but it could also be limited to the network block chosen for vpnclients (  I use the entire LAN subnet so I don't have to worry about updating outbound NAT rules if I want to change the vpnclients alias.


    Add a rule to block vpnclients from making DNS queries to the LAN IP.  This prevents vpnclients from using the DNS Resolver and prevents DNS leaks if you forget to override DNS settings when adding static DHCP mappings for vpnclients.

    Add a rule that creates a policy based route for vpnclients.  Traffic that matches the rule will be sent via the VPN (ex:TORGUARD) gateway.  Traffic that doesn't match will fall through to the default LAN rule.

  • LAYER 8 Netgate

    I have no idea. Because he doesn't understand either?

    The Automatic NAT rules show you what source addresses the firewall has determined should be NATted. If your source network is included, you need not do anything. If it is not you can switch to hybrid (or manual) and add it.

  • the last step i need help with is point 10 (below)  the "no_wan_egress" i imagine this is an alias to some networks?


    Create a floating rule that watches for and rejects outbound WAN traffic that's marked NO_WAN_EGRESS.  This prevents vpnclients from connecting to the internet via the WAN when the VPN interface goes down.

  • LAYER 8 Netgate

  • thanks Derelict

  • mmm… somethings not right

    i attach a picture of my rules and floating rules -

    basically my "internal network" is

    my "VPNclient" is so it falls within the internal network subnet, i dont know if that matters

    my DHCP server is from the range of so my vpnclient alias IP is not in the scope

    as soon as i change my pc NIC to i loose internet

    any help would be great, i persume im doing something really stupid!



  • ok i have added a new network on my switch "" and i have made my pc ""

    i have added a new static route on pfsense so the to can talk to eachother ie pfsense and my switch

    i have network access fine ie i can talk to other subnets but i still get no internet activity

    can anyone help please



  • LAYER 8 Netgate

    Static route? Why a static route?

    You are going to have to produce a diagram. See the one in my sig for the type of info necessary.

  • i attach a better betwork diagram of my static routes to my switch and pfsense

    yeah i have static routes set up to route traffic from my default network on my pfsense to all my other networks on my switch

    i attach a picture so you have more of a understanding on my network

    my pfsense ip is "" and switch on the same network is "" and it carrys static routes down it so my devices connected to my switch on different subnets can see the network and the internet

    on my pc i have made my default gateway the VPN network switch IP ""

  • LAYER 8 Netgate

    Whatever that is it is not a network diagram.

  • LAYER 8 Netgate

    Yeah I ain't downloading some zip file from a forum user.

  • LAYER 8 Netgate

    Is covered by automatic outbound NAT?

    Do the firewall rules on the interface pass traffic from all of the static route source addresses?

    I would not design it that way. I would use another router interface for the transit network to the switch and one for management. Management should probably not be a layer 3 interface on the switch.

  • you mean this under firewall > NAT > outbound

    sorry i dont reallt understand second question?

    i have an alia called "internal network" with manage and VM networks that are allowed out to the intnernet but the vpn isnt

  • LAYER 8 Netgate

    That NAT looks fine.

    You have a pfSense interface with the address on it.

    That interface has firewall rules on it.

    What are those?

    What, specifically, are you doing that is not working? You are going to need at least some troubleshooting skills to be able to make something like that operate.

  • i attach a better network diagram including my static routes

    but i would had thought this rule that i attach works as i dont see it not working

    my three top rules are for my alias "vpnclients" which in the diagram i showed you is my windows PC with the VPN IP

    and the bottom rule is for my "internalnet" to go out to the internet this is the manage and VM subnets

    but when i plug in the ethernet cable in my NIC which is on the VPN network i have network access ie i can see the LAN but not the WAN which i would have thought it would of been going out the proton vpn gateway but its not working

  • LAYER 8 Netgate

    What is Allint ??

  • allnet is all my actual interface NICS ie manage (i call it home) DMZ and proton vpn

    mmm… maybe i shouldnt put proton vpn in the all interfaces as really my all interfaces should be my acyual physical NICS on pfsense, what do you reckon?

  • LAYER 8 Netgate

    So it's an interface group?

    Those are generally only useful on LAN interfaces where all interfaces in the group need exactly the same rules. There are other reasons (like reply-to that make them not very useful on WAN interface.

    Instead of taking short cuts you might want to stick to just rules on interface tabs for now.

  • thanks derelict, i will try that

    sorry havnt replied just personal issues atm

  • sorted!!!

    i made a stupid mistake

    when i was making the vpn interface (so i can use it as a gateway for my specific vpn traffic) i ticked both boxes under "reserved networks" which blocks rfc1918 but i dont want to block them as the virtual vpn ip im assigned is which is a rfc1918 address

    i put back protonvpn interface back in the "ALLInt" so i can easily manage the rules under one tab as its long winded otherwise

    also in firewall > rules > outbound i had to make it hybrid and copy the wan and make another one for the protonvpn address as it didnt work otherwise

    see pic of what i did

    thanks for all your help in this Derelict much appreciated!

Log in to reply