Hi teachers, Good morning! I am learning the course of `Certified Kubernetes A . . .

Ryan Lyu:
Hi teachers,

Good morning!

I am learning the course of Certified Kubernetes Administrator and have a question about the slide “make a server as router”.

The teacher said, in order to make a server as router, you need the following steps.

  1. connect this server B to two networks.
  2. enabled the ip_forward
    But besides that, do we need to set up the route table for the server B?

If we don’t set route table for server B, when packets comes in, how does it know the rules to dispatch the packet?

https://www.udemy.com/course/certified-kubernetes-administrator-with-practice-tests/learn/lecture/14296138#overview

cc @Prabhjyot Kaur @Rahul Soni @Tej Singh Rana

Thanks

Ryan Lyu:
I have done some research, it seems besides enabling the ip_forward, we also need to create static routes for this server.

Am I understanding correctly?

https://devconnected.com/how-to-configure-linux-as-a-static-router/#Creating_Static_Routes_using_ip#Creating_new_static_routes

Alistair Mackay:
For this simple scenario, no. Server B is locally connected to both networks so implicitly knows how to send packets to hosts on either network.
When ip_forward is enabled, server B can see the incoming packet from server A is for a host on a network connected to another of its own interfaces so forwards it.

Alistair Mackay:
You can run ip route or netstat -rn on server B and you will see the routes to 192.168.1.0/24 and 192.168.2.0/24 already exist.

Ryan Lyu:
That’s interesting. Thanks for sharing.

albert estevez:
if you want to enable traffic flow between interfaces you must enable ip_forward if not the packets received in one interface will never transit to another interface…