代码拉取完成,页面将自动刷新
# Configuration file for setting IP addresses for multiple network interface.
INTERFACE_PREFIX="$1"
HWADDR_PREFIX="00:00:5e:00:53:"
IPV6_ADDR_PREFIX0="2001:db8::"
IPV6_ROUTE0="2001:db8::/64"
IPV6_ADDR_PREFIX1="2001:db8:2::"
IPV6_ROUTE1="2001:db8:2::/64"
IPV4_ADDR_PREFIX0="192.0.2."
IPV4_ADDR_PREFIX1="198.51.100."
INTERFACE0=${INTERFACE_PREFIX}
INTERFACE1=`echo ${INTERFACE_PREFIX} | sed "s/0/1/g"`
IPV4_ROUTE0="${IPV4_ADDR_PREFIX0}0/24"
IPV4_ROUTE1="${IPV4_ADDR_PREFIX1}0/24"
# The zeth0 is already created by net-setup script so avoid
# doing it twice.
ip link set dev ${INTERFACE0} up
ip link set dev ${INTERFACE0} address ${HWADDR_PREFIX}0
ip -6 address add ${IPV6_ADDR_PREFIX0}2 dev $INTERFACE0 nodad
ip -6 route add $IPV6_ROUTE0 dev $INTERFACE0
ip address add ${IPV4_ADDR_PREFIX0}2 dev $INTERFACE0
ip route add $IPV4_ROUTE0 dev $INTERFACE0 2>&1
COUNT=${COUNTER:-2}
INTERFACE_TMPL=`echo ${INTERFACE_PREFIX} | sed "s/0//g"`
for ((i = 1; i < $COUNT; i++ )); {
iface_idx=$i
INTERFACE=${INTERFACE_TMPL}${iface_idx}
ip tuntap add ${INTERFACE} mode tap
ip link set dev ${INTERFACE} up
# If there are config options then try to apply them.
# TODO: this should be changed to use a yaml file or similar.
VAR_CHECK="INTERFACE${iface_idx}"
if [ -n "${!VAR_CHECK}" ]; then
ip link set dev ${INTERFACE} address ${HWADDR_PREFIX}${iface_idx}
VAR=IPV6_ADDR_PREFIX${iface_idx}
ip -6 address add ${!VAR}${iface_idx} dev ${INTERFACE} nodad
VAR=IPV6_ROUTE${iface_idx}
ip -6 route add ${!VAR} dev ${INTERFACE}
VAR=IPV4_ADDR_PREFIX${iface_idx}
ip address add ${!VAR}${iface_idx} dev ${INTERFACE}
VAR=IPV4_ROUTE${iface_idx}
ip route add ${!VAR} dev ${INTERFACE} 2>&1
fi
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。