Go Down

Topic: TCP/IP networking - seeking the wizards of smart. (Read 461 times) previous topic - next topic

JMeller

Oct 08, 2017, 08:38 pm Last Edit: Oct 09, 2017, 01:24 am by JMeller Reason: Copy/Paste error in .doc
A friend/colleague and I are searching for networking knowledge to be implemented in our arduino devices.  I've been able to search and condense what I believe is to be correct.  Any helpful insight (layman terms and/or links) would be appreciated.

Knowledge thus far: TCP_IP.doc attached.

Thank you in advance.



Robin2

If this is a serious request maybe this Bar Sport section is not appropriate?

On the assumption that it does belong here then does TCP stand for tom cat's pee?  That's what it was when I was small.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

JMeller

#2
Oct 09, 2017, 12:13 am Last Edit: Oct 09, 2017, 01:24 am by JMeller
If this is a serious request maybe this Bar Sport section is not appropriate?
True; since the question wasn't specifically arduino related, I felt uncomfortable placing it in the networking  forum.  Therefore, humor mixed with specifics appeared to be the better option.   ;)

- IP Freely

Robin2

#3
Oct 09, 2017, 08:30 am Last Edit: Oct 09, 2017, 08:32 am by Robin2
- IP Freely
I'm older

- IP Nightly





...R
PS. There is a "General Discussion" section
Two or three hours spent thinking and reading documentation solves most programming problems.

westfw

