fix dhcp router ip
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
1cdb89b0e6
commit
7c4e3a8e47
2 changed files with 4 additions and 2 deletions
|
|
@ -28,6 +28,8 @@ function int_to_mac() {
|
|||
function generate_dhcp_file {
|
||||
# CIDR de départ (ex: "10.10.10.0/24")
|
||||
cidr="${1}"
|
||||
gateway_cidr=${3}
|
||||
gateway="$(echo "${gateway_cidr}" | cut -d\/ -f1)"
|
||||
subnet="$(echo "${cidr}" | cut -d\/ -f1)"
|
||||
output_file="/etc/dnsmasq.d/${2}.conf"
|
||||
|
||||
|
|
@ -66,7 +68,7 @@ function generate_dhcp_file {
|
|||
|
||||
echo "no-resolv" >> "$output_file"
|
||||
echo "dhcp-range=${subnet},static,255.255.255.0,12h" >> "$output_file"
|
||||
echo "dhcp-option=3,240.0.2.1" >> "$output_file"
|
||||
echo "dhcp-option=3,${gateway}" >> "$output_file"
|
||||
echo "dhcp-option=6,1.1.1.1,8.8.8.8" >> "$output_file"
|
||||
|
||||
# Variables pour l'incrémentation des MAC et IP
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ function create_subnet {
|
|||
ebtables -A FORWARD --out-interface "br-${subnet_id}" -p arp --arp-op Request --arp-ip-dst "${gateway_ip}" -j DROP
|
||||
ebtables -A FORWARD --out-interface "br-${subnet_id}" -p IPv4 --ip-protocol udp --ip-source-port 67:68 --ip-destination-port 67:68 -j DROP
|
||||
|
||||
generate_dhcp_file "${subnet}" "${vpc_name}_br-${subnet_id}"
|
||||
generate_dhcp_file "${subnet}" "${vpc_name}_br-${subnet_id}" "${router_ip}"
|
||||
systemctl start "dnsmasq@${vpc_name}_br-${subnet_id}.service"
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue