On Thu, Feb 16, 2023 at 9:08 AM John Covici <cov...@ccs.covici.com> wrote: > > hmmm, but what should I use for the source ip, I only assign those > when I bring the interface up when I start the interface -- I have > something like this: > [Unit] > Description=Network Connectivity for %i > ... > So, before I run this, I don't think the card has any ip address, does > it?
So, "cards" don't have an IP address. The kernel assigns an IP address to an interface, which is entirely a software construct. It happens to be a software construct that the network console feature largely ignores anyway. I didn't go reading the source code, but I'm guessing it is just constructing raw UDP packets and it will happily set the IP to whatever you want it to be. After all, it is just a field on the packet. So you can make the source IP whatever you want it to be. Just expect the packets to show up with the IP you set on them. There is no connection, so the IP doesn't need to be reachable by anything else. You could stick literally anything in there as long as some firewall isn't going to object and drop the packet. The destination IP matters because that is where it is going to go, and the interface matters because if it gets sent out on the wrong interface then obviously it won't make it there. I have no idea if the netconsole packets get seen by netfilter, but if this is on some kind of router that might be something you need to check, because if netfilter is configured to drop unassociated UDP from the firewall to the LAN that could be an issue. However, it is possible this just bypasses netfilter entirely. If you have the dynamic netconsole option enabled you could have a script update the settings after your network is up to set the source IP to the one assigned by DHCP and make sure it is on the right interface. As you point out though at boot time the interface won't have an IP. It won't even be "up," not that this is likely to bother the kernel. -- Rich