OpenWrt Forum Archive

Topic: OpenWRT as router for Google Fiber?

The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello community. I am scheduled to get a Google Fiber connection at my house in the next couple of weeks (1Gbps up/down). I was dismayed at first that Google Fiber did not appear to allow my own router to be directly connected to the Internet -- I'd have to use their own network box as the edge router and would only be able to access my own equipment/services through port-forwarding on their box. To make a long story short, the settings needed to setup your own router have been disclosed and are working for many. One such solution is documented here -- http://flyovercountry.org/wp-content/up … rGuide.pdf -- that's a guide for pfsense. The only thing I don't like about that proposed solution is that it requires a dedicated switch doing the VLAN and Priority tagging. I would much rather have all the settings configured and managed directly through my own router and from what I have read on the matter it seems "vconfig" should be able to set both the 802.1q VLAN and Priority TAGs required to setup the connection correctly. VLANs are not new to me, but setting the priority bits is so I'd appreciate some advice to see if I can get this entirely setup and managed on OpenWRT 12.09  and avoid needing any additional equipment.

Here's the short of what's needed as I understand it:
- WAN port must support 802.1q VLAN tagging, specifically to set VLAN 2
- WAN traffic Priority (PCP) must be at least set to 3, though some add'l priorities are suggested as follows if possible:
-- DHCP to 2
-- IGMP to 6
-- Everything else to 3

Again, from what I have read it seems vconfig should be able to set both the needed VLAN and Priority bits to do this but I would really appreciate a knowledgeable second opinion on whether the principles documented in the PDF linked above could be entirely implemented on OpenWRT alone. I am currently running OpenWRT 12.09, r36088 on a TP-Link WR1043nd

Kind regards from Kansas City, thank you.
/edited 2016 Jan 10 to update the PDF link

(Last edited by knetknight on 11 Jan 2016, 04:59)

I can help you set it up using Teamviewer.

Thanks ron, I may take you up on that but for the moment I'm really just looking for confirmation from someone that what I'm thinking should even work. Have you setup a working Google Fiber connection using OpenWRT yourself yet?

What I'm thinking is that I need to set the WAN port to VLAN 2 and mark it tagged, and then set priority to 3 with something like "vconfig set_egress_map eth0.2 0 3", or maybe "vconfig set_egress_map eth0.2 3 3" ???

As stated in the OP, the real mystery to me personally is setting the priority bits correctly. And, in the linked PDF and related discussion I'm having with its author and some others, I don't see how vconfig allows for setting the priority for the different TYPES of traffic - DHCP, IGMP, and "all". The inability for me to see an immediate parallel to that aspect with vconfig makes me wonder if perhaps I'm barking up the wrong tree and need something else, like to Traffic Control (tc command.)

I'm thankful for any guidance as I'm trying to plan and prep for this as much in advance of the actual install as possible.

No, we don't have Google Fiber in Texas. So that is why I am interested. It seems like if you can just set the VLANs correctly, that should get you going. The data prioritising part simply will help you fine tune your upload speed. The data priority can be set using traffic control tools like tc, in addition to iptables and iproute2.

(Last edited by ron on 30 Apr 2014, 22:59)

Well I'll definitely keep you posted. I have for the time-being, to be on the safe side, purchased a Netgear GS108tV2 which someone has documented how to configure to get a full-speed Google Fiber connection. You can see Part 2 of his two-part guide here -- http://flyovercountry.org/2014/02/googl … art-2-qos/ -- this is the part that deals with the QoS aspect which I am less familiar with. I'd think a fully-functional Linux router could set the same flags if I just knew how to do it. I don't get my install for about another two weeks though but I'll keep ya posted when I do.

In the meantime, are you familiar enough with Linux and QoS to know to set the QoS/CoS/PCP bits? Again, it looks to me like vconfig can at lease "broad brush" those bits and set a '3'. If you can be any more specific to help me learn and understand this better myself that'd be great.

Thanks much.

(Last edited by knetknight on 2 May 2014, 21:16)

Please do keep me posted. I am R&D software guy, so even If I don't know stuff, I will find out.

Any how, looks like we are talking about a byte in IP Protocol header referred to as the TOS byte (or now called DSC/ECN byte). It is the second byte in IP Header right next to the IPVersion and Header length field.

Linux kernel does have queues for dispatching network packets. Some packets will be given priority over the others if they belong to high priority class, but with in a class its FIFO.

