Answer the question
In order to leave comments, you need to log in
How to merge local networks on linux?
Hello.
You need to combine 3 VLANs on virtual machines.
Created 3 NAT networks in vitrualbox. Hosts and routers are machines with a server ubuntu.
To start, I collect a network diagram in gns3, in the settings of machines in virtualbox, the hosts have the first adapter "not connected" (for working in gns), the second one has its own nat network for each of the hosts, the first 2 adapters are "not connected" for routers, the third - nat network (10.х.х.х) I start
, assign ip addresses to machines as in the image above (ip addr add), hosts to enp0s3 interfaces, routers have one ip (192.168...) on enp0s3, another on enp0s8.
For routers, I allow packet forwarding in /proc/sys/net/ipv4/ip_forward
At this stage, the routing table is empty.
I'm trying to add a route on the router ip route add 10.26.0.0/24 via 192.168.27.1, I get something like file exists.
Via ip route add deafault via 192.168.27.1 - network is unreachable.
I tried to describe my actions and results in as much detail as possible. I understand that I am doing something wrong, but I can not understand where and what.
I would be very grateful if you wrote how to fulfill my plan. And also, what to read for complete beginners on networks, routing, etc.
Answer the question
In order to leave comments, you need to log in
I solved it like this
Routes on hosts:
default via 192.168.26(7).1 dev enp0s3
192.168.26(7).0/24 dev enp0s3 scope link
10.26.0.0/24 dev enp0s8 scope link
192.168.26.0/24 dev enp0s3 scope link
192.168.27.0/24 dev enp0s3 via 10.26.0.2 dev enp0s8
10.26.0.0/24 dev enp0s8 scope link
192.168.27.0/24 dev enp0s3 scope link
192.168.26.0/24 dev enp0s3 via 10.26.0.1 dev enp0s8
NAT is definitely not needed here, everything is decided by prescribing routes.
On extreme machines, it is enough to register default routes through the corresponding routers.
On routers, you need to register a route to each network, for example, on the left router, you need to register the route ip route add 10.27.0.0/24 via 10.26.0.2, and on the right, respectively, ip route add 10.26.0.0/24 via 10.26.0.1
As option to use any protocol of dynamic routing? Alya rip, ospf?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question