NFV-based network implements a variety of network functions with software on general-purpose servers and this allows the network operator to select any capacity and location of network functions without any physical constraints. It is essential for economical NFV-based network design to determine the place where each network function should be located in the network and what its capacity should be. The authors proposed an algorithm of virtual routing function allocation in the NFV-based network for minimizing the network cost and provided effective allocation guidelines for virtual routing functions. This paper proposes the deployment algorithm of virtual firewall function in addition to virtual routing function for minimizing the network cost. Our evaluation results have revealed the following: (1) Installing a packet filtering function, which is a part of the firewall function, in the sending-side area additionally can reduce wasteful transit bandwidth and routing processing and thereby reduce the network cost. (2) The greater the number of packets filtered by packet filtering function in the sending-side area, the more the reduction of network cost is increased. (3) The greater the bandwidth cost relative to the routing function cost, the greater the effect of statistical multiplexing on reducing the network cost. (4) The proposed algorithm would be approaching about 95% of the deployment with the optimal solution. KEYWORDS NFV, resource allocation, the virtual routing function, minimum total network cost