doc/demo.sh: Support IPv4-only environments too
If no IPv6 global addresses are available, proceed with just IPv4 addresses and routes. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
90078ebc59
commit
69c8e5b598
1 changed files with 14 additions and 11 deletions
|
@ -84,6 +84,7 @@ nft add chain "${ns}_nat" postrouting '{ type nat hook postrouting priority -100
|
|||
nft add rule "${ns}_nat" postrouting ip saddr "${ipv4_ns}" masquerade
|
||||
|
||||
ipv6_addr="$(ipv6_devaddr "$(ipv6_dev)")"
|
||||
if [ -n "${ipv6_addr}" ]; then
|
||||
ipv6_passt="$(ipv6_mangle "${ipv6_addr}" ${ns_idx})"
|
||||
ndp_setup "${ipv6_passt}" "veth_${ns}"
|
||||
ip -n "${ns}" addr add "${ipv6_passt}/$(ipv6_mask "${ipv6_addr}")" dev "veth_${ns}"
|
||||
|
@ -95,7 +96,9 @@ ip neigh add "${passt_ll%%/*}" dev "veth_${ns}" lladdr "${main_ll}"
|
|||
ip -n "${ns}" route add default via "${passt_ll%%/*}" dev "veth_${ns}"
|
||||
|
||||
sysctl -w net.ipv6.conf.all.forwarding=1
|
||||
|
||||
else
|
||||
ipv6_passt=
|
||||
fi
|
||||
|
||||
ethtool -K "veth_${ns}" tx off
|
||||
ip netns exec "${ns}" ethtool -K "veth_${ns}" tx off
|
||||
|
|
Loading…
Reference in a new issue