mirror of
https://github.com/AuxXxilium/arv-v-dsm.git
synced 2024-11-23 23:10:58 +07:00
Remove dhclient
This commit is contained in:
parent
a2306a8f9e
commit
bcc3eb15e2
@ -20,7 +20,7 @@ set -eu
|
||||
|
||||
configureDHCP() {
|
||||
|
||||
VM_NET_VLAN="dsm_vlan"
|
||||
VM_NET_VLAN="${VM_NET_TAP}_vlan"
|
||||
GATEWAY=$(ip r | grep default | awk '{print $3}')
|
||||
NETWORK=$(ip -o route | grep "${VM_NET_DEV}" | grep -v default | awk '{print $1}')
|
||||
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
||||
@ -54,18 +54,6 @@ configureDHCP() {
|
||||
ip address flush "${VM_NET_DEV}"
|
||||
ip address flush "${VM_NET_TAP}"
|
||||
|
||||
echo "INFO: Acquiring an IP address via DHCP using MAC address ${VM_NET_MAC}..."
|
||||
|
||||
DHCP_IP=$(dhclient -v "${VM_NET_TAP}" 2>&1 | grep ^bound | cut -d' ' -f3)
|
||||
|
||||
if [[ "${DHCP_IP}" == [0-9.]* ]]; then
|
||||
echo "INFO: Successfully acquired IP ${DHCP_IP} from the DHCP server..."
|
||||
else
|
||||
echo "ERROR: Cannot acquire an IP address from the DHCP server" && exit 17
|
||||
fi
|
||||
|
||||
ip address flush "${VM_NET_TAP}"
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
|
||||
TAP_NR=$(</sys/class/net/"${VM_NET_TAP}"/ifindex)
|
||||
@ -105,8 +93,6 @@ configureDHCP() {
|
||||
echo "docker setting to your container: --device=/dev/vhost-net" && exit 22
|
||||
fi
|
||||
|
||||
dhclient -r 2> /dev/null
|
||||
|
||||
NET_OPTS="-netdev tap,id=hostnet0,vhost=on,vhostfd=40,fd=30"
|
||||
}
|
||||
|
||||
@ -243,8 +229,7 @@ else
|
||||
configureDHCP
|
||||
|
||||
# Display the received IP on port 5000
|
||||
HTML="The location of DSM is http://${DHCP_IP}:5000<script>\
|
||||
setTimeout(function(){ window.location.replace('http://${DHCP_IP}:5000'); }, 2000);</script>"
|
||||
HTML="DSM is using a different IP address.<br><br>(Check the logfile to see which one was assigned.)"
|
||||
|
||||
pkill -f server.sh || true
|
||||
/run/server.sh 80 "${HTML}" > /dev/null &
|
||||
|
Loading…
Reference in New Issue
Block a user