Compare commits
1 Commits
ac7185bfb5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbf0b5d388 |
@@ -1,15 +1,39 @@
|
|||||||
#!/bin/bash -ex
|
#!/bin/bash -ex
|
||||||
|
|
||||||
# Create a venv-based virtual network for testing, consisting of:
|
# Manage a venv-based virtual network for testing, consisting of:
|
||||||
#
|
#
|
||||||
# - venv0: Interface for the DHCP server (static address: 10.0.0.254/24)
|
# - venv0: Interface for the DHCP server (static address: 10.0.0.254/24)
|
||||||
# - venv1: Interface for DHCP client
|
# - venv1: Interface for DHCP client
|
||||||
# - br-dhcp: A bridge for communication between these interfaces
|
# - br-dhcp: A bridge for communication between these interfaces
|
||||||
|
#
|
||||||
|
# Default behavior is to create the network, the `-d` option removes it.
|
||||||
|
|
||||||
BR=br-dhcp
|
BR=br-dhcp
|
||||||
SERVERADDR="10.0.0.254/24"
|
SERVERADDR="10.0.0.254/24"
|
||||||
|
|
||||||
brctl delbr $BR
|
# Parse arguments
|
||||||
|
DELETE=0
|
||||||
|
while getopts "d" opt; do
|
||||||
|
case $opt in
|
||||||
|
d)
|
||||||
|
DELETE=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$DELETE" != "0" ]; then
|
||||||
|
for i in {0..1}; do
|
||||||
|
IFNAME="veth${i}"
|
||||||
|
ip link del "$IFNAME" || true
|
||||||
|
done
|
||||||
|
ip link set "$BR" down
|
||||||
|
brctl delbr $BR
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
brctl addbr $BR
|
brctl addbr $BR
|
||||||
|
|
||||||
for i in {0..1}; do
|
for i in {0..1}; do
|
||||||
Reference in New Issue
Block a user