Chadster766 / McDebian

Linksys WRT3200ACM, WRT1900AC, WRT1900ACS, WRT1200AC and WRT32X Router Debian Implementation
98 stars 14 forks source link

Use eth0 for traffic to wan port. #71

Closed ericwoud closed 1 year ago

ericwoud commented 3 years ago

Here is a suggestion:

It is possible to set up eth0 for traffic to wan port, just as the original linksys

First apply this patch .

Now port 6 is available and named aux. Make the bridge vlan aware. Put wan and aux port in a separate vlan. Setup eth0 as outgoing port instead of wan port.

The only thing is that the vlan is also added to the cpu port automatically. It does not seem to give any trouble, but it can be fixed with this patch .

ericwoud commented 3 years ago

Never mind that second patch, it messes up the network. Anyway, mom always said: If it ain't broken, don't fix it! Should have listened.

Applying the first patch already does the trick. One would expect the traffic goes a sort of ping pong slow software path: wan --- cpu --- eth1 --- dsa driver --- eth1 --- cpu --- aux --- eth0. But in fact it seems like the hardware offloading kicks in and the traffic is forwarded in the switch hardware from wan to aux, not taking the slow software path. Exactly what we want: wan --- aux --- eth0. ifstat shows us the traffic is not passing eth1 anymore.

Below example I was watching a youtube video on the TV connected to a lan port. The outgoing traffic on eth1 is the traffic going to lan2 to the TV.

When setting wan traffic directly on the wan interface (the old situation):

# ifstat -wi eth0,eth1
       eth0                eth1       
 KB/s in  KB/s out   KB/s in  KB/s out
    0.00      0.00    566.60    515.06

When setting aux and wan on the bridge in a separate vlan (or put them in a separate vlan-unaware bridge), and setup eth0 as the outgoing port, the traffic flows like this:

       eth0                eth1       
 KB/s in  KB/s out   KB/s in  KB/s out
  559.50     28.54     31.31    490.92

Now eth1 has more bandwidth left for lan traffic.

When watching a video on my tablet on the wireless connection of the router, eth1 is totally not used anymore:

       eth0                eth1       
 KB/s in  KB/s out   KB/s in  KB/s out
  532.47      5.16      0.00      0.00
Mark-GR73 commented 3 years ago

Nice work.. Perfect question... very good answer. Dear ericwoud... Your wrt work giving lessons.....