You are here

Sharing internet connection from the LAN

28 posts / 0 new
Last post
kg9dw
kg9dw's picture
Sharing internet connection from the LAN

I've read up on using VLANs for segmenting the ethernet connection from a mesh node. I don't have a VLAN capable switch yet. I was looking through the help text and read that if the LAN connection has access to the internet, and that if Mesh Gateway is checked on, that the node will advertise to the mesh that it has internet access.

I tried this but was unsuccessful. Here's what I've got:

Node A is a mesh node with a Direct-5 lan.

Node B is a mesh node with a NAT LAN, ip of 192.168.1.150, mask of 255.255.255.0, and gateway of 192.168.1.1. WAN is disabled, and Mesh Gateway is checked on.

From a workstation on the LAN of Node A, I get a mesh ip address and can ping Node B. But Node A doesn't know how to forward anything out the internet...it doesn't think it has a default route. A traceroute from the workstation stops at Node A.

Is it only possible to share an internet connection using VLAN segmentation?

K5DLQ
K5DLQ's picture
correct.  On Ubiquiti devices

correct.  On Ubiquiti devices, you *MUST* have a VLAN capable switch configured properly to get access to the "WAN"/internet port.  The WAN port is virtual only (VLAN1).

so, when you enabled the "mesh gateway" option, you are advertising that this node a gateway to the internet, BUT, you not provided a VLAN1 for it to use.  Therefore, you have no internet.

You can pick up the Netgear GS105E for around $45 on eBay and they are very good.

Also, internet sharing is not a "normal" thing to do.  While it's possible, it's not normal.  None of my nodes have the "mesh gateway" option enabled.  If your node has a VLAN1 internet connection, *THAT NODE* can use the internet, but, will advertise it and provide the "internet" to other nodes on the mesh.  This is how my tunnel servers and clients operate.  They have VLAN1 internet, but, are NOT a gateway.

 

Darryl

kg9dw
kg9dw's picture
OK....but....

After a little more playing and verifying that I did have things configured and wired correctly,  I was able to get Node B to advertise that it had internet access, and I can see that it is able to talk to the internet because it updated its time. On Node A, the default gateway on the status page is automatically pointing to Node B (which is good!). I can now traceroute and get back to Node B, but then traffic stops. So Node B knows how to get to the internet, is using the internet, but it will not route traffic out for me. 

I don't mind picking up the switch - I was probably going to need it anyway, just was wanting to experiment a bit here since it appeared from the help text that this was possible without using VLANs.

kg9dw
kg9dw's picture
just a little more help please....

When you use the WAN interface via that VLAN to connect to the internet, does that mesh node then NAT all traffic from the MESH out the WAN interface? Or do I need to configure the router that sits between the mesh node and the internet to know about routes in the MESH?

My wireless internet provider uses 10.x addresses, which I then NAT to 192.168.1.x inside my network. If I give the WAN interface a 192.168.1.x address, will it NAT traffic from the MESH to my firewall...if it doesn't and I need to tell my firewall to route any 10.x addresses back to the mesh node, I'm in trouble. 

KG6JEI
All systems leaving the mesh

All systems leaving the mesh node (From the WLAN Mesh or from the node LAN) is nat masqurated to use the mesh node WAN IP address so all traffic will appear to come from the mesh node.

N4QWK
Switch

"On Ubiquiti devices, you *MUST* have a VLAN capable switch configured properly to get access to the "WAN"/internet port."

Do you need a VLAN switch on each end, and should they be managed or unmanaged? Thanks.

AE6XE
AE6XE's picture
The switch needs to support
The switch needs to support 802.1Q (the vlan spec)  to split out and have a port for the WAN interface of a mesh node and plug into a home network or internet.   It's best to have an 802.1Q switch if more than one node is plugged into the same switch, to separate the LAN networks of each mesh node.
kg9dw
kg9dw's picture
Ah...

...so that must be the problem I'm seeing. Since the WAN port is disabled in my configuration to enable the node to use the LAN's default gateway, NAT isn't working. Ok, this is making more sense now. I think some diagrams will be helpful. After my switch arrives this Thursday I'll be ready to rock.

The hardware for my third node arrived today and the tower sites are being confirmed. We should have the backbone ready in just a few weeks here in Central IL.

kg9dw
kg9dw's picture
Wrapping this up....

