Saturday 12 September 2020

TIL checking your routing tables on Ubuntu

 So, in the past, I've used tools such as ifconfig and route and netstat, but TIL something new ...

I was trying to debug a networking problem with a container running on one of my Secure Service Container (SSC) instances on an IBM z14.

Whilst the container was creating, networking was more like notworking.

Via direct access to the SSC, I could open a shell inside the running container, and poke about within its internals.

Whilst it had an IP address, as per:

ip address

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

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

    link/ether e2:3d:3e:bb:d0:81 brd ff:ff:ff:ff:ff:ff

    inet 172.16.148.4/24 brd 172.16.148.255 scope global eth0

       valid_lft forever preferred_lft forever


and a DNS configuration: -

cat /etc/resolv.conf

# Generated by RunQ

nameserver 8.8.8.8

I wasn't able to ping the outside world, whether 8.8.8.8 or anything else.

I suspect the routing table, but didn't have netstat or route installed and, of course, without internet access could not install them using apt-get update && apt-get install -y 

So what to do ?

At this point, I discovered ip route which goes alongside ip address as per this: -

ip route

default via 172.16.148.1 dev eth0 

172.16.148.0/24 dev eth0 proto kernel scope link src 172.16.148.4 

This (a) showed the routing table and (b more importantly, showed me what I was doing wrong ....

This was the WRONG subnet.

Without going down a rabbit hole, the Docker network that the SSC was using was WRONG :-(

Once I sorted this out, all was well ....

And ip route is now in the kitbag......

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...