View previous topic :: View next topic |
Author |
Message |
ldbl n00b
Joined: 24 Mar 2005 Posts: 11 Location: Bulgaria
|
Posted: Tue Apr 26, 2005 3:28 pm Post subject: 2 internet connection problem |
|
|
------------------
---------| external ip eth0 | ----------
-------------------------- | |---------------------------
| -------| Internal IP eth1 |
-------------------------- | |--------------------------
---------| external Ip eth2 | ----------
--------------------------
i want to put web and ftp traffic to eth2 and all other traffic to eth0
is it possible can anybody help me to do that
here is my config
iptables -t nat -A POSTROUTING -o eth2 -s 192.168.0.0/0 -d ! 192.168.0.0/16 -p tcp --dport 80 -j SNAT --Extermal IP on Eth2
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/0 -d ! 192.168.0.0/16 -j SNAT --External IP on Eth0
213.32.208.248 0.0.0.0 255.255.255.248 U 0 0 0 eth0
213.32.208.248 0.0.0.0 255.255.255.248 U 0 0 0 ipsec0
192.168.5.0 213.32.208.249 255.255.255.0 UG 0 0 0 ipsec0
217.10.130.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.128.0 213.32.208.249 255.255.255.0 UG 0 0 0 ipsec0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.32.0 213.32.208.249 255.255.240.0 UG 0 0 0 ipsec0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 213.32.208.249 0.0.0.0 UG 1 0 0 eth0
0.0.0.0 217.10.130.1 0.0.0.0 UG 2 0 0 eth2
Thanks is Advance _________________ No Signature|
Little Ducky with Big Luggage |
|
Back to top |
|
|
ldbl n00b
Joined: 24 Mar 2005 Posts: 11 Location: Bulgaria
|
Posted: Wed Apr 27, 2005 7:36 am Post subject: Problem Solved |
|
|
/sbin/ip route add 192.168.0.0/24 dev eth1 table natips
/sbin/ip route add 127.0.0.0/8 dev lo scope link table natips
/sbin/ip route add default via 217.10.130.1 dev eth2 table natips
/sbin/ip route flush cache
/sbin/ip rule add fwmark 66 table natips
#Put to Second line
iptables -t mangle -I PREROUTING -i eth1 -p tcp --destination-port 21
-j MARK --set-mark 66
iptables -t mangle -I PREROUTING -i eth1 -p tcp --destination-port 80
-j MARK --set-mark 66
iptables -t mangle -I PREROUTING -i eth1 -p tcp --destination-port
8080 -j MARK --set-mark 66
iptables -t mangle -I PREROUTING -i eth1 -p tcp --destination-port
8081 -j MARK --set-mark 66
iptables -t mangle -I PREROUTING -i eth1 -p tcp --destination-port
8082 -j MARK --set-mark 66
iptables -t mangle -I FORWARD -p tcp --destination-port 21 -j MARK
--set-mark 66
iptables -t mangle -I FORWARD -p tcp --destination-port 80 -j MARK
--set-mark 66
iptables -t mangle -I FORWARD -p tcp --destination-port 8080 -j MARK
--set-mark 66
iptables -t mangle -I FORWARD -p tcp --destination-port 8081 -j MARK
--set-mark 66
iptables -t mangle -I FORWARD -p tcp --destination-port 8082 -j MARK
--set-mark 66
add "200 natips" in /etc/iproute2/rt_tables _________________ No Signature|
Little Ducky with Big Luggage |
|
Back to top |
|
|
|