So my experiment didn't work based on the aforementioned reasons. Using a vlan capable switch, and following these instructions, I was able to configure a switch and share the internet connection. As a matter of fact, I'm typing this response using the mesh from a remote node. Yay!

http://ae5ca.com/?p=49

 

K5DLQ
K5DLQ's picture
awesome!  Glad you are up and

awesome!  Glad you are up and running.

VE9MDB
Can't get internet sharing to work...
I tried and tried ... but still can't make it working !  I just can't get internet to work thru the nodes.
Here is how I am set-up... 
Node A is at my home.
Node B is 1 km from my home.
Node A & B are linked together with two ubiquiti radios over standard wifi ... both location have a TP-link switch which support VLANs.
In MESH Status, I see Node A and B connected as dtdlink.
There is 2 nodes connected behind node A which are OTA.  Let name them C & D.
There is 3 nodes connected behind Node B, OTA (Over the Air), let name them E & F & G
On the network, any nodes can talk to any nodes... they can ping each other, there is no routing problems,
Node A and Node B can have a WAN ... they are both on the same LAN and have the same gateway.
Node A LAN IP is 172.20.0.100 and Node B LAN IP is 172.20.0.200 and the gateway is 172.20.0.1 ... since they are connected with the ubiquiti link they are basically on same network ... and that explain the DTDLink.  Geographically it is not possible to have a air link over mesh between these two nodes and that's why I have a private link between them to connect two mesh network together.

now ...  each node get the nearest WAN gateway properly.  But they can't ping on the internet !  I can't use the time server or any function  ( like uploading position to AREDN network ) because it say "ERROR: Cannot update online map. Please ensure this node has access to the internet.".

Any clue ?  Is it something to do with VLAN or is it something else I've missed ?
I have "Disable Default Route" activated...

Thanks for  help !
VE9MDB
K5DLQ
K5DLQ's picture
How is your TP-Link switch
How is your TP-Link switch configured?  Can you share those details?
(I do recall that there was at least one TP-Link switch that could not use VLAN1 (WAN) due to internal restrictions of the switch.  I think it used VLAN1 as the management VLAN and you could not change that setting.)
 
VE9MDB
Hi K5DLQ,
Hi K5DLQ,

The TP-Link switch aren't configured ... but once I installed them, I was able to have DTD working between the two sites.
However, you might be right,  I can't tag VLAN1 on any ports.
The hardware version of my tp-link is : TL-SG108E 2.0

Is there a way I can bypass this ... somehow ?
 
kg9dw
kg9dw's picture
May not a switch issue since
May not a switch issue since they are both getting ip addresses and gateways that lead them to the internet. Have you gotten into the command line on the nodes and done a traceroute or ping from there? And do pings using ip addresses work (try ping 8.8.8.8). ssh to port 2222 and use root as the user and your mesh node password as the password.

This should be fixable, we just need a few more pieces of information!
VE9MDB
traceroute
Hi KG9DW,

Yes, the ping command and traceroute command works on both node perfectly ... !

Here is a copy/paste :

root@VE9MDB-FN76NE-MAARC:~# traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 38 byte packets
 1  172.20.0.1 (172.20.0.1)  13.429 ms  10.219 ms  4.381 ms
 2  192.168.0.1 (192.168.0.1)  19.177 ms  12.616 ms  9.114 ms
 3  *  *  *
 4  69.63.254.209 (69.63.254.209)  20.123 ms  44.295 ms  26.071 ms
 5  24.156.147.33 (24.156.147.33)  18.301 ms  13.121 ms  27.486 ms
 6  van58-9-229-241.dynamic.rogerstelecom.net (209.148.229.241)  64.568 ms  54.574 ms  53.479 ms
 7  van58-9-229-225.dynamic.rogerstelecom.net (209.148.229.225)  42.891 ms  53.156 ms  55.869 ms
 8  van58-9-230-14.dynamic.rogerstelecom.net (209.148.230.14)  43.838 ms  39.032 ms  39.712 ms
 9  72.14.222.87 (72.14.222.87)  50.370 ms  51.397 ms  54.021 ms
10  216.239.43.231 (216.239.43.231)  39.128 ms  209.85.255.197 (209.85.255.197)  65.594 ms  44.015 ms
11  108.170.234.15 (108.170.234.15)  41.762 ms  108.170.234.33 (108.170.234.33)  65.977 ms  108.170.234.37 (108.170.234.37)  52.734 ms
12  google-public-dns-a.google.com (8.8.8.8)  47.977 ms  49.479 ms  37.564 ms

