mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-30 05:02:54 +08:00
Add files via upload
This commit is contained in:
parent
667effa3b6
commit
5af297231c
@ -1,8 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Try to fix vmbr0 / GUI access after a NIC name change
|
# Try to fix vmbr0 / GUI access on IP:8006 after a NIC name change
|
||||||
# 2024.May kneutron
|
# 2024.May kneutron
|
||||||
|
|
||||||
|
# DEPENDS: find grep awk sed netstat
|
||||||
|
|
||||||
|
# PROTIP - run ' screen ' or ' tmux ' before running this script if the interface name is long,
|
||||||
|
# you can copypasta with just the keyboard - see appropriate man pages
|
||||||
|
|
||||||
|
# In GNU screen: Hit ^[, cursor move to start of new interface name, hit spacebar to begin mark, cursor to end of NIC name,
|
||||||
|
# then hit spacebar to end mark, ^] to paste
|
||||||
|
|
||||||
cd /etc/network/
|
cd /etc/network/
|
||||||
cp -v interfaces interfaces.$(date +%Y%m%d@%H%M).bak
|
cp -v interfaces interfaces.$(date +%Y%m%d@%H%M).bak
|
||||||
cp -v interfaces interfaces.MODME
|
cp -v interfaces interfaces.MODME
|
||||||
@ -22,29 +30,57 @@ grep -A 7 vmbr0 /etc/network/interfaces
|
|||||||
oldiface=$(grep -m 1 bridge-ports /etc/network/interfaces |awk '{print $2}')
|
oldiface=$(grep -m 1 bridge-ports /etc/network/interfaces |awk '{print $2}')
|
||||||
echo "This appears to be the OLD interface for vmbr0: $oldiface"
|
echo "This appears to be the OLD interface for vmbr0: $oldiface"
|
||||||
|
|
||||||
|
echo '====='
|
||||||
echo "Please enter which new interface name to use for vmbr0:"
|
echo "Please enter which new interface name to use for vmbr0:"
|
||||||
read useinterface
|
read useinterface
|
||||||
|
echo ''
|
||||||
|
echo "Replacing $oldiface with $useinterface in temporary MODME file - NOTE you are just modifiying a copy,"
|
||||||
|
echo " the original interfaces file is still in place"
|
||||||
|
echo ''
|
||||||
|
echo "NOTE no fix has actually been implemented yet, you can still back out"
|
||||||
|
|
||||||
|
# not global, only 1st match
|
||||||
sed -i "s/bridge-ports $oldiface/bridge-ports $useinterface/" interfaces.MODME
|
sed -i "s/bridge-ports $oldiface/bridge-ports $useinterface/" interfaces.MODME
|
||||||
|
|
||||||
|
echo '====='
|
||||||
grep -m 1 bridge-ports interfaces.MODME
|
grep -m 1 bridge-ports interfaces.MODME
|
||||||
ls -lh /etc/network/interfaces /etc/network/interfaces.MODME
|
ls -lh /etc/network/interfaces /etc/network/interfaces.MODME
|
||||||
|
|
||||||
echo "The original interfaces file has been backed up!"
|
echo '====='
|
||||||
|
echo "NOTE The original interfaces file has been backed up!"
|
||||||
ls -lh *bak
|
ls -lh *bak
|
||||||
|
|
||||||
echo "Hit ^C to backout, or Enter to replace interfaces file with the modified one and restart networking:"
|
echo '====='
|
||||||
|
echo "Nothing has been modified / fixed yet, you are still in safe mode"
|
||||||
|
echo "Hit ^C to backout, or Enter to replace the interfaces file with the fixed one and restart networking:"
|
||||||
read
|
read
|
||||||
|
|
||||||
cp -v interfaces.MODME interfaces
|
|
||||||
systemctl restart networking
|
|
||||||
|
|
||||||
|
# Teh Main Thing
|
||||||
|
echo ''
|
||||||
|
echo "$(date) - Applying the fix"
|
||||||
|
cp -v interfaces.MODME interfaces
|
||||||
|
echo "$(date) - Restarting networking service to apply the change"
|
||||||
|
time systemctl restart networking
|
||||||
|
|
||||||
|
echo "$(date) - Restarting pveproxy service to make sure port 8006 is listening"
|
||||||
|
time systemctl restart pveproxy
|
||||||
|
# probably not necessary, but why not
|
||||||
|
|
||||||
|
# verify web GUI listening port
|
||||||
|
netstat -plant |grep 8006 |head -n 2
|
||||||
|
|
||||||
|
echo '====='
|
||||||
ip a |grep vmbr0 |grep -v tap
|
ip a |grep vmbr0 |grep -v tap
|
||||||
|
|
||||||
|
echo "You should now be able to ping the above IP address and get to the Proxmox Web interface."
|
||||||
|
date;
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
===================
|
||||||
|
|
||||||
Difficulty: getting this onto your proxmox server
|
Difficulty: getting this script onto your proxmox server without network
|
||||||
Solution: Copy script to USB disk or burn to ISO
|
Solution: Copy script to USB disk or burn to ISO
|
||||||
Dont forget to ' chmod +x ' it before running it as root
|
Dont forget to ' chmod +x ' it before running it as root
|
||||||
|
|
||||||
@ -77,6 +113,7 @@ iface vmbr0 inet static
|
|||||||
This appears to be the OLD interface for vmbr0: enp4s0
|
This appears to be the OLD interface for vmbr0: enp4s0
|
||||||
Please enter which new interface name to use for vmbr0:
|
Please enter which new interface name to use for vmbr0:
|
||||||
eno1
|
eno1
|
||||||
|
|
||||||
bridge-ports eno1
|
bridge-ports eno1
|
||||||
-rw-r--r-- 1 root root 1.7K Apr 1 14:52 /etc/network/interfaces
|
-rw-r--r-- 1 root root 1.7K Apr 1 14:52 /etc/network/interfaces
|
||||||
-rw-r--r-- 1 root root 1.7K May 2 12:12 /etc/network/interfaces.MODME
|
-rw-r--r-- 1 root root 1.7K May 2 12:12 /etc/network/interfaces.MODME
|
||||||
@ -96,6 +133,14 @@ Hit ^C to backout, or Enter to replace interfaces file with the modified one and
|
|||||||
|
|
||||||
You should now be able to ping 192.168.1.186 and get to the Proxmox Web interface.
|
You should now be able to ping 192.168.1.186 and get to the Proxmox Web interface.
|
||||||
|
|
||||||
NOTE - Script is a bit primitive, probably does not cover all network interface names, tested Ok in VM
|
NOTE - Script is a bit primitive, makes several assumptions about interfaces file being in a certain order,
|
||||||
|
probably does not cover all network interface names, tested Ok in VM
|
||||||
|
|
||||||
Feedback is welcome :)
|
Feedback is welcome :)
|
||||||
|
|
||||||
|
=====
|
||||||
|
|
||||||
|
Written for PVE 8.2.2, may work with other versions
|
||||||
|
|
||||||
|
V2 - extra text, formatting, commenting, features - restart pveproxy and check for listening 8006 port
|
||||||
|
Reassure end-user that no changes are actually being implemented until they hit enter to confirm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user