mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
TUN interface
This commit is contained in:
parent
25580cbb39
commit
ec55c5cf3d
@ -12,6 +12,7 @@ RUN apt-get update && apt-get -y upgrade && \
|
|||||||
jq \
|
jq \
|
||||||
curl \
|
curl \
|
||||||
cpio \
|
cpio \
|
||||||
|
kmod \
|
||||||
wget \
|
wget \
|
||||||
unzip \
|
unzip \
|
||||||
procps \
|
procps \
|
||||||
|
26
network.sh
26
network.sh
@ -1,16 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
if [ ! -e /dev/net/tun ]; then
|
|
||||||
|
|
||||||
mkdir -p /dev/net
|
|
||||||
mknod /dev/net/tun c 10 200
|
|
||||||
chmod 600 /dev/net/tun
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ ! -e /dev/net/tun ] && echo "Error: TUN network interface not available..." && exit 85
|
|
||||||
|
|
||||||
: ${INFO:='N'}
|
: ${INFO:='N'}
|
||||||
: ${DEBUG:='N'}
|
: ${DEBUG:='N'}
|
||||||
|
|
||||||
@ -100,6 +90,22 @@ configureNatNetworks () {
|
|||||||
MAJOR=""
|
MAJOR=""
|
||||||
_DhcpIP=""
|
_DhcpIP=""
|
||||||
|
|
||||||
|
# Create the necessary file structure for /dev/net/tun
|
||||||
|
if ( [ ! -c /dev/net/tun ] ); then
|
||||||
|
if ( [ ! -d /dev/net ] ); then
|
||||||
|
mkdir -m 755 /dev/net
|
||||||
|
fi
|
||||||
|
mknod /dev/net/tun c 10 200
|
||||||
|
chmod 0755 /dev/net/tun
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load the tun module if not already loaded
|
||||||
|
if ( !(lsmod | grep -q "^tun\s") ); then
|
||||||
|
[ -f /lib/modules/tun.ko ] && insmod /lib/modules/tun.ko
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ ! -c /dev/net/tun ] && echo "Error: TUN network interface not available..." && exit 85
|
||||||
|
|
||||||
#log "INFO" "Little dirty trick ..."
|
#log "INFO" "Little dirty trick ..."
|
||||||
update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null
|
update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null
|
||||||
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null
|
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user