Lab : Network Basics Q11

hi

in Lab Networks basics Q 11 :waffle:
While we are at it, there is also a missing default route on the server devapp01 .
Add the default route via eth0 gateway.

There is hint as below " sudo ip r add default via 172.16.238.1 "

Query

My understanding of this problem as below . The devapp01 server is having 3 interfaces as below

eth0 : 172.16.238.10
eth1 : 172.16.239.10
eth2 : 172.18.0.4

Q1 . How do you know where is IP 172.16.238.1 is configured in the network ?
Q2. Why do you think route needs to be added to 172.16.238.1 and not to 172.16.238.10 which IP address of the eht0 ?

I added route to .10 instead of .1 and it works . below is my working.

bob@devapp01:~$ ip addr | grep -i .1
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
14: eth1@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:10:ef:0a brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.16.239.10/24 brd 172.16.239.255 scope global eth1
18: eth0@if19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:10:ee:0a brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.16.238.10/24 brd 172.16.238.255 scope global eth0
20: eth2@if21: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:12:00:04 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.18.0.4/16 brd 172.18.255.255 scope global eth2
bob@devapp01:~$ 
bob@devapp01:~$ ip addr | grep -i 238
    inet 172.16.238.10/24 brd 172.16.238.255 scope global eth0
bob@devapp01:~$ 
bob@devapp01:~$ 
bob@devapp01:~$ ip addr | grep -i eth0
18: eth0@if19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    inet 172.16.238.10/24 brd 172.16.238.255 scope global eth0
bob@devapp01:~$ 
bob@devapp01:~$ 
bob@devapp01:~$ 
bob@devapp01:~$ sudo ip r add default via 172.16.238.10
bob@devapp01:~$ 
bob@devapp01:~$ 
bob@devapp01:~$ 
bob@devapp01:~$ 
bob@devapp01:~$ cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.16.238.10   devapp01-web
172.16.239.10   devapp01
 172.16.238.187 caleston-lp10
172.16.239.10   devapp01
172.16.238.10   devapp01
172.18.0.4      devapp01
bob@devapp01:~$ 
bob@devapp01:~$ ping caleston-lp10
ping: Lacking privilege for raw socket.
bob@devapp01:~$ 
bob@devapp01:~$ sudo ping caleston-lp10
PING caleston-lp10 (172.16.238.187): 56 data bytes
64 bytes from 172.16.238.187: icmp_seq=0 ttl=64 time=0.172 ms
64 bytes from 172.16.238.187: icmp_seq=1 ttl=64 time=0.079 ms
64 bytes from 172.16.238.187: icmp_seq=2 ttl=64 time=0.087 ms
64 bytes from 172.16.238.187: icmp_seq=3 ttl=64 time=0.091 ms
^C--- caleston-lp10 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.079/0.107/0.172/0.038 ms
bob@devapp01:~$