Contents

Network Routing

Routing Diagram

/network-routing/network-routing.png

How to Connect Between A and C?

Network
There are two switches as 192.168.1.0 and 192.168.2.0.
192.168.1.0 and 192.168.2.0 are different network environments.
That means A and C are also different networks.
At this moment, we need a router to connect between the different networks.

Gateway

Gateway
There’s no way to connect between A and C directly.
So we need a door to connect between them.
In this case, we have a router.
We call it Gateway.

Default Gateway

Default Gateway
Now, we know what is the gateway.
You can set a gateway as system default.
Default Gateway means the system use a gateway as default.

Scenario

Set Route A

Add Route

1
ip route add 192.168.2.0/24 via 192.168.1.1

Check Route List

1
2
ip route
ip route list

Set Route C

Add Route

1
ip route add 192.168.1.0/24 via 192.168.2.1

Check Route List

1
2
ip route
ip route list

Set Default Gateway

In PC A

1
ip route add default via 192.168.1.1

In PC B

1
ip route add default via 192.168.2.1

PC as a Route

Diagram

/network-routing/network-pc-as-a-route.png

How to Connect Between PC A and PC C

Ping PC A to PC C

PC A

1
ping 192.168.2.5
1
Connect: Network is unreachable

Set Route

PC A

1
ip route add 192.168.2.0/24 via 192.168.1.6

PC C

1
ip route add 192.168.1.0/24 via 192.168.2.6