diff --git a/lib/subnet.sh b/lib/subnet.sh index 5b7aaff..3cf6e7e 100644 --- a/lib/subnet.sh +++ b/lib/subnet.sh @@ -17,8 +17,8 @@ function check_subnet_exist { print_in_color "${COLOR_GREY}" "Check in linux if ${subnet_name} exist" ip link show | grep -E '^[0-9]*:'|sed -e 's/ //g' | cut -d: -f 2 | grep "br-${subnet_id}" > /dev/null || return 1 ip -n "${vpc_name}" link show | grep -E '^[0-9]*:'|sed -e 's/ //g' | cut -d: -f 2 | grep "br-${subnet_id}" > /dev/null || return 1 - ip link show | grep -E '^[0-9]*:'|sed -e 's/ //g' | cut -d: -f 2 | grep "veth-${subnet_id}-ext" > /dev/null || return 1 - ip -n "${vpc_name}" link show | grep -E '^[0-9]*:'|sed -e 's/ //g' | cut -d: -f 2 | grep "veth-${subnet_id}-int" > /dev/null || return 1 + ip link show | grep -E '^[0-9]*:'|sed -e 's/ //g' | cut -d: -f 2 | grep "vs-${subnet_id}-e" > /dev/null || return 1 + ip -n "${vpc_name}" link show | grep -E '^[0-9]*:'|sed -e 's/ //g' | cut -d: -f 2 | grep "vs-${subnet_id}-i" > /dev/null || return 1 ip link show | grep -E '^[0-9]*:'|sed -e 's/ //g' | cut -d: -f 2 | grep "vxlan-${vxlan_id}" > /dev/null || return 1 return 0 @@ -45,7 +45,7 @@ function create_subnet { add_in_db "subnet" "${subnet_name}" "${vpc_name}" "${vxlan_id}" "${local_ip}" "${gateway_ip}" "${subnet}" print_in_color "${COLOR_GREEN}" " - create veth" - ip link add "veth-${subnet_id}-ext" type veth peer name "veth-${subnet_id}-int" netns "${vpc_name}" + ip link add "vs-${subnet_id}-e" type veth peer name "vs-${subnet_id}-int" netns "${vpc_name}" print_in_color "${COLOR_GREEN}" " - add bridges" brctl addbr "br-${subnet_id}" @@ -61,16 +61,16 @@ function create_subnet { nolearning print_in_color "${COLOR_GREEN}" " - add interface in bridge" - brctl addif "br-${subnet_id}" "veth-${subnet_id}-ext" - ip netns exec "${vpc_name}" brctl addif "br-${subnet_id}" "veth-${subnet_id}-int" + brctl addif "br-${subnet_id}" "vs-${subnet_id}-e" + ip netns exec "${vpc_name}" brctl addif "br-${subnet_id}" "vs-${subnet_id}-i" brctl addif "br-${subnet_id}" "vxlan-${vxlan_id}" print_in_color "${COLOR_GREEN}" " - up interface" - ip link set up dev "veth-${subnet_id}-ext" + ip link set up dev "vs-${subnet_id}-e" ip link set up dev "vxlan-${vxlan_id}" ip link set up dev "br-${subnet_id}" - ip -n "${vpc_name}" link set up dev "veth-${subnet_id}-int" + ip -n "${vpc_name}" link set up dev "vs-${subnet_id}-i" ip -n "${vpc_name}" link set up dev "br-${subnet_id}" @@ -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}" "${gateway_ip}" + #generate_dhcp_file "${subnet}" "${vpc_name}_br-${subnet_id}" "${gateway_ip}" systemctl start "dnsmasq@${vpc_name}_br-${subnet_id}.service" } @@ -114,4 +114,4 @@ function delete_subnet { print_in_color "${COLOR_GREY}" "Try to delete ${vpc_name}" count_in_db "subnet" "${vpc_name}" [ "$?" -eq "0" ] && delete_vpc "${vpc_name}" -} \ No newline at end of file +}