So, my current gateway is 172.20.0.1 and it is a router located 1 km from my qth, where the physical router ( 192.168.0.1 ) is located.  I get my internet from there and send it to my QTH....

73
Matt - VE9MDB
VE9MDB
traceroute from distant
Also, here is a traceroute from another node of the mesh network :
root@VE9UDM-MAARC-Nano:~# traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 38 byte packets
 1  VE9SHM-FN76ND-TCARC.local.mesh (10.0.0.10)  6.175 ms  2.316 ms  2.504 ms
 2  VE9SHM-FN76ND-TCARC.local.mesh (10.0.0.10)  2.652 ms  1.530 ms  1.405 ms


as you can see, it stop at one of the Mesh internet gateway ( VE9SHM ) ... and doesn't get out to Internet ( next expected hop should be 172.20.0.200 and then 172.20.0.1 and then 192.168.0.1 IMO )...

Matt
KG6JEI
Please attach a support data

Please attach a support data file from the gateway nodes so that the members of the forum can better provide answers to this question.

VE9MDB
I need to know what you're
support data in the following message...
VE9MDB
Support Data

Here is the support data....

 

Support File Attachments: 
KG6JEI
Not sure if we count this as
Not sure if we count this as a program bug or a documentation bug.

I would suggest you open a bloodhound ticket (http://bloodhound.aredn.org) on it so it can be moved into an official track for a resolution decision.

Dev notes:
No masquerade is currently occurring from MESH to LAN when destination is Internet. Without masquerade or configuration on gateway router it's likely that the packets are not making the correct return path because the home router is likely routing the packets the wrong way not knowing that 10.0.0.0/8 and 172.16.0.0/12 need to go to the mesh node.


 
VE9MDB
masquerade ?
I don't know if it may help or not... but this is my route from the router ...

[root @ Router] ~ # route
Table de routage IP du noyau
Destination     Passerelle      Genmask         Indic Metric Ref    Use Iface
10.0.0.0        172.20.0.100    255.0.0.0       UG    0      0        0 eth0
172.20.0.0      *               255.255.0.0     U     0      0        0 eth0
172.20.1.0      *               255.255.255.0   U     0      0        0 eth0
172.20.5.0      *               255.255.255.0   U     0      0        0 eth0
172.20.10.0     *               255.255.255.0   U     0      0        0 eth0
172.20.20.0     *               255.255.255.0   U     0      0        0 eth0
172.20.255.0    *               255.255.255.0   U     0      0        0 eth0
192.0.2.0       *               255.255.255.0   U     0      0        0 utun
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.1     *               255.255.255.255 UH    0      0        0 eth1

The router is an untangle box but I did deactivate the dhcp and dns server from it to run my own ...
My first idea was to have VLAN on it but then I realized that it would be too complicated since I have multiples clients running from multiple points.

Can I do something on the router side to make it working ?

Matt  - VE9MDB
VE9MDB
iptables
And here is the iptables rules from the router...

[root @ Router] ~ # iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
uvm-tcp-redirect  tcp  --  anywhere             anywhere            [goto]  /* Redirect utun traffic to untangle-vm */
port-forward-rules  all  --  anywhere             anywhere             ctstate NEW /* Port Forward rules */

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
nat-rules  all  --  anywhere             anywhere             ctstate NEW /* SNAT rules */

Chain l2tp-forward-rules (1 references)
target     prot opt source               destination

Chain nat-rules (1 references)
target     prot opt source               destination
MASQUERADE  all  --  anywhere             anywhere             mark match 0x1fa/0xffff /* NAT WAN-bound openvpn traffic */
MASQUERADE  all  --  anywhere             anywhere             connmark match  0xfb/0xff /* NAT l2tp traffic */
RETURN     all  --  anywhere             anywhere             policy match dir out pol ipsec /* dont NAT IPsec traffic */
RETURN     all  --  anywhere             anywhere             /* Never NAT loopback traffic */
RETURN     all  --  anywhere             anywhere             /* Never NAT loopback traffic */
MASQUERADE  all  --  anywhere             anywhere             connmark match  0x102/0xffff /* NAT traffic, 2 -> 1 (egress setting) */
MASQUERADE  all  --  anywhere             anywhere             connmark match  0x102/0xffff /* NAT traffic, 2 -> 1 (ingress setting) */
MASQUERADE  all  --  anywhere             anywhere             ctstate DNAT connmark match  0x101/0xffff /* NAT all port forwards (hairpin) (interface 1) */
MASQUERADE  all  --  anywhere             anywhere             ctstate DNAT connmark match  0x202/0xffff /* NAT all port forwards (hairpin) (interface 2) */

Chain port-forward-rules (1 references)
target     prot opt source               destination
l2tp-forward-rules  all  --  anywhere             anywhere             /* Port forward jump for L2TP */
DNAT       tcp  --  anywhere             172.20.0.1           tcp dpt:10001 /* Send 172.20.0.1:10001 to Apache */ to:172.20.0.1:80
DNAT       tcp  --  anywhere             172.20.0.1           tcp dpt:https /* Send 172.20.0.1:443 to Apache */ to:172.20.0.1:443
DNAT       tcp  --  anywhere             192.168.0.100        tcp dpt:https /* Send 192.168.0.100:443 to Apache */ to:192.168.0.100:443
DNAT       tcp  --  anywhere             anywhere             /* Port Forward Rule #1 */ connmark match  0x1/0xff multiport dports http to:172.20.0.5:80
DNAT       tcp  --  anywhere             anywhere             /* Port Forward Rule #2 */ connmark match  0x1/0xff multiport dports 5525 to:172.20.0.100:5525
DNAT       udp  --  anywhere             anywhere             /* Port Forward Rule #5 */ multiport dports 8443 to:172.20.0.5:8443
DNAT       tcp  --  anywhere             anywhere             /* Port Forward Rule #5 */ multiport dports 8443 to:172.20.0.5:8443
DNAT       udp  --  anywhere             anywhere             /* Port Forward Rule #6 */ multiport dports 8888 to:172.20.1.10:80
DNAT       tcp  --  anywhere             anywhere             /* Port Forward Rule #6 */ multiport dports 8888 to:172.20.1.10:80
DNAT       udp  --  anywhere             anywhere             /* Port Forward Rule #7 */ multiport dports 8889 to:172.20.1.20:80
DNAT       tcp  --  anywhere             anywhere             /* Port Forward Rule #7 */ multiport dports 8889 to:172.20.1.20:80
DNAT       udp  --  anywhere             anywhere             /* Port Forward Rule #9 */ multiport dports 30053 to:172.20.0.25:30053
DNAT       tcp  --  anywhere             anywhere             /* Port Forward Rule #9 */ multiport dports 30053 to:172.20.0.25:30053
REDIRECT   tcp  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL tcp dpt:https /* Drop local HTTPS traffic that hasn't been handled earlier in chain */ redir ports 0
REDIRECT   tcp  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL tcp dpt:http /* Drop local HTTP traffic that hasn't been handled earlier in chain */ redir ports 0

Chain uvm-tcp-redirect (1 references)
target     prot opt source               destination
DNAT       tcp  --  anywhere             192.168.0.100        /* Redirect reinjected packets to 192.168.0.100 to the untangle-vm */ to:192.168.0.100:9500-9627
DNAT       tcp  --  anywhere             172.20.0.1           /* Redirect reinjected packets to 172.20.0.1 to the untangle-vm */ to:172.20.0.1:9500-9627
DNAT       tcp  --  anywhere             172.20.1.1           /* Redirect reinjected packets to 172.20.1.1 to the untangle-vm */ to:172.20.1.1:9500-9627
DNAT       tcp  --  anywhere             172.20.10.1          /* Redirect reinjected packets to 172.20.10.1 to the untangle-vm */ to:172.20.10.1:9500-9627
DNAT       tcp  --  anywhere             172.20.5.1           /* Redirect reinjected packets to 172.20.5.1 to the untangle-vm */ to:172.20.5.1:9500-9627
DNAT       tcp  --  anywhere             172.20.20.2          /* Redirect reinjected packets to 172.20.20.2 to the untangle-vm */ to:172.20.20.2:9500-9627
DNAT       tcp  --  anywhere             172.20.255.1         /* Redirect reinjected packets to 172.20.255.1 to the untangle-vm */ to:172.20.255.1:9500-9627
REDIRECT   tcp  --  anywhere             anywhere             /* Redirect reinjected packets to the untangle-vm */ redir ports 9500-9627
KG6JEI
As I step back and think more
As I step back and think more on t the issue is probably even bigger than what I quick noted. I don't think there is anything you can do on router to make this work (other than using the WAN port on VLAN 1) and this ultimately needs a ticket to be opened before any further discussion or progress can be made.
VE9MDB
It's working ! with some mods...
Hey .... I got it working.  I know, it is not 100% secure but it is now working.
Here is what I did.  On the Mesh Gateway ( WAN )  I did use the following commands to get it working :
  • iptables -P INPUT ACCEPT
  • iptables -P FORWARD ACCEPT
  • iptables -P OUTPUT ACCEPT
  • iptables -t nat -F
  • iptables -t mangle -F
  • iptables -F
  • iptables -X
Thus allowing all forwarding to occurs ... 

Of course .. it's not the way it should be working but I'll write a script and have it handy on the node in case it is rebooting and that I need to enable the gateway again...

73 for now ...  Oh, and by the way, I opened a ticket ... #184.

Matt - VE9MDB
kg9dw
kg9dw's picture
Good deal Matt. Way to keep
Good deal Matt. Way to keep at it, and thanks for opening a ticket for the Devs. Happy Meshing!
VE9MDB
Additionnals notes
Okay ... 
So just in case somebody want to do the same thing ... 

I have to say that I've added a route back to the 10.x.x.x network from the router ... 
When I browse my internal network from the mesh network, I see myself with the IP of the mesh node I'm from ... so that's why we know mesquarade is not working.  However, with the proper route set into the router, the network know how to answer back to the local node and back on the mesh.

Also ...  I've not used the WAN port at all ...   just to make it clear, I've just set up a gateway onto the LAN configuration of the mesh node .... and then activated the mesh gateway so it is advertised onto the mesh network.
The problem is at the way it is handling mesh traffic to the default route.  If you use the commands I posted, you will clean the iptables and make the ip forwarding working.  However, the IP seen outside will remain 10.x.x.x  so to have it working you need the router to know how to answer it back through the mesh node gateway.

This could cause a problem if you're trying to use an internal DNS ..  and at the moment we are using an external DNS ( 8.8.8.8 & 8.8.4.4 ) as the 10.x.x.x is not allowed into my own DNS server ( I haven't configured it yet to allow this traffic ).

