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