Your document describes the old class a/b/c ip address formats for IP networks.
That is:
  • Obsolete.  IP networks have been mostly "classless" for a couple of decades now.  https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing  (home networks tend to all look like 192.168.1.h "class C" or /24 networks, but there's A LOT going on between them and the Internet as a whole...)
  • Not really relevant to arduino class devices or programming, anyway.  You'll either be connection to an existing net where you'll have to use their addressing scheme (probably via addresses and masks assigned by the bootp protocol), or off in a sandbox where  you might as well be net 10 (ARPANet!)


Quote
Any helpful insight (layman terms and/or links) would be appreciated.
The actual technical specifications for the various internet protocols (the IETF "RFCs") are unusually readable and understandable, compared to most specifications.   And there are surely by now MANY books on the subject (although I have no idea what is considered a reasonable "beginner" text, anymore.   It used to be Comer, but he was essentially first, and I don't know whether something better or "more current" has come along.
What use are you actually expecting your document to be useful for?  Almost all of the current "hobbyist" stuff is "use the TCP/IP implementation built into your WizNet or ESP chip, and create application-level stuff like web pages and json"  (which are text-like.  A lot of the internet protocols (Mail, Web, file transfer) end up being human-readable "on the wire", which is ... nice.)

JMeller

I'm older
- IP Nightly
...R
PS. There is a "General Discussion" section
Will do "General Discussion" on next inquiry.

What use are you actually expecting your document to be useful for?  Almost all of the current "hobbyist" stuff is "use the TCP/IP implementation built into your WizNet or ESP chip, and create application-level stuff like web pages and json"  (which are text-like.  A lot of the internet protocols (Mail, Web, file transfer) end up being human-readable "on the wire", which is ... nice.)
west,
Thanks for the for reply.

Just as you indicated, I have had success with the ESP and json for downloading weather and the controlling of my smart bulbs - with help from a json library created by others. 

My friend and I had basic knowledge of TCP/IP from an occupational standpoint and desired more in depth knowledge since we were working with ESPs as hobby.  We wanted to understand how to communicate across different network identifiers and the logic behind it - hence, my doc.  Armed now with a little more knowledge, we were going to create a /26 to have the capability of 4 separate networks with in our domicile; no reason; no rhyme; only to have a better understanding.  Granted, there is WAY more to it; we just desired more of a foundation (and any help from my fav learning community along the way).

Meanwhile, Robin probably made two visits to the salle de bains while reading this. ;)





westfw

Quote
we were going to create a /26 to have the capability of 4 separate networks with in our domicile
You understand that that means you need a router (at least one, with 4 ports) to go between them, right?  Probably in addition to the router you already have between your ISP and your home network and your wireless...  I'm not sure if the common "consumer" routers support putting a different net on each ethernet port or equivalent.  Internally they tend to have a single ethernet Mac connected to an ethernet switch "fabric" that they make into pseudo-interfaces (to handle WAN vs LAN), but they might "typically" be limited to two of those...

JMeller

You understand that that means you need a router (at least one, with 4 ports) ...
Yes sir.  I have a 4 port (w/wireless) router on the main floor connected to my 4 port (w/wireless) ISP router via Zyxel powerline ethernet pass-thru power adapters; amazing product by the way.  No drilling holes in my vintage house to facilitate fast streaming to my entertainment center!  I digress. The two routers will be the gateway for two of the (future) four networks.


msssltd

You understand that that means you need a router (at least one, with 4 ports) to go between them, right?  Probably in addition to the router you already have between your ISP and your home network and your wireless...  I'm not sure if the common "consumer" routers support putting a different net on each ethernet port or equivalent.  Internally they tend to have a single ethernet Mac connected to an ethernet switch "fabric" that they make into pseudo-interfaces (to handle WAN vs LAN), but they might "typically" be limited to two of those...
The single MAC address has nothing to do with routing.  MAC addresses are a feature of Ethernet, which is a layer 2 protocol.  Routing is a Layer 3 function, independent of layer 2.  i.e. You could be routing between SLIP interfaces on RS232.

However.  Essentially you are right.  Most domestic routers have only one routing table.  The WiFi and Ethernet switch are bridged at layer2, as a single routing interface with a single IP address.  You can still route via the bridge IP, by assigning connected nodes with a /32 subnet mask - A subnet containing a single host.

If you want to mess around with this stuff, buy a Ubiquiti Edge Router X, about the most affordable 'proper' router on the market.  5 ports, all fully configurable, all can be assigned multiple IP addresses, Less than a hundred quid.


JMeller

#9
Oct 17, 2017, 11:49 pm Last Edit: Oct 18, 2017, 12:03 am by JMeller
... Most domestic routers have only one routing table.  The WiFi and Ethernet switch are bridged at layer2, as a single routing interface with a single IP address.
...If you want to mess around with this stuff, buy a Ubiquiti Edge Router X, about the most affordable 'proper' router on the market.  
Thanks for the added info. I checked my WiFi/Ethernet switch; it appears to support multiple tables(pic attached).


As a simple test, I took a known good connection from the my cellular network to access my NVR and changed the IPs (Class A) type and the submasks (Class C).

Setup Downstairs(/25) [IP;submask;gateway]:
WiFi/Ethernet router(Big Box store type): 10.6.6.130; 255.255.255.128; Internet Ethernet connection Static(10.6.5.86; 255.255.255.128; 10.6.5.75)
NVR: 10.6.6.150; 255.255.255.128; 10.6.6.130
All other clients DHCP between .131 to .178 (/25)

Setup Upstairs (/25):
ISP WiFi/Ethernet: 10.6.5.75; 255.255.255.128
All other clients DHCP between .76 to .99 (/25)

I can access the internet from the downstairs WiFi/Ethernet router; when connected to the downstairs WiFi, I can also access the NVR. However, I cannot access the NVR from the upstairs PC (Ethernet via ISP Ethernet port); nor can I access the NVR from a cellular connection after changing the setup.

Realizing this problem is not specifically arduino related and I have seemingly bitten off more than I can chew, perhaps it is better to let this thread die.  However, if you see something painfully obvious which requires little of anyone's time to explain, I'd greatly appreciate the education; otherwise, I'll continue my google education journey.




msssltd

Thanks for the added info. I checked my WiFi/Ethernet switch; it appears to support multiple tables(pic attached).
No it doesn't(!)  You are confusing IP addresses with routing interfaces.  Your screenshot shows a single routing table containing several routes [records].

Quote
As a simple test, I took a known good connection from the my cellular network to access my NVR and changed the IPs (Class A) type and the submasks (Class C).
Stop with the Class A, Class C, nonsense.   Class based routing has been obsolete for almost twenty years.  All IPv4 routing today uses Classless Internet Domain Routing (CIDR).  CIDR addresses are written IP/mask bits, 1.2.3.4/32 for instance.

Quote
Realizing this problem is not specifically arduino related and I have seemingly bitten off more than I can chew,
I can give you a routing configuration which should work, off the top of my head, in a couple minutes.  To educate you, would take far, far longer.  A proper education starts with the OSI 7 layer model.  Suffice to say  that an IP network is not just a matter of plugging in cables, picking numbers randomly and expecting it all to work [1].

Code: [Select]



Internet---[WAN | Router1 |LAN 192.168.0.1/24 ]---[192.168.0.2/24 WAN| Router2 |LAN 192.168.1.1]---


Router1
WAN: PPP
Gateway: ISP

Routing Table
Destination Interface Gateway
0.0.0.0/0 WAN ISP
192.168.1.0/24 LAN 192.168.0.2

DHCP
Start: 192.168.0.64
End: 192.168.0.126
Mask: 255.255.255.0
Router: 192.168.0.1


Router2
WAN: 192.168.0.2/24
Gateway 192.168.0.1
LAN: 192.168.1.1/24

Routing Table
Destination Interface Gateway
0.0.0.0/0 WAN 192.168.0.1

DHCP
Start: 192.168.1.64
End: 192.168.1.126
Mask: 255.255.255.0
Router: 192.168.1.1


Caveat:  Routing configuration takes you up to L3.  ISP routers have integrated NAT and firewall functionality, which is at L7.  Some ISP routers allow their NAT and the firewall functions to be defeated, and some do not.  Some ISP routers are dumbed down so much, a monkey can not break the configuration.

westfw


Quote
Most domestic routers have only one routing table.
Most routers, period, have a single routing table.
The routing table, in its simplest form, maps from a destination IP address to a "next hop" IP address, and each interface needs to have an IP address so that the router can be the "next hop" for incoming traffic as well.  So on a typical 5-port router, you'd have a configuration that looked like:

Quote
interface 0
 ip address 1.1.1.1/28
interface 1
 ip address 2.1.1.1/28
interface 2
 ip address 3.1.1.1/28
interface 3
 ip address 87.123.45.97/8   ;; ISP-provided WAN link
It would receive a packet on interface 2 destined to, say, 4.1.1.19, find an entry in the routing table that says "net 4/28 is reachable by the next hop router 3.1.1.3", and therefore decide to forward the packet out of interface 2.
The key configuration command to look for is being able to treat each ethernet port as a separate interface (ie, be able to assign a separate IP address.)   MOST consumer routers seem to have only have "WAN" and "LAN/Wireless" interfaces (where the LAN/Wireless has multiple ports (bridged) plus the wireless, but only a single IP network.)
Quote
The single MAC address has nothing to do with routing.
I wasn't talking about a single Mac address.  I was taking about a single MAC, which is what microcontroller vendors call their ethernet controllers.   Typically there's a VLAN switching fabric in between the single MAC and the actual ports, that MIGHT be configurable as "put jack 0 in vlan0 (WAN), jack 1 and 2 in vlan1 (LAN) and jack 3 and 4 in vlan2 (AnotherLAN)", but that capability is usually not exposed to the users.  Running one of the linux-based firmware substitutes (dd-wrt, Openwrt, tomato, etc) might give you more flexibility.  (https://www.flashrouters.com/blog/2015/04/06/what-is-a-vlan-how-to-setup-vlan-ddwrt/)

JMeller

msssltd,
lol- classes are obsolete(x2); apparently one of 10 ways to get under the skin of IT experts.

Thank you for the time invested in your reply and explanations.  By dumb luck, I was able to communicate across my network with /24 before initiating this thread.  My interest piqued when I read /25,  /26 etc.  After reading, I thought I a fairly good foundation- obviously not the case. 

I'll take the info from this thread and use it to apply to my future reads.

Due to my inept IP understanding, thread is closed.


westfw

Quote
After reading, I thought I a fairly good foundation- obviously not the case. 
the original class a/b/c stuff isn't THAT bad of a foundation.  The principal of dividing the 32 address into part "network" and part "host within a network" is pretty fundamental, regardless of the exact mechanism used for determining where the boundry is.
With the "evangelist" hat on, we should make you skip IPv4 entirely and get on with IPv6.  (Except, v6 is not supported by WizNet chips...)

Go Up