The kernel handles the three intermediate layers. The application layer is handled by the software program (which generates HTTP, FTP, SSH, etc. traffic) and the lowest level is left to the electronics on your network card. Technically, the TCP stack handles the TCP part, etc... those of you who used Windows 3.1 might remember trumpet winsock, which was the add-on stack for Win31 (which did not do native TCP/IP).
[SSH] [TCPHEADER|SSH] [IPHEADER|TCPHEADER|SSH] [ETHERNETHEADER|IPHEADER|TCPHEADER|SSH] etc.As a practical note, standard packet sizes are about 1500 bytes on ethernet, and the total header overhead is less than 50 or so bytes. Those of you who have Verizon DSL use something called PPPoE, which simulates a PPP connection over Ethernet (why they do that is a different issue... suffice it to say that it's a pain for users). Note that PPP and Ethernet are supposed to be the same layer, so you know have an extra layer of encapsulation that a straight Ethernet (or PPP) connection wouldn't have, thus forcing smaller packets on the application (14 bytes smaller, IIRC) to prevent fragmentation. It's also slower. Boo.
1000 0000 0000 0110 1110 1110 0100 0101If that doesn't make sense, review your binary. Now, let's say we want it to be on a classic class B address. We set the subnet mask to:
1111 1111 1111 1111 0000 0000 0000 0000Everything that lines up with a 1 is a network part, and everything that lines up with a 0 is a machine part. Easy, no? Now, what's 11111111.11111111.00000000.00000000 in decimal? It's 255.255.0.0.
But life ain't that easy. Capone's actual subnet mask is 255.255.255.240. Looks confusing, but let's see it in binary:
1111 1111 1111 1111 1111 1111 1111 0000Doesn't look so bad. Now we know that the first 28 bits are network, and the last 4 are machine. Thus, capone is on a subnet with (no more than) 2^4 = 16 machines.
Couple of points. First, all subnets are the form 111...100...0. Namely (if that didn't make any sense, which it didn't), the first digits are 1's, the rest are 0's. You can't have a 0 within the ones section, or a 1 within the 0 section. Therefore, the only possible decimals are 255 (8 1's), 254 (7 1's), 252 (6 1's), 248 (5 1's), 240 (4 1's), 224 (3 1's), 192 (2 1's), 128 (1 1), or 0 (all zeros). Class A is (by default) 255.0.0.0), etc.
If you're not having fun yet... try this. Technically, none of the above is completely true. Well, ok, it's mostly true.. just one tiny little lie. You see, there are two reserved addresses on any subnet... the first and the last. So if the network is 192.168.1.0/255.255.255.0, then 192.168.1.0 and 192.168.1.255 are reserved. If it's 192.168.1.0/255.255.255.192, it's 192.168.1.0 and 192.168.1.63. These are the network and broadcast addresses, respectively. Do a google search to find out what they do.
A few ssh things you should know... RSA/DSA is incredibly useful. These instructions only work for machines that run OpenSSH.. machines running SSH2 (the program, not the protocol) are slightly different. OpenSSH machines include engsoft, and remus/romulus. Eden is quirky, because it's a cluster, so you never know what machine you're getting.
Useful SSH options incluse -X (for X11 forwarding) and -c for compression. It's fun... play around.