__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Test macvlan/ipvlan over bond

lib_dir=$(dirname "$0")
source ${lib_dir}/bond_topo_2d1c.sh

xvlan1_ns="xvlan1-$(mktemp -u XXXXXX)"
xvlan2_ns="xvlan2-$(mktemp -u XXXXXX)"
xvlan1_ip4="192.0.2.11"
xvlan1_ip6="2001:db8::11"
xvlan2_ip4="192.0.2.12"
xvlan2_ip6="2001:db8::12"

cleanup()
{
	client_destroy
	server_destroy
	gateway_destroy

	ip netns del ${xvlan1_ns}
	ip netns del ${xvlan2_ns}
}

check_connection()
{
	local ns=${1}
	local target=${2}
	local message=${3}
	RET=0

	ip netns exec ${ns} ping ${target} -c 4 -i 0.1 &>/dev/null
	check_err $? "ping failed"
	log_test "${bond_mode}/${xvlan_type}_${xvlan_mode}: ${message}"
}

xvlan_over_bond()
{
	local param="$1"
	local xvlan_type="$2"
	local xvlan_mode="$3"
	RET=0

	# setup new bond mode
	bond_reset "${param}"

	ip -n ${s_ns} link add link bond0 name ${xvlan_type}0 type ${xvlan_type} mode ${xvlan_mode}
	ip -n ${s_ns} link set ${xvlan_type}0 netns ${xvlan1_ns}
	ip -n ${xvlan1_ns} link set dev ${xvlan_type}0 up
	ip -n ${xvlan1_ns} addr add ${xvlan1_ip4}/24 dev ${xvlan_type}0
	ip -n ${xvlan1_ns} addr add ${xvlan1_ip6}/24 dev ${xvlan_type}0

	ip -n ${s_ns} link add link bond0 name ${xvlan_type}0 type ${xvlan_type} mode ${xvlan_mode}
	ip -n ${s_ns} link set ${xvlan_type}0 netns ${xvlan2_ns}
	ip -n ${xvlan2_ns} link set dev ${xvlan_type}0 up
	ip -n ${xvlan2_ns} addr add ${xvlan2_ip4}/24 dev ${xvlan_type}0
	ip -n ${xvlan2_ns} addr add ${xvlan2_ip6}/24 dev ${xvlan_type}0

	sleep 2

	check_connection "${c_ns}" "${s_ip4}" "IPv4: client->server"
	check_connection "${c_ns}" "${s_ip6}" "IPv6: client->server"
	check_connection "${c_ns}" "${xvlan1_ip4}" "IPv4: client->${xvlan_type}_1"
	check_connection "${c_ns}" "${xvlan1_ip6}" "IPv6: client->${xvlan_type}_1"
	check_connection "${c_ns}" "${xvlan2_ip4}" "IPv4: client->${xvlan_type}_2"
	check_connection "${c_ns}" "${xvlan2_ip6}" "IPv6: client->${xvlan_type}_2"
	check_connection "${xvlan1_ns}" "${xvlan2_ip4}" "IPv4: ${xvlan_type}_1->${xvlan_type}_2"
	check_connection "${xvlan1_ns}" "${xvlan2_ip6}" "IPv6: ${xvlan_type}_1->${xvlan_type}_2"

	check_connection "${s_ns}" "${c_ip4}" "IPv4: server->client"
	check_connection "${s_ns}" "${c_ip6}" "IPv6: server->client"
	check_connection "${xvlan1_ns}" "${c_ip4}" "IPv4: ${xvlan_type}_1->client"
	check_connection "${xvlan1_ns}" "${c_ip6}" "IPv6: ${xvlan_type}_1->client"
	check_connection "${xvlan2_ns}" "${c_ip4}" "IPv4: ${xvlan_type}_2->client"
	check_connection "${xvlan2_ns}" "${c_ip6}" "IPv6: ${xvlan_type}_2->client"
	check_connection "${xvlan2_ns}" "${xvlan1_ip4}" "IPv4: ${xvlan_type}_2->${xvlan_type}_1"
	check_connection "${xvlan2_ns}" "${xvlan1_ip6}" "IPv6: ${xvlan_type}_2->${xvlan_type}_1"

	ip -n ${c_ns} neigh flush dev eth0
}

trap cleanup EXIT

setup_prepare
ip netns add ${xvlan1_ns}
ip netns add ${xvlan2_ns}

bond_modes="active-backup balance-tlb balance-alb"

for bond_mode in ${bond_modes}; do
	xvlan_over_bond "mode ${bond_mode}" macvlan bridge
	xvlan_over_bond "mode ${bond_mode}" ipvlan  l2
done

exit $EXIT_STATUS

Filemanager

Name Type Size Permission Actions
Makefile File 492 B 0644
bond-arp-interval-causes-panic.sh File 1.27 KB 0755
bond-break-lacpdu-tx.sh File 1.87 KB 0755
bond-eth-type-change.sh File 2.3 KB 0755
bond-lladdr-target.sh File 1.77 KB 0755
bond_macvlan_ipvlan.sh File 2.98 KB 0755
bond_options.sh File 10.25 KB 0755
bond_topo_2d1c.sh File 3.72 KB 0644
bond_topo_3d1c.sh File 1.45 KB 0644
dev_addr_lists.sh File 2.05 KB 0755
lag_lib.sh File 4.52 KB 0644
mode-1-recovery-updelay.sh File 1.25 KB 0755
mode-2-recovery-updelay.sh File 1.25 KB 0755
Filemanager