Building a Linux firewall

Learn about the three types of firewalls—application proxy gateway, circuit level relay, and packet filter—and how they are used to protect your network from unauthorized access.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


prat's picture

i m working on firewall on linux platform....could you please send me ypur code for assistance..on

linux firewall code needed.. urgent!

Anonymous's picture

has anyone out there got a complete working code on linux based firewall?? plz help!!

complete firewall code for linux...

Anonymous's picture

Hi... v r dng a project on firewall for linux... can u please give d code of a simple packet filter firewall for linux... my mail id is

linux firewall

anonymous's picture

hey ,
we r doing project on a network security.. we r going to build a DMZ for a private network. In which we r supposed to build our own firewall on linux. so could u plz guide us regarding how to start with the project.. we would be very thankful to u if u provide us with the complete soursecode id is

firewall code needed

thomas's picture

hey friends am planning to do a project on linux firewall.but dont hav any idea on how to do pls if any1 has any info about the logic and got the complete code ,pls do mail it to me at pls HELP ME..i want it early

Re: Building a Linux firewall

Anonymous's picture

i'm building a linux firewall in bash en a configuration file can somebody help me with a complete code so i can have an idea how i can began,my e-mail is

Re: Building a Linux firewall

Anonymous's picture

Can you provide a complete source code

My Mail ID :

Re: Building a Linux firewall

Anonymous's picture

# cat set_policy.c

#include <stdio.h>

#include <string.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <linux/ip.h>

#include <linux/tcp.h>

#include <linux/udp.h>

#include <linux/ip_fw.h>

main(int argc, char **argv)


int p, sfd;

struct ip_fw fw;

fw.fw_flg = 0;

if (strcmp(argv[1], "accept") == 0) {



else if (strcmp(argv[1], "reject") == 0) {



else if (strcmp(argv[1], "deny") == 0) {

p = 0;



setsockopt(sfd, IPPROTO_IP, IP_FW_POLICY_FWD,

&p, sizeof(int));


Need a bit help

Shobhit Kumar's picture

This is Shobhit here....i m trying to build a kind of firewall in C...actually i m looking for specific URL blocking for a bandwidth manager box....i mean to say a program that can recognize the packet information from the network....and that sort them and then block the required packets.....if u ould help me with this....more over if u could send me the full ode than atleast i will get some idea...thanx


Anonymous's picture

Can anyone help me to code a firewall using netfilter which will support multiple rules

can you provide me a complete code?

Anonymous's picture


i am developing a firewall for my system and i would like to look at you code for that purpose.

i would appreciate if u would email me the same at folowing id:



need help

Anonymous's picture

we have a LAN and a gateway in it. We want to hold all the packets coming into the gateway for compression /modification. we want help for this.
thank you.

Give a complete code not just a part of it

Anonymous's picture

Would you please give a complete code not a part.

My email id:-

Re: Building a Linux firewall

Anonymous's picture

Would you please give a complete code not a part.

My email id:-

Building a Linux firewall

juno's picture

hi there..we are currently working on a firewall for our thesis..i was hoping if anybody can help me.. can you send me the complete source's my email:

thank you..

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState