#!/usr/bin/bash

add_line () {
	grep -qxF "$1" $2 || echo -e "\n$1" >> $2
}

yes | cp -i /etc/sysctl.conf /root/sysctl.conf.0
#add_line "net.ipv4.ip_forward=1" "/etc/sysctl.conf"
#add_line "net.ipv4.conf.all.arp_filter=0" "/etc/sysctl.conf"
#add_line "net.ipv4.conf.all.rp_filter=2" "/etc/sysctl.conf"
#add_line "net.ipv4.ping_group_range=0  2147483647" "/etc/sysctl.conf"

#sysctl -p

yes | cp -i /etc/network/interfaces /root/interfaces.0
add_line '#auto br0' "/etc/network/interfaces"
add_line '#iface br0 inet static' "/etc/network/interfaces"
add_line '#\tbridge_ports ens18' "/etc/network/interfaces"
add_line '#\taddress 10.104.254.250/24' "/etc/network/interfaces"
add_line '#\tgateway 10.104.254.254' "/etc/network/interfaces"
add_line '#\tdns-nameserver 127.0.0.1' "/etc/network/interfaces"
add_line '#\tdns-nameserver 10.104.254.254' "/etc/network/interfaces"
add_line '#\tdns-nameserver 9.9.9.10' "/etc/network/interfaces"
add_line '#\tpost-up /root/vlan.sh br0' "/etc/network/interfaces"

#auto br0
#iface br0 inet static
#	bridge_ports ens18
#	address 10.104.254.250/24
#	gateway 10.104.254.254
#	dns-nameserver 127.0.0.1
#	dns-nameserver 10.104.254.254
#	dns-nameserver 9.9.9.10
#	dns-search itstroy.pro
#	post-up /root/vlan.sh br0

