Networking basics, labs – switching and routing

Q6. We have four app server from app01 to app04. You can access each app from jump host using command ssh app01 and similarly for other apps. Assign new IPs to each host as per details given below:

a. Assign 172.16.238.15/24 ip address to app01

b. Assign 172.16.238.16/24 ip address to app02

c. Assign 172.16.239.15/24 ip address to app03

d. Assign 172.16.239.16/24 ip address to app04

e. We also need to remove existing IPs from these apps after assigning them new IPs but do not remove them right now as it can break your connection.

My attempt:
Last login: Sun Oct 29 03:17:36 UTC 2023 on pts/0
thor@jump_host ~$ ssh app01
The authenticity of host ‘app01 (172.16.238.11)’ can’t be established.
ECDSA key fingerprint is SHA256:QQVfDSo+jdI/dPgI9przO0S2IThITyLAGhslY0zINlI.
ECDSA key fingerprint is MD5:bf:a1:b2:a1:89:a1:fb:63:18:f0:2e:fb:ed:5c:06:a0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘app01,172.16.238.11’ (ECDSA) to the list of known hosts.
[thor@app01 ~]$ sudo ip addr add 172.16.238.15/24 dev eth0
[thor@app01 ~]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
19: eth0@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:10:ee:0b brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.16.238.11/24 brd 172.16.238.255 scope global eth0
valid_lft forever preferred_lft forever
inet 172.16.238.15/24 scope global secondary eth0
valid_lft forever preferred_lft forever
27: eth1@if28: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:11:00:07 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.17.0.7/16 brd 172.17.255.255 scope global eth1
valid_lft forever preferred_lft forever
[thor@app01 ~]$ sudo ip addr del 172.16.238.255 dev eth0
Warning: Executing wildcard deletion to stay compatible with old scripts.
Explicitly specify the prefix length (172.16.238.255/32) to avoid this warning.
This special behaviour is likely to disappear in further releases,
fix your scripts!
RTNETLINK answers: Cannot assign requested address
[thor@app01 ~]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
19: eth0@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:10:ee:0b brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.16.238.11/24 brd 172.16.238.255 scope global eth0
valid_lft forever preferred_lft forever
inet 172.16.238.15/24 scope global secondary eth0
valid_lft forever preferred_lft forever
27: eth1@if28: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:11:00:07 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.17.0.7/16 brd 172.17.255.255 scope global eth1
valid_lft forever preferred_lft forever
[thor@app01 ~]$ sudo ip addr del 172.16.238.11/24 dev eth0

ISSUE:
Here, the terminal is stuck like this
image

I take it you mean “stuck”, not “struct”

Did you note the final part of the question?

You have deleted an IP and broken your connection

1 Like

Yes, I absolutely meant stuck and not struct, my late night brain might be acting weird :sweat_smile:.

I first added the new IP address with gateway, i.e., 172.16.238.15/24, and then attempted to delete anything that was assigned to the ETH0 interface before adding this.

My thinking: As a new IP is added and shows up once I ran the “ip a” command, there is a new connection. Now, I am proceeding to delete the previous connection.

Please correct me if I am wrong and help me understand this more clearly. Appreciate your response @Alistair_KodeKloud

You only have to add IP addresses in this question - do not delete any at this point!

thor@jump_host ~$ ssh app01
[thor@app01 ~]$ sudo ip a add 172.16.238.15/24 dev eth0
[thor@app01 ~]$ logout
Connection to app01 closed.
thor@jump_host ~$ ssh app02
[thor@app02 ~]$ sudo ip a add 172.16.238.16/24 dev eth0
[thor@app02 ~]$ logout
Connection to app02 closed.
thor@jump_host ~$ ssh app03
[thor@app03 ~]$ sudo ip a add 172.16.239.15/24 dev eth0
[thor@app03 ~]$ logout
Connection to app03 closed.
thor@jump_host ~$ ssh app04
[thor@app04 ~]$ sudo ip a add 172.16.239.16/24 dev eth0
[thor@app04 ~]$ logout
Connection to app04 closed.
thor@jump_host ~$ 
4 Likes

@Alistair_KodeKloud Thank you. As i was struggling to complete this lab, i found this and it helped me complete the lab.

please i am stuck here. i dont understand this. the 8th question in switching and routing labs.

I do not understand in Q10, how we are connecting app01, app02 to app03, app04. what is this 172.16.238.10 and 172.16.239.10 ip address, a host enabled for ip forwarding, please help this is confusing?
Use below mentioned command:

On app01 and app02: sudo ip route add 172.16.239.0/24 via 172.16.238.10

On app03 and app04: sudo ip route add 172.16.238.0/24 via 172.16.239.10

  • ip forwarding is a permission given to a computer acting as a router. Such a machine will have multiple network adapters (interfaces) and forwards network packets arriving on one interface to another interface. It is how your broadband router works. In this question there is a machine acting as a router that is connected to the two networks 172.16.238.0/24 and 172.16.239.0/24 with IP addresses 172.16.238.10 and 172.16.239.10 respectively.
  • app01 and app02 are connected to the network 172.16.238.0/24. If they want to talk to app03 and app04 which are on the other network, then you have to tell them the route to get there, which is via the router at 172.16.238.10.
  • Similarly for app03 and app04 wanting to connect to app01 and app02.

This question is about manually configuring routes so you understand how it works. Normally a network will advertise a “default route” which means you don’t have to manually add routes for each device you connect to the network. Imagine if you had to do that for every device you connected to your home network!

2 Likes

I just finished this lab but can’t say I’m satisfied. though it makes perfect sense, I still know I am missing a few steps