Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added FirewallD support to scripts #388

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions tools/labs/qemu/cleanup-net.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

DNSMASQ=/tmp/dnsmasq

for i in lkt-tap0 lkt-tap1 lkt-tap-smbd; do
if ! ip a s dev &> /dev/null $i; then
for device in lkt-tap0 lkt-tap1 lkt-tap-smbd; do
if ! ip a s dev &> /dev/null $device; then
continue
fi
if [ -f $DNSMASQ-$i.pid ]; then
sudo kill `cat $DNSMASQ-$i.pid`
if [ -f $DNSMASQ-$device.pid ]; then
sudo kill $(cat $DNSMASQ-$device.pid)
fi
sudo rm $DNSMASQ-$i.leases
sudo ip tuntap del $i mode tap
sudo rm $DNSMASQ-$device.leases
if [ -e $(which --skip-alias firewall-cmd) ]; then
sudo firewall-cmd --zone=trusted --remove-interface=$device
fi
sudo ip tuntap del $device mode tap
done
4 changes: 4 additions & 0 deletions tools/labs/qemu/create_net.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ sudo /sbin/ip link set dev "$device" down
sudo /sbin/ip address add $subnet.1/24 dev "$device"
sudo /sbin/ip link set dev "$device" up

if [ -e $(which --skip-alias firewall-cmd) ]; then
sudo firewall-cmd --zone=trusted --change-interface=$device
fi

sudo dnsmasq --port=0 --no-resolv --no-hosts --bind-interfaces \
--interface $device -F $subnet.2,$subnet.20 --listen-address $subnet.1 \
-x /tmp/dnsmasq-$device.pid -l /tmp/dnsmasq-$device.leases || true
Loading