Sagar Acharya <sagaracharya_AT_disroot.org> wrote:
> I tried so much to find resources on learning networking and routing. I still couldn't find any. ip man page is about implementation of several RFCs.
For the theory, you could read the introduction chapter of
Computer Networks by Tanenbaum (less than 80 pages for the intro):
https://csc-knu.github.io/sys-prog/books/Andrew%20S.%20Tanenbaum%20-%20Computer%20Networks.pdf
For the practical aspects, what you could look for is iproute2 (the name
of the project) rather than just "IP" (the name of the command),
which might yield you a bit of everything given how short the name is...
For instance, this one has some short overview of some of its usage
(skip anything like 'ip rule') this page alongwith the few "Next >"
ones that follow:
https://www.lartc.org/howto/lartc.iproute2.html
The Wikipedia page has some short overview, of a few useful commands:
https://en.wikipedia.org/wiki/Iproute2
This one is a more complete guide oriented towards a lot of operations.
You might not need everything, but if you need to do *something* this
is where to look at.
https://www.baturin.org/docs/iproute2/
Remember: if you use the ip command directly and do not write things to a file,
things will be temporary, you can reboot to get a fresh environment.
> It's at eth1. Initially, do I have to flush settings pr clear those of eth1? How do I enable this on startup?
There are various ways to setup this at boot time, and an easier way
> Is the setup below like that of host 1 as a master and host 2 as slave? Which port will the network work on?
Master/Slave is present in many locations in hardware,
but for networking, things tends to be a bit more symmetrical:
only nodes: a typical home ISP internet modem/router is often
*both* a DHCP server and DHCP client.
Everything can be called a "computer".
Some computers have a very boring role: "routers", they cannot
be used to play video games like DooM (unless you try hard enough! :P)
but usually only forward the traffic from one end to the other end.
But any "personal" or "user" device can be turned into a router!
For instance, a phone is typically a DHCP client device (receives
an Internet connection from WiFi or LTE), but you can turn on
WiFi or USB tethering and suddenly it is a DHCP server, and acts
as a router!
A "network" is the imaginary area *between* several interfaces
(such as wlan0 and eth0 and eth1). And a computer can be part
of two networks: If you have both WiFi and Ethernet, your
WiFi interface (wlan0) will be in the WiFi network (for instance
192.168.1.0/24) and your Ethernet interface (wlan0) will be in
the Ethernet network (for instance 192.168.2.0/24).
So interesting thing to realize when doing networking, is that
IP addresses are put onto *interfaces* rather than *network*
Remember "ip addr add 192.168.43.1/24 dev eth0"? Notice how
the device (= network interface) was specified?
See how "ip addr show" the IP addresses are listed under each
*network interface* rather than all along for one computer?
This is really this: addresses are added to network *interfaces*.
More on a next episode :) (I need to go back to work)...
> Say I wget host_1_public_ipv4:80 , will it reach host 2?
Once static routing is setup, then yes, although your host 2 will
need some software listenning on port 80 for that to work.
What I propose is to run the ping command on one side,
and tcpdump on the other to see the traffic.
Then even if you have something misconfigured, you might still be
able to deduce what is going wrong thanks to tcpdump.
> Thanking you
> Sagar Acharya
>
> On 5 October 2023 7:55:25 pm IST, Josuah Demangeon <me_AT_josuah.net> wrote:
> >Hello Sagar Acharya,
> >
> >Let me know if I misunderstood, but I believe you are mixing two things:
> >
> >If you have a cat6 ethernet cable, then you likely already have a network card.
> >You do not need DHCP to get two computers communicate, you can use static addressing, which is easier to use than DHCP.
> >
> ># on host 1, as user "root", assuming your network interface is "eth0"
> >ip link set eth0 up # turn it on
> >ip addr add eth0 192.168.34.1/24 dev eth0 # put an address on it
> >ip addr show # review the configuration
> >
> ># on host 2, as user "root", assuming your network interface is "eth0"
> >ip link set eth0 up # turn it on
> >ip addr add eth0 192.168.34.2/24 dev eth0 # put an address on it
> >ip addr show # review the configuration
> >
> >I used 34 as subnetwork, but you can use anything else.
> >If you have just a few computers, you can manage the addresses like above.
> >a bit more manual work, but much less effort to debug.
> >
> >But you can also use sdhcp (as an example) so that you have fewer
> >operations to do manually.
> >
> >You would need a DHCP server on one host (acting as a router),
> >and a DHCP client (such as sdhcp) on the other host.
> >
> >Sagar Acharya <sagaracharya_AT_tutanota.com> wrote:
> >> How to use sdhcp? Can it be used to create an internal network where a cat6 cable is connected via /dev/ttyS1 to another PC.
> >> Is it possible to run a daemon which provides network in system 1 to the one connected across /dev/ttyS1?
> >
> >If you want to use networking out of a serial console, such as /dev/ttyS1,
> >you would need something like pppd (point-to-point daemon)
> >https://linux.die.net/man/8/pppd
> >
> >Which would provide something acting like Ethernet,
> >but out of a serial cable instead of a cat6 cable.
> >
> >Best luck with your experiments!
> >
Received on Thu Oct 05 2023 - 23:00:28 CEST