What I need to change in the script to work with 4 LAN ports?
I guess it is in this part:
add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local
Do I Need to add these two lines for each LAN Interface I have and thats it or do I need to change more in the script?
What will be the case if most of he traffic is coming from a other router, which is running NAT already? Would this script still work, as most of the traffic will come from the same source IP.
Any solution for that? NAT can not be disabled at this router.
if all of the interfaces are on the same switch chip then you can set the other interfaces to have the master port set to the first lan port… ie: ether2 could be the lan port, ether3 could be set to have the master port be ether2, etc.
Alternatively if they are not all on a switch port you can create a bridge port and call it something like Local. Then you can make each interface be a member of that bridge through bridge ports. Then you will configure all ip addresses, dhcp etc on that bridge rather then any individual interface.
For PPC to work your basically set up your local network and then setup two external networks. Both should work before you go further. You should be able to plug in only one and have internet then plugin the second and unplug the first and still have internet. The PCC allows you to add routing marks to connections. You can then setup default routes to each provider with a routing mark on the route. Then when you configure the PCC mangle rule the marked packets will match up with the routes and will choose be split over the multiple connections.
You don’t need to do anything to put them together if your routing. The interfaces route by default when an IP address is assigned to the interface. You’ll see a route entry in the routing table with a “D” in front of it which means that it is a dynamic route. If a packet enters ether1 and is destined for an IP address that is within the subnet of a route for ether2 then it will exit ether2 unless there is a rule of some sort that you created to drop or otherwise change the default action.
If the packets are inside of the same subnet then you will have to bridge or switch the interfaces.
For example:
Assuming 192.168.1.1/24 is an address on ether1
and 192.168.2.1/24 is an address on ether2
the computer 192.168.1.5 attached to ether1 could route through 192.168.1.1 to the computer 192.168.2.5 attached to ether2
This will be because the router will have dynamic routes similar to the following:
DAC, 192.168.1.0/24, ether1, 0, 192.168.1.1
DAC, 192.168.2.0/24, ether2, 0, 192.168.2.1
The config above only is applicable to the single interface “Local” so it will not accept packets from two interfaces even though it will from two subnets. If you remove the in-interface condition then it may work. Or you can specify the in-interface that that ip address is assigned to.
Looking at that config I would guess that the author expected something like ether1 renamed to Local and and ether2 set to switch with ether1. That is just speculation though.