1. A non-transitory machine readable medium storing a program which when executed by at least one processing unit configures a plurality of managed forwarding elements (MFEs) to implement a logical network that comprises a logical L3 router and at least one logical L2 switch that logically couples to a plurality of machines, the program comprising sets of instructions for: for each MFE of the plurality of MFEs that implement the logical network and couple directly to at least one of the machines, generating a first set of data records for configuring the MFE to install a first set of flow entries that implement the logical L2 switch and logical L3 router for packets sent by the at least one machine that couples directly to the MFE, wherein each MFE of the plurality of MFEs operates on a separate physical machine to implement the logical L2 switch and logical L3 router on the separate physical machine; and for each MFE of the plurality of MFEs, generating a second set of data records for configuring the MFE to install a second set of flow entries that implement network address translation (NAT) processing on a subset of packets sent by the at least one machine that couples directly to the MFE, the subset of packets comprising packets sent to a destination that does not logically couple to a same logical L2 switch as the machine that sent the packet to the MFE.