Essentially it depends how the software processing the IP packet will interpret the TOS byte. I suppose in case of google fiber, they have given you the list what they want to see in this byte. If we can set this byte correctly then you should see better performance. That's pretty much it.

If you are interested to see what this byte is all about, you can read

http://en.wikipedia.org/wiki/Type_of_service

Thanks

Hey Ron, thanks for the link. I had read that article already in my own quest and I was still unclear. Tonight though I think the fog is lifting and that I finally understand the distinctions that I needed to make between QoS, ToS, and CoS.

The following linked helped me: https://learningnetwork.cisco.com/thread/38069

In short:
QoS is a general term to the concept of prioritizing packets.
ToS is QoS at the IP level.
CoS is QoS at the Ethernet level, and so far it seems it is also inextricably bound to VLANs. i.e. it appears you can't set CoS on a standard interface, it must first be configured for VLAN.

For Google Fiber, it's the CoS bits at the Ethernet level that we are concerned with, not ToS in IP, and it appears that vconfig is the man for that job. So, just keeping you posted on my progress in figuring it out.

(Last edited by knetknight on 6 May 2014, 05:02)

Super. As long as we know which byte offset needs to be modified, its doable. If nothing else works, its always possible to modify the kernel driver.

Hey there.

Is this flyovercountry guy really talking about full speed of google fiber? His second paragraph talks about 10Mb/s uplink ... that's not even close to 1GBit, is it?

The GS108tV2 is not a router but a vlan capable switch, so I don't think it has anything to do with routing performance. It's nice for local networks, and if you have a single-port router (e.g. some x86 computer with a single NIC attached), then a vlan aware switch is required. But every SoHo router device has an integrated vlan aware 5-port switch bringing at least 800MBit. So I don't know if this poist is really usefull for you.
I tried to read both of this guys (flyoverstate) posts, but I did never get to the point where he actually configured routing. Maybe the routing thing isn't handled there but by the default google box or any other device?

Your drobox link is closed, so I don't know which pfsense configuration you're talking about.

I run an TP-Link 4900. Not on google fiber but on a pretty small 18MBit connection with 1Mbit uplink. But I do internal routing through several private subnets/vlans in my own network, and I get 45MB/s (should be ~350MBit) from one vlan to another. It doesn't really matter if I use direct routing or NAT, performance is nearly the same.

I see what's the switching part of that blog post for. But I don't know which kind of OpenWRT router has nearly anough power for doing the routing part. And that's actually the more interresting thing, since that's the bottleneck here, not the switch.

One thing I can think of: Use a small atom box or Intel NUC. Those are relatively cheap. Starting at ~ $200 they could have enough CPU to do routing. But a ~ $100 SoHo router most likely hasn't. But I never used OpenWRT x86 builds on any real hardware, so I cannot say for sure how well this will work. And to the very end it most certainly depends on the chipset and integrated NIC.
So maybe you just give it a try?

But besies such a home brew routing thing I don't think any low priced router running OpenWRT will make you happy.

Regards,
Stephan.

Hello Stephan, thanks for letting me know the original link was no longer working. I found where it moved (the guy updated his guide and link) and I updated the link in the original post just now. It's mostly just for reference to a working config as a model anyway just in case someone else sees or understands something that I've missed.

