majedalanni
asked on
Linux - advance routing
Dears
How r u all ?
I need to make t topology
------------------- eth1
internet GW (10.1.1.1) ------------------ eth2 LINUX (2.6.20.6) with multipath ---eth0 , eth0:1eth 0:2
--------------------eth3
I need to make 1:1 nat from eth0 ---- eth1 and go out to internet from eth1 and eth0:1 ---- eth2 and go out to internet from eth2 and eth0:2 to eth3 and go out to internet from eth2
ie
10.10.10.10 ---------- 192.168.1.2 - ------ go out from eth1
10.10.10.11 ---------- 192.168.2.2 - ------ go out from eth1
10.10.10.12 ---------- 192.168.3.2 - ------ go out from eth1
I need ever nat had own Ethernet mac and IP
many thanks
How r u all ?
I need to make t topology
------------------- eth1
internet GW (10.1.1.1) ------------------ eth2 LINUX (2.6.20.6) with multipath ---eth0 , eth0:1eth 0:2
--------------------eth3
I need to make 1:1 nat from eth0 ---- eth1 and go out to internet from eth1 and eth0:1 ---- eth2 and go out to internet from eth2 and eth0:2 to eth3 and go out to internet from eth2
ie
10.10.10.10 ---------- 192.168.1.2 - ------ go out from eth1
10.10.10.11 ---------- 192.168.2.2 - ------ go out from eth1
10.10.10.12 ---------- 192.168.3.2 - ------ go out from eth1
I need ever nat had own Ethernet mac and IP
many thanks
ASKER
Dear
Sorry for confuse you
eth0:0 = 192.168.1.1/24 (LAN)
eth0:1 = 192.168.2.1/24 (LAN)
eth0:2 = 192.168.3.1/24 (LAN)
eth1 = 10.10.10.10/8 (WAN)
eth2 = 10.10.10.11/8 (WAN)
eth3 = 10.10.10.12/8 (WAN)
this the right configuration
and I do
iptables -A postrouting -t nat -s 192.168.2.2/32 -j srcnat --to 10.10.10.10
.
.
.
IP rule add from 192.168.1.2/32 table 22
IP rule add from 192.168.2.2/32 table 32
IP rule add from 192.168.3.2/32 table 32
ip route add default via 10.1.1.1 dev eth1 table 22
ip route add default via 10.1.1.1 dev eth2 table 32
ip route add default via 10.1.1.1 dev eth3 table 42
ip route flush cache
and its work
Sorry for confuse you
eth0:0 = 192.168.1.1/24 (LAN)
eth0:1 = 192.168.2.1/24 (LAN)
eth0:2 = 192.168.3.1/24 (LAN)
eth1 = 10.10.10.10/8 (WAN)
eth2 = 10.10.10.11/8 (WAN)
eth3 = 10.10.10.12/8 (WAN)
this the right configuration
and I do
iptables -A postrouting -t nat -s 192.168.2.2/32 -j srcnat --to 10.10.10.10
.
.
.
IP rule add from 192.168.1.2/32 table 22
IP rule add from 192.168.2.2/32 table 32
IP rule add from 192.168.3.2/32 table 32
ip route add default via 10.1.1.1 dev eth1 table 22
ip route add default via 10.1.1.1 dev eth2 table 32
ip route add default via 10.1.1.1 dev eth3 table 42
ip route flush cache
and its work
So you meant you need a split access by source IP address ('-s 192.168.2.2/32'), not by source interface name. That was really confusing and is not the same... For example I may have a LAN host 192.168.1.12/22 (yes, with a longer network mask). with default route to 192.168.2.1, packet will be routed via eth0:1, but goes out via eth1 that is incorrect according to original post...
If now everything works, you may close question (as self answered) and refund points in community support area.
If now everything works, you may close question (as self answered) and refund points in community support area.
ASKER
thanks alot
ok
can I make it from one LAN 192.168.2.0/24 (eth0) make load balance go out to eth1 and eth2 and eth3?
I need if client from LAN have to download something it use the whole bandwidth from the the three NIC
I make these but its not work
iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -o eth1 -j srcnat --to 10.10.10.10
iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -o eth2 -j srcnat --to 10.10.10.11
iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -o eth3 -j srcnat --to 10.10.10.12
ip route add default equalize nexthop via 10.1.1.1 dev eth1 nexthop via 10.1.1.1 dev eth2 nexthop via 10.1.1.1 dev eth3
but its not work
and I try
ip route add default equalize mpath rr scope global nexthop via 10.1.1.1 dev eth1 nexthop via 10.1.1.1 dev eth2 nexthop via 10.1.1.1 dev eth3
and I just write the device and remove 10.1.1.1 but it also not work
any idea ?
regards
ok
can I make it from one LAN 192.168.2.0/24 (eth0) make load balance go out to eth1 and eth2 and eth3?
I need if client from LAN have to download something it use the whole bandwidth from the the three NIC
I make these but its not work
iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -o eth1 -j srcnat --to 10.10.10.10
iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -o eth2 -j srcnat --to 10.10.10.11
iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -o eth3 -j srcnat --to 10.10.10.12
ip route add default equalize nexthop via 10.1.1.1 dev eth1 nexthop via 10.1.1.1 dev eth2 nexthop via 10.1.1.1 dev eth3
but its not work
and I try
ip route add default equalize mpath rr scope global nexthop via 10.1.1.1 dev eth1 nexthop via 10.1.1.1 dev eth2 nexthop via 10.1.1.1 dev eth3
and I just write the device and remove 10.1.1.1 but it also not work
any idea ?
regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
eth0:0 = 192.168.1.2 (LAN)
eth0:1 = 192.168.2.2 (LAN)
eth0:2 = 192.168.3.2 (LAN)
eth1 = 10.10.10.10 (WAN)
eth2 = 10.10.10.11 (WAN)
eth3 = 10.10.10.12 (WAN)
You like to configure all traffic that goes from LAN to WAN via eth0:0 to be nated as eth1 and go from eth1?
I guess that's impossible with Linux iptables and IP aliases,
because physical interface eth0 is the only one in a LAN side. So if we have a non-local packet appeared on interface eth0 from LAN we don't know to what ip alias it was send, for Linux all these packets are the same (since aliased IP address of the router can't be found in IP packet frame, only source and destination addresses).
Your problem has a solution, if you use tagged VLANs on eth0, then you will have 3 different interfaces, not only aliases on the same interface. If you can use VLANs, we will continue.