first draft of full implementation with net_set_dhcp
This commit is contained in:
15
capsulflask/shell_scripts/ip-dhcp-host.sh
Executable file
15
capsulflask/shell_scripts/ip-dhcp-host.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# ip-dhcp-host.sh - add or remove a mac address --> ipv4 mapping
|
||||
|
||||
action="$1"
|
||||
network_name="$2"
|
||||
mac_address="$3"
|
||||
ipv4_address="$4"
|
||||
|
||||
[ "$action" != 'add' ] && [ "$action" != 'delete' ] && printf 'you must set $action to either add or delete (1st arg)\n' && exit 1
|
||||
[ "$network_name" = '' ] && printf 'you must set $network_name (2nd arg)\n' && exit 1
|
||||
[ "$mac_address" = '' ] && printf 'you must set $mac_address (3rd arg)\n' && exit 1
|
||||
[ "$ipv4_address" = '' ] && printf 'you must set $ipv4_address (4th arg)\n' && exit 1
|
||||
|
||||
virsh net-update "$network_name" "$action" ip-dhcp-host "<host mac='$mac_address' ip='$ipv4_address' />" --live --config
|
Reference in New Issue
Block a user