As to the GS108Tv2 -- "His second paragraph talks about 10Mb/s uplink". Yes, but he mentions that that's what you get only until the CoS bits are set correctly, and using the GS108Tv2 to set the CoS bits correctly is exactly what he covers in the 2nd part of the series to get the uplink speeds to full performance. The primary role of the GS108Tv2 (in this setup) is two-fold -- to set the CoS bits as the packets come into the switch port that's connected to your own router, and to actively tag the proper VLAN ID as the packets leave the port to the fiber transceiver. So yes, you're right, the GS108Tv2 is not doing any routing, it's purpose is just to massage the packet bits in ways that many home routers are not capable of doing on their own, or at least not easily or natively. (And I'm hoping OpenWRT is an exception.)

As to me, I have and will use the GS108tv2 if I have to, but I'd personally like to see (the intent of this post) if I can replicate all the needed settings on OpenWRT alone because it would be simpler, cheaper, and more easily replicated in other environments. Also, personally, I'm more interested in maximum flexibility with reasonable performance than maximum performance. i.e. If I get even just 500/500 out of a pure OpenWRT/Linux solution I'll be ecstatic considering I'm currently on a relatively pokey 15/1 connection right now.

In my case I'm going to attempt to use a TP-Link WR1043ND with OpenWRT 12.09. OpenWRT looks to support the VLAN tagging side of things easily enough and since OpenWRT also has vconfig I'm hopeful I can use it to at least globally set the CoS bits to "3" which, according to at least the PDF's author, is the bare minimum CoS setting to break out of the 10Mbit/s uplink limit imposed on non-CoS tagged packets. The Flyover link documents different CoS settings for various protocols but the author of the PDF (Atlantisman) says he's gotten full speed just setting the CoS to 3 universally. As long as it's that simple I think vconfig ought to be fine, but if it turns out I really do need to differentiate CoS by protocol for peak performance then I'm not sure if OpenWRT/Linux/vconfig can oblige -- every vconfig CoS example I've seen sets the CoS value by VLAN rather than protocol.

Installs start in my area in 10 days -- I think I've done about as much as I can until the connection is available to start putting what I've learned into practice and see if it comes together like I think it should.

(Last edited by knetknight on 7 May 2014, 15:24)

More reading just now and it's all coming together and starting to make perfect sense. It looks like setting CoS by protocol is as simple as using iptables' mangle to change the skb priority value depending on protocol or any other legitimate match, and then use vconfig's set_egress_map to map skb priorities to whatever ethernet layer CoS value is to be tagged. vconfig does all the CoS tagging by itself but working in conjunction with iptables it can get smart about it.

So here's roughly what I think needs to happen, just an example for your review to see where I'm at in the thought process of putting the pieces together.

On the VLAN 2 egress/Internet interface, eth0.2 in this example:
map default skb-priority 0 to vlan qos 3

vconfig set_egress_map eth0.2 0 3

map skb-priority 2 to vlan qos 2, and 6 to vlan qos 6

vconfig set_egress_map eth0.2 2 2
vconfig set_egress_map eth0.2 6 6

iptables mangle to set corresponding skb-priority on DHCP and IGMP packets to match their intended vconfig set_egress_map.

iptables -t mangle -A POSTROUTING -p udp -m udp --sport 68 --dport 67 -j CLASSIFY --set-class 0:2
iptables -t mangle -A POSTROUTING -p igmp -j CLASSIFY --set-class 0:6

I could be wrong, but that's how I envision them working together at this point. Thoughts anyone?

(Last edited by knetknight on 7 May 2014, 16:45)

Hey, just an update that I have long since gotten Google Fiber and am using OpenWrt with it.

This could probably be automated in the config but for now I just script the following in /etc/rc.local and it picks right up. br-wan is the internet interface in this example, you'd have to sub yours.

vconfig add br-wan 2
vconfig set_egress_map br-wan.2 0 2
udhcpc -i br-wan.2

Other than of course making sure your firewall and nat rules are appropriate that's all there is to the Internet connection itself and getting an up/down connection that's as fast as your device is capable of keeping up with. I've only been testing with a 100Mbps GL.iNet 6416A but it's working great as an auxiliary access point with its own public IP and direct connection to Google Fiber to segregate guests off my internal WiFi. I am NOT yet testing or using OpenWrt to mediate any of the IPTV traffic, though that looks like a simple igmpproxy setup.

Hi knetknight,

If I understand your last post correctly, in addition to setting the vlan id to 2, your are tagging indiscriminately all the outgoing packets with priority 2?
I was investigating the /etc/config/network approach, I could set the vlan id 2 on my WAN and got the thing working (limited to10Mb upload) but I'm a bit clueless on the 802.1p priority tagging after that :-|
I was wondering if you had put more thoughts in the config approach since then.

Thanks

For who's interested, I eventually used an "hybrid approach":
1 - Change the WAN VLAN id in "/etc/config/network"
Ex with my router:
config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'
BECAME
config interface 'wan'
        option ifname 'eth1.2'
        option proto 'dhcp'

2 - Tag the outgoing packets with priority 2 (based on knetknight post).
Ex with my router, in "/etc/rc.local" I added only 1 line (no need to add the "udhcpc" as the VLAN is configured via the UCI in my case):
vconfig set_egress_map eth1.2 0 2

With that, I get the full 100Mb up/down <10ms ping (yes, I took the 100Mb contract) and my old Netgear WNDR3700v2 is not struggling (top below 5% during a speed test with WiFi disabled).

If anybody knows how to implement the "vconfig set_egress_map" in UCI, I'd be interested :-)

Nice solution...

I thought Google TISP was a joke? http://archive.google.com/tisp/install.html


Can you still use your crapper?

LOL...

(Last edited by mys5droid on 20 Feb 2017, 17:32)

The discussion might have continued from here.