#Set ip.
ifconfig ${nic} 192.168.2.254/24 up
ifconfig ${nic}:0 192.168.22.254/24 up
ifconfig ${nic}:1 124.133.33.114/30 up
ifconfig ${nic}:2 58.58.27.223/24 up
ifconfig ${nic}:3 192.168.2.2/24 up
ifconfig ${nic}:4 100.100.100.100/24 up
#Conf Main Table.
ip route add 192.168.1.0/24 via 192.168.2.250
ip route add 192.168.3.0/24 via 192.168.2.250
ip route add 192.168.4.0/24 via 192.168.2.250
ip route add 192.168.5.0/24 via 192.168.2.250
ip route add 192.168.6.0/24 via 192.168.2.250
#Turn on forwarding.
echo 1 >/proc/sys/net/ipv4/ip_forward
#mondify the file "/etc/iproutes/rt_tables"
echo -e ‘100 tel\n200 cnc‘ >>.rt_tables.tmp
#Config rule and routing tables.
ip route replace default via 58.58.27.1
ip rule add from 124.133.33.114 table tel
ip route flush table tel >/dev/null 2>&1
ip route add 124.133.33.112/30 src 124.133.33.114 dev ${nic}:1 table tel
ip route add 192.168.4.0/24 via 192.168.2.250 table tel
ip route add 192.168.5.0/24 via 192.168.2.250 table tel
ip route add default via 124.133.33.113 table tel
ip rule add from 58.58.27.223 table cnc
ip route flush table cnc >/dev/null 2>&1
ip route add 58.58.27.0/24 src 58.58.27.223 dev ${nic}:2 table cnc
ip route add default via 58.58.27.1 table cnc
ip rule add fwmark 22 table tel
iptables -t mangle -F
iptables -t mangle -A PREROUTING -s 192.168.22.0/24 -j MARK --set-mark 22
iptables -t nat -F
#Config Fire Wall.[SNAT]
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j MASQUERADE
#Config Fire Wall.[DNAT]