Reply To: Bind on application is over-ridden by netbalancer?

Home Page Forums Network Management Firewall, Traffic Shaping and Net Balancer Bind on application is over-ridden by netbalancer? Reply To: Bind on application is over-ridden by netbalancer?

#50854

houkouonchi
Member

This is what I added to ‘Firewall Chain in:

Startup/Cron:


ip1check=`/sbin/ifconfig ETH01 | /bin/grep -c inet addr`
ip2check=`/sbin/ifconfig ETH02 | /bin/grep -c inet addr`

if [ $ip1check -gt 0 ]
then
ip=`/sbin/ifconfig ETH01 | /bin/grep inet | /usr/bin/cut -d':' -f2 | /usr/bin/cut -d' ' -f1`
/usr/local/sbin/iptables -t mangle -D NetBalancer -p all -s $ip -j MARK --set-mark 101 2> /dev/null
/usr/local/sbin/iptables -t mangle -A NetBalancer -p all -s $ip -j MARK --set-mark 101
fi

if [ $ip2check -gt 0 ]
then
ip=`/sbin/ifconfig ETH02 | /bin/grep inet | /usr/bin/cut -d':' -f2 | /usr/bin/cut -d' ' -f1`
/usr/local/sbin/iptables -t mangle -D NetBalancer -p all -s $ip -j MARK --set-mark 103 2> /dev/null
/usr/local/sbin/iptables -t mangle -A NetBalancer -p all -s $ip -j MARK --set-mark 103
fi

I figured the above code should help it work even if my IP address changes. Also I have it delete the rule first so other firewall changes dont make a bunch of duplicate rules in the NetBalancer chain.