Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7403709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:08:59+00:00 2026-05-29T05:08:59+00:00

Im writing a bash scripting to account traffic in my network server: WAN:eth1 ->

  • 0

Im writing a bash scripting to account traffic in my network server:

WAN:eth1 -> GNU/Linux Server:eth0 -> Users
The GNU/Linux server uses squid, bind, QoS, mysql, lighttpd.

After an IP exceed the established quota a new QoS rule is applied for that IP (user) too exist one “flag” to decide when is restored the IP counter to Zero.

Some IPs and subnets work without quotas, other gruop of ips/subnets work with new QoS after quota is exceeded, and now I wanna work with a third group with redirection after quota is exceeded.

When an IP exceed the established quota all http traffic must be redirected to host (lighttpd runing on GNU/Linux ) and DROP all other traffic generated for that IP. In webserver exist a webpage with: “You exceed your daily quote of traffic, please wait “x” hours or call to your provider to purchase an extra navigation package” or something like that.

Is possible using a chain, or how can I do that?.
The most topics that I found in Internet, are related to block all and create a new chain to let out to Internet (not work for me). And other redirect only IP by IP, but how can I create something that a “chain” and attach the IPs to must me redirected to can after restore that IPs easly?

Thanks for help and sorry for my poor English :S.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:08:59+00:00Added an answer on May 29, 2026 at 5:08 am

    Are you looking for something like this?

    iptables -t nat -A PREROUTING -s 192.168.100.66 -p tcp --dport 80 -j REDIRECT --to-ports 80
    iptables -I INPUT 1 -i lo -s 192.168.100.66 -j ACCEPT
    iptables -I INPUT 2 -i eth1 -d 192.168.100.66 -j DROP
    

    This will redirect packets from 192.168.100.66 on port 80 to the local webserver on the loopback interface, allow that conversation, then reject all other packets being routed to 192.168.100.66 on the WAN interface.

    To restore the connection back to normal you will want to delete those firewall entries:

    iptables -t nat -D PREROUTING -s 192.168.100.66 -p tcp --dport 80 -j REDIRECT --to-ports 80
    iptables -D INPUT -i lo -s 192.168.100.66 -j ACCEPT
    iptables -D INPUT -i eth1 -d 192.168.100.66 -j DROP
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I like GNU/Linux and writing bash scripts to automatize my tasks. But I am
I am writing a bash script to set up a production server. The tasks
I am writing a bash script to copy a file from a remote server,
I'm writing a bash shell script that uses a case with three options: If
While writing BASH scripts, I generally use the which command of a Linux machine
New to bash scripting, I'm writing a script to copy my TV shows accross
Im writing a bash-script to perform an offsite backup, using rsync over SSH. I'm
I am writing a bash script to deal with some installations in an automated
I'm writing a bash script that needs to delete old files. It's currently implemented
I'm writing a bash script and I have errexit set, so that the script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.