Re: Need Linux Router

Grant Taylor <[email protected]> Mon, 14 Dec 2020 00:22:22 -0700
Newsgroups alt.comp.os.linux
Organization TNet Consulting
Message-ID <[email protected]>
On 12/10/20 11:00 PM, Leslie Rhorer wrote:
> I have a Debian Linux box on a network that needs to act as a simple 
> router with a couple of extra features.  Network A is on the main LAN 
> interface.  LAN A has an internet router whose address is set as the 
> default gateway for the Linux box.  Network B will be on a secondary 
> LAN interface with a small handful of devices.  I need all traffic 
> between the two LANs to be freely forwarded,

Okay.

What route do the devices on LAN A used to reach the devices on LAN B? 
Do they rely on the default gateway knowing to route traffic to LAN B 
via your Debian box?  Or do the devices on LAN A have a route to LAN B 
via your Debian box and thus bypass the default gateway?

> but I need traffic from LAN B to the internet to be completely 
> restricted to the hours between midnight and 5:30 AM.  My client 
> has a metered internet service that is free between those hours, 
> but carries a fee outside those hours.
> 
> I need the router not only to restrict all traffic to the internet 
> between those hours, but to also log any attempts to engage in traffic 
> outside those hours and to meter all traffic to and from the internet 
> at all times on LAN B.

Check out the "time" iptables match extension.  man iptables-extensions

With the time match, it should be simple enough to construct rule logic 
to either allow the traffic.  Logging can be done via another rule after 
the previous rule allowing the traffic during the open window.  Or you 
could have another rule very similar to the first rule with the logic 
inverted and routing the traffic to a log.



-- 
Grant. . . .
unix || die