This was a hard learning .... :)  But I'm so happy it is finally ready for our mesh demo which will be held in October !
73 and again thanks for your help and tips ... without knowing there was a problem with mesquarade, I wouldn't have looked further !

Matt - VE9MDB
AE6XE
AE6XE's picture
I'm coming late to this party
I'm coming late to this party...  It sure looks to me like you've been very creative in figuring out a way to get this somewhat working and doing so in an unintended or not pre-designed way.   I can see now that the default route advertised across the mesh is coming from the WAN definition in the AREDN configuration.  It really should be a bug that if the WAN interface is turned off, we should not be advertising it as a gateway.     But then, the mesh node's LAN interface definition happens to conflict with the WAN network definition (typically destructive if the WAN was live).  Thus the default routing (the 'bug') is getting traffic to the LAN interface of the node for this to work.
 
To sit back and design what you are trying to, we'd unlikely engineer it this way.  Right now the LAN configured in NAT mode is masquerading the IP address in the wrong direction that you are going--you are breaking these firewall rules to get it to work in the opposite direction.  Masquerading basically means we add an SNAT rule.   The current design just does this in the opposite direction.

I think this is an enhancement request to add to the LAN configuration to have 3 options instead of 2:

1) Mesh mode:  standard 10.x.x.x  devices directly on the mesh  <- we have today with the 1, 5, 13 address allocations
2) Protected from the Mesh mode:  private address space 172.16.x.x or 192.168.x.x and devices are protected from the mesh <- today's 'NAT' option
3) Connect to and protected from the Internet mode:  private address space, fully and directly routable from the mesh, but NAT'd and protected from the internet <- new option  (and could still work with a live WAN interface to yet another foreign network)

We just have to setup the appropriate and right firewall rules to meet these 3 very different requirements.  So I think this is both a bug and an enhancement request...

Joe AE6XE
KG6JEI
A reminder that  a ticket has
A reminder that  a ticket has been opened for this issue, all technical analysis should be supplied in the ticket to ensure it is considered as part of the case.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer