[SOLVED] Linux Firewall with policy base routing - unable to connect
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am building PBR on our office firewall.
In the above example, by default all traffic should use lease line connection.
I want only http (80) to dst any from client 10.20.10.10 to use the adsl connection.
Below are my PBR steps
echo 201 webToadsl.out >> /etc/iproute2/rt_tables
iptables -t mangle -A PREROUTING -i vlan10 -s 10.20.10.10/32 -d 0/0 -p tcp --dport 80 -j MARK --set-mark 1
ip rule add from 10.20.10.10/32 fwmark 1 table webToadsl.out
ip route add default via 10.20.20.254 dev eth3 table webToadsl.out
ip route flush cache
iptables -I forward -p tcp -s 10.20.10.10/32 -i vlan10 -o eth3 -d 0/0 --dport 80 -j ACCEPT
iptables -t nat -A POSTROUTING -p tcp -o eth3 -s 10.20.10.10/32 -d 0/0 -j SNAT --dport 80 --to-source 10.20.20.10
Problem: unable to connect
Traffic is going out from client to firewall, also going out from firewall via eth3 and coming back but not forwarded to client's IP.
Traffice sent from Client:
tcpdump -vv -nn -i eth0 host 18.104.22.168 and tcp port 80
18:51:50.791467 IP (tos 0x10, ttl 64, id 52305, offset 0, flags [DF], proto TCP (6), length 60)
10.20.10.10.46551 > 22.214.171.124.80: Flags [S], cksum 0x15bc (correct), seq 1851822580, win 5840, options [mss 1460,sackOK,TS val 51404197 ecr 0,nop,wscale 6], length 0
18:51:53.788820 IP (tos 0x10, ttl 64, id 52306, offset 0, flags [DF], proto TCP (6), length 60)
10.20.10.10.46551 > 126.96.36.199.80: Flags [S], cksum 0x12ce (correct), seq 1851822580, win 5840, options [mss 1460,sackOK,TS val 51404947 ecr 0,nop,wscale 6], length 0
18:51:59.788810 IP (tos 0x10, ttl 64, id 52307, offset 0, flags [DF], proto TCP (6), length 60)
10.20.10.10.46551 > 188.8.131.52.80: Flags [S], cksum 0x0cf2 (correct), seq 1851822580, win 5840, options [mss 1460,sackOK,TS val 51406447 ecr 0,nop,wscale 6], length 0
Traffic received on Firewall from client on interface vlan10
tcpdump -nn -vv -i vlan10 host 184.108.40.206 and tcp