I wanted to make this network fully connected, so I need to assign IP addresses to all interfaces of routers and to all hosts. However, I should assign a default gateway address to every host, but, how am I supposed to do that for PC0 host, as it is connected to switch, and the switch is connected to two routers, is this maybe a situation where default gateway is not required? Or is there something else that I should do here? Any help appreciated!
Because you have not a star-shaped network, you have to define a route to reach each network.
Your routes can be :
192.168.2.0/24 via 192.168.1.254 Default via 192.168.1.253
192.168.2.0/24 via 192.168.1.254 10.0.1.0/30 via 192.168.1.253 192.168.3.0/24 via 192.168.1.253
Default via 192.168.1.254 10.0.1.0/30 via 192.168.1.253 192.168.3.0/24 via 192.168.1.253
Depending on what part of your network you consider as "outside" from PC0.
The other solution is to connect PC0 to 192.168.1.0/24 via a router and set default route to it and theses routing tables will be on this router.
You say you "should assign a default gateway address to every host", but there is no requirement to do this.
Instead, a host only needs to have routes for every host it needs to connect to. In your particular network, there are 10 IP addresses (assuming a management address for the switch). Which means that the host PC0 could have nine host routes and no other routes at all. Or alternatively any method of aggregating them, as suggested in the other answer.
A host only needs a default route if it needs the potential to send packets to every host in its network. Of course, most hosts are in the internet, and so the number of potential hosts is enormous, so we make use of default routes.
In your particular network, you could put a default route on PC0 to one of its two connected routers, and have that router forward if it has a full-enough routing table. This is often considered bad routing as it's certainly non-optimal for the packet. But it's sometimes seen in networks where simplicity of management is more important that packet efficiency.
It's worth noting that the "core" of the internet is widely considered to be the "default-free zone": a subset of the internet where no router has a default route. Instead, they have routes to every known public network. (And, it can be assumed, the private networks of their operators.) Wikipedia article.
[EDIT] There are a couple of questions overlapping here.
- Default routes are not in themselves important: what's important is whether the routing tables of the devices have routes for everything, and whether they are good routes.
- It's uncommon for end-user computers to have more sophisticated routes than simply a single default route, typically acquired by DHCP. It's very common for routers to have complex, often dynamic, routing tables.
If your constraint is that PC0, 1 and 2 have only a single default route, and the routers have the minimal number of routes, then the usual way is to ensure that all routers have full connectivity for all addresses of interest. Then point all hosts at any locally attached router.
There are a lots of ways of solving the routing for the three routers in a row, but here's one of the simplest.
R0: 192.168.2.0/24 -> R2, 192.168.3.0/24 -> R1, no default route R1: default -> R0 R2: default -> R0
(In the actual routes, you need to use the near-side IP address of the router. I'm using the names just because it's easier to read.)
Additionally, all three routers will automatically have two interface routes, one for each of their enabled interfaces. (Ie, they know their local routes.)
Two end-hosts are have only a single choice:
PC1: default -> R2 # your PC and router names are funny way round PC2: default -> R1
The last one is where the question is.
Unless we put suitable multiple routes on PC0, some of its outgoing packets will go the "wrong" way. Eg, with default -> R0, a packet from PC0 to PC1 will go PC0->R0->R2->PC1. This is perfectly fine from the point of view of the packet: it gets to where it's going, albeit a little slower than if it went directly. When a router notices it has a sent a packet out of the same interface as it arrived on, it will normally issue an ICMP Redirect message, to tell the sender that a better route is a available. In this case it's R) telling PC0. PC0 can ignore this ICMP if it chooses, or use it to learn a new route. Be aware that many PC operating systems won't learn new routes by ICMP as this is a vector of attack; also, many routers have the ICMP redirect messages disabled.
If you put the default route on PC0 to the other router, the behaviour is symmetric.