Display IP errors
This commit is contained in:
parent
0dabc9b5fa
commit
8b51c380ae
1 changed files with 20 additions and 17 deletions
|
@ -26,26 +26,29 @@ configureDHCP() {
|
||||||
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
|
||||||
|
|
||||||
[[ "${DEBUG}" == [Yy1]* ]] && set -x
|
[[ "${DEBUG}" == [Yy1]* ]] && set -x
|
||||||
{ ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge 2> /dev/null ; rc=$?; } || :
|
{ ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge ; rc=$?; } || :
|
||||||
|
|
||||||
if (( rc != 0 )); then
|
if (( rc != 0 )); then
|
||||||
echo -n "ERROR: Capability NET_ADMIN has not been set ($rc/1). Please add the "
|
|
||||||
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 15
|
echo -n "INFO: Could not create macvlan, skipping..."
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
ip address add "${IP}" dev "${VM_NET_VLAN}"
|
||||||
|
ip link set dev "${VM_NET_VLAN}" up
|
||||||
|
|
||||||
|
ip route flush dev "${VM_NET_DEV}"
|
||||||
|
ip route flush dev "${VM_NET_VLAN}"
|
||||||
|
|
||||||
|
ip route add "${NETWORK}" dev "${VM_NET_VLAN}" metric 0
|
||||||
|
ip route add default via "${GATEWAY}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ip address add "${IP}" dev "${VM_NET_VLAN}"
|
{ ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge ; rc=$?; } || :
|
||||||
ip link set dev "${VM_NET_VLAN}" up
|
|
||||||
|
|
||||||
ip route flush dev "${VM_NET_DEV}"
|
|
||||||
ip route flush dev "${VM_NET_VLAN}"
|
|
||||||
|
|
||||||
ip route add "${NETWORK}" dev "${VM_NET_VLAN}" metric 0
|
|
||||||
ip route add default via "${GATEWAY}"
|
|
||||||
|
|
||||||
{ ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge 2> /dev/null ; rc=$?; } || :
|
|
||||||
|
|
||||||
if (( rc != 0 )); then
|
if (( rc != 0 )); then
|
||||||
echo -n "ERROR: Capability NET_ADMIN has not been set ($rc/2). Please add the "
|
echo -n "ERROR: Capability NET_ADMIN has not been set most likely. Please add the "
|
||||||
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 16
|
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 16
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -97,10 +100,10 @@ configureNAT () {
|
||||||
|
|
||||||
#Create bridge with static IP for the VM guest
|
#Create bridge with static IP for the VM guest
|
||||||
|
|
||||||
{ ip link add dev dockerbridge type bridge 2> /dev/null ; rc=$?; } || :
|
{ ip link add dev dockerbridge type bridge ; rc=$?; } || :
|
||||||
|
|
||||||
if (( rc != 0 )); then
|
if (( rc != 0 )); then
|
||||||
echo -n "ERROR: Capability NET_ADMIN has not been set ($rc/3). Please add the "
|
echo -n "ERROR: Capability NET_ADMIN has not been set most likely. Please add the "
|
||||||
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 23
|
echo "following docker setting to your container: --cap-add NET_ADMIN" && exit 23
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -127,7 +130,7 @@ configureNAT () {
|
||||||
|
|
||||||
#Check port forwarding flag
|
#Check port forwarding flag
|
||||||
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||||
{ sysctl -w net.ipv4.ip_forward=1 2> /dev/null ; rc=$?; } || :
|
{ sysctl -w net.ipv4.ip_forward=1 ; rc=$?; } || :
|
||||||
if (( rc != 0 )); then
|
if (( rc != 0 )); then
|
||||||
echo -n "ERROR: IP forwarding is disabled ($rc). Please add the following "
|
echo -n "ERROR: IP forwarding is disabled ($rc). Please add the following "
|
||||||
echo "docker setting to your container: --sysctl net.ipv4.ip_forward=1" && exit 24
|
echo "docker setting to your container: --sysctl net.ipv4.ip_forward=1" && exit 24
|
||||||
|
|
Loading…
Reference in a new issue