Actually you could get away without iptables and marking - with source routing. Just apply rules on source address to lookup different routing tables:
http://lartc.org/howto/lar
Main Topics
Browse All TopicsHello experts,
i have here a internet connection with 2 public IPs on it (in the future there may be 3 or 4 IPs).
Each IP shall be the gateway for 1 internal network.
For example the network 192.168.0.0 shall use the IP 88.88.88.88 as its gatway an route all its traffic via this ip to the internet.
The network 192.168.100.0 shall use the IP 99.99.99.99 as its gateway.
BUT both internal networks are not allowed to communicate with each other.
Do you have any clue how to do this? (i already tried with ipcop but it has only the ability to route between 1 internal and external network. In the future i have to have the possibility to use 3 or four networks...)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Actually you could get away without iptables and marking - with source routing. Just apply rules on source address to lookup different routing tables:
http://lartc.org/howto/lar
OK,
You are aware of the issues around source routing?
http://www.iss.net/securit
And some tools:
http://www.synacklabs.net/
You probably meant routing based on sources address which is quite a different thing... Also be aware that iptables are more in view and marking packets will be a hint to also look into routing tables (otherwise not seen).
Hello again,
as i read a few articles, heres my idea how to deal with this:
I want to split eth0 into eth0:1 eth0:2 eth0:3 eth0:4. Each :x will have its own public ip.
Then i think i will put my internal networks on eth1:1-eth1:4.
With this and routing enabled, it should be possible to use eth0:1 as a gateway for all machines on the first subnet that come from eth1:1.
Is that correct?
Also, do you have an idea for an example routing command for one of these four networks?
Thanks a lot!
eth0:1, eth0:2 etc are aliases for an interface (providing you a way have multiple addresses on an interface).
but it still is a ONE interface, where all traffic is mixed.
For separation you need VLAN's or separate interfaces.
A better solution might be to buy a small managed switch, that supports 802.1q (VLAN's)
have each interface as multiple vlans, then configure each network as a separate VLAN. (
VLAN 10 = 192.168.0.0 ; VLAN 20 = 192.168.100.0
VLAN 100 = 88.88.88.88 ; VLAN 110 = 99.99.99.99 )
On the switch configure one port for 802.1q and 4 ports for each of the vlans, untagged output.
configure eth0 for vlans (eth0.10 ; eth0.20 ) etc.
Now you have 4 (virtual interfaces) you can use for routing with separation.
Business Accounts
Answer for Membership
by: nociPosted on 2009-08-25 at 09:50:23ID: 25179536
you need to lookinto layered routing tables using iproute2 commands.
dv-multi-i nternet.ht ml /articles/ multihomed .php org/questi ons/linux- networking -3/ iproute 2-iptables -multiple- routes-squ id-with-ke rnel-2.6.2 9- 724406/
Using iptables youcan assign each network segment a specific routing table to use in stead of the default ones.
http://linux-ip.net/html/a
http://www.clintoneast.com
http://www.linuxquestions.
And although it seems old it is mosly still valild:
http://lartc.org/