Linux basic course - Networking fundamentals

Hi Team,

I have a doubt when adding a default route to the host. I had a lab session in networking where i have to add a default route via eth0. When i checked eth0 is 172.16.238.0 – when i add this im getting error nexthop is invalid. I did a route as well eth0 ip is 172.16.238.0 but in the solution it is showing as 172.16.238.1 – didnt get this point. I dont see this ip anywhere is this the switch or router ip ?

The IP address 172.16.238.0 that you mentioned is actually a network address for the subnet, assuming a subnet mask of 255.255.255.0 (or /24 in CIDR notation). Network addresses are used to identify subnets and cannot be assigned to hosts (including routers and switches) as their IP addresses.

In that case, how can we identify the router’s ip address correctly. Since 172.16.238.0 is a network address and 172.16.238.255 is a broadcast ip. Within this subnet range there can be many devices. If I need to identify the router’s ip address correctly how to do that? like in the solution it shows 172.16.238.1 → does router always has the first ip in the subnet range or how does it work ?

The router could be anywhere on the subnet, though typically it is at .1 or .254.