-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network_Setup for Kdump Remote Mode. #19464
base: master
Are you sure you want to change the base?
Changes from 22 commits
6587eb8
7e3e61a
3c1c04d
7edc987
b28aac3
4ad78d6
cfc5513
0fd9a0b
68ba502
8bdebd1
f7d7220
c9a46a1
5e24c49
81fd8d9
8a5bf5d
f1ccb18
2baa955
3528322
bc37486
2c1b3f0
7040b1c
278ee18
1e4025f
e063e3e
9992c32
5f9c8a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
PREREQ="" | ||
|
||
prereqs() { | ||
echo "$PREREQ" | ||
} | ||
|
||
case "$1" in | ||
prereqs) | ||
prereqs | ||
exit 0 | ||
;; | ||
esac | ||
|
||
. /usr/share/initramfs-tools/hook-functions | ||
|
||
# Add dhclient and its dependencies | ||
copy_exec /sbin/dhclient /sbin | ||
copy_exec /sbin/dhclient-script /sbin | ||
|
||
# Add the necessary network modules | ||
manual_add_modules e1000e |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/sh | ||
|
||
# Read USE_KDUMP variable from /etc/default/kdump-tools | ||
if [ -f /etc/default/kdump-tools ]; then | ||
. /etc/default/kdump-tools | ||
else | ||
USE_KDUMP=0 # Default to 0 if the file doesn't exist | ||
fi | ||
|
||
# Check if USE_KDUMP is enabled | ||
if [ "$USE_KDUMP" -ne 1 ]; then | ||
echo "KDUMP is not enabled. Skipping network setup." | ||
exit 0 | ||
fi | ||
|
||
# Function to get the IP address of the eth0 interface | ||
get_eth0_ip() { | ||
ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1 | ||
} | ||
|
||
# Function to get the default gateway | ||
get_default_gateway() { | ||
ip route | grep default | awk '{print $3}' | ||
} | ||
|
||
# Wait for the network interface to appear | ||
for i in {1..10}; do | ||
if ip link show eth0; then | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
|
||
# Bring up the network interface | ||
ip link set eth0 up | ||
|
||
# Use DHCP to obtain IP address and default gateway | ||
dhclient eth0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the DHCP server is not present in the network? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @venkatmahalingam There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why we need this change itself, SSH would work only if the network reachability is there for the remote destination. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You’re correct. But normally the kdump remote feature can be enabled simply by modifying the kdump-tools file. However, in the SONiC community version, when we enable the kdump remote mode, after kernel crash when it tries to send the crash report over ssh server it encounters an error of network unreachability. So we also need to bring up the network interfaces alongside ssh remote configurations. All these adjustments have been made specifically to bring up the "eth0" interface. |
||
# Wait a few seconds to ensure the IP is assigned | ||
sleep 6 | ||
|
||
ETH0_IP=$(get_eth0_ip) | ||
DEFAULT_GW=$(get_default_gateway) | ||
|
||
if [ -z "$ETH0_IP" ] || [ -z "$DEFAULT_GW" ]; then | ||
echo "DHCP failed to assign IP. Please enter a static IP and gateway." | ||
|
||
read -p "Enter static IP address: " STATIC_IP | ||
read -p "Enter default gateway: " STATIC_GW | ||
|
||
# Set the static IP and gateway | ||
ip addr add $STATIC_IP/24 dev eth0 | ||
ip route add default via $STATIC_GW | ||
else | ||
echo "DHCP succeeded. IP: $ETH0_IP, Gateway: $DEFAULT_GW" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we need this change, as long as SSH works to the remote destination, it should be enough, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will be impact for DUMP remote mode feature if we dont have this pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally the kdump remote feature can be enabled simply by modifying the kdump-tools file. However, in the SONiC community version, when we enable the kdump remote mode, after kernel crash when it tries to send the crash report over ssh server it encounters an error of network unreachability. So we also need to bring up the network interfaces alongside ssh remote configurations. All these adjustments have been made specifically to bring up the "eth0" interface.