Debugging OpenWrt

it's a BMC/IPMI client. And it has a statically set ip address of 10.1.1.1/16 gateway 10.1.0.254

when running
tcpdump -evni any icmp

on openwrt when trying to ping 10.1.1.1 from openwrt i get lines like below

tcpdump: listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes
10:30:19.010706 Out {mac address redacted} ethertype IPv4 (0x0800), length 100: (tos 0x0, ttl 64, id 52321, offset 0, flags [DF], proto ICMP (1), length 84)
    10.1.0.254 > 10.1.1.1: ICMP echo request, id 11253, seq 0, length 64

in the meantime 10.1.1.1 is not longer in he arp table
EDIT: and now it's back :wink:

regarding routing table. did you mean on 10.1.1.1? because if that is the case I am afraid that will not be possible as I can't access a CLI

That's OpenWRT VM1 in the diagram? Is it not running on a HV where you have a direct terminal connection to the OS? No need to SSH. For example, I complied OpenWRT for x86 in a Hyper-V VM on Windows 10. To access it once running I just open that VM from Hyper-V Manager.

If you can't see that the routing is correct there you could spend a lot of time looking elsewhere while it is that which needs fixing.

You have three OpenWRT instances in the diagram :slight_smile:. I'm trying to keep up but think I may be assuming things that you didn't mean.

IIRC you've put OpenWRT into a HV to help you debug it - but you say you can't get a CLI on that platform to debug it. Would it not be easier to have OpenWRT on a physical device where you can SSH or set up a serial connection? I think that's where you started, and you may (IMHO) have leapt to a debugging strategy that is not proven to be needed yet. Do you have a diagram of what you want in the end, and what wasn't working on that?

I can use a spice viewer connection to connect to the OpenWrt VM to gain direct access as if I was in front of a physical terminal.

or I can ssh into it.

For OpenWrt I can list the routing

ip route
10.0.0.0/16 dev br-lan scope link  src 10.0.0.254 
10.1.0.0/16 dev br-lan scope link  src 10.1.0.254 
10.2.0.0/16 dev br-lan scope link  src 10.2.0.254 

One moment, the diagram is the end goal.
I'll update it as to reflect the current status

It's again at the edge of where I play, but looks like no default route which perhaps shouldn't matter for the case where you want to use a specific interface.

What does a simple route command show you?

root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         87-101-0-1.dsl. 0.0.0.0         UG    0      0        0 eth1
10.0.0.0        *               255.255.0.0     U     0      0        0 br-lan
10.1.0.0        *               255.255.0.0     U     0      0        0 br-lan
10.2.0.0        *               255.255.0.0     U     0      0        0 br-lan
87.101.0.0      *               255.255.248.0   U     0      0        0 eth1

I'm confused how these join up. Is 10.1.1.1 the OpenWRT VM or not?

No 10.1.1.1 is BMC (statically configured ip address)
The OpenWrt router can be reached via it's interfaces in the lan firewall zone 10.0.0.254, 10.1.0.254 and 10.2.0.254 or openwrt.lan which resolves to 10.0.0.254
EDIT: Or additionally a VM viewer which logs into OpenWrt directly as if I was in front of a physical terminal

In a separate thread that is more geared towards the firewall aspect of OpenWrt.

I came the the below conclusing.

I'll keep this thread updated as well

Sorry guys but I am getting mad. It's time to go the debug route. I thought I had things stable for a while and then one day after a power outage. I can start from scratch again as OpenWrt just decided to no longer work as before the power outage.

Believe me this is infuriating, frustrating so much that I am not really sure anymore if my use case is compatible with OpenWrt.

I also no longer have the energy to try tweaking again and hoping for the best. t's time to get out the big guns.

Can someone please direct me on the path to full blown debugging and following packets line by line through the source code?

Can I run the code in debug mode perhaps and shoot packets at the running process?

Could I use Visual Studio Code for example? Or another full fledged IDE?

My OpenWrt is running as a VM. So a serial connection is not available I think.

sweet, there is hope yet

https://visualgdb.com/

Now if only there is a way of building the OpenWrt source code using visual studio so I can run it there

https://sysprogs.com/VisualKernel/tutorials/kernel/
looks promising