Solved

Linux TCP/IP Routing

Posted on 1997-01-24
2
299 Views
Last Modified: 2012-07-12
Hi,

Can linux be setup so that one ethernet card can be assigned 2 or more ip addresses each on a differnet subnet and route between all subnets?

Robert


0
Comment
Question by:Robert011497
2 Comments
 
LVL 1

Accepted Solution

by:
mart010897 earned 50 total points
ID: 1584158
Hi,

Yes, you can do that, but that assumes that all of the IP networks that you're going to be routing are being spoken on that same wire.  That having been said,  here's what you need to do:

You need to have a kernel that's set up to do both aliasing and routing.  Then, at your shell prompt as root, try this:

ifconfig

You'll (hopefully) see eth0 of the IP address you gave it happy happy.  Now you want to add another network address to eth0-- let's say 10.0.0.0 network:

ifconfig eth0:1 inet 10.0.0.1 netmask 255.0.0.0 broadcast 10.255.255.255 up

You can check that it worked by going:

ifconfig

again.  You should see an eth0 interface and an eth0:1 interface.

Then you want to add the corresponding net route thru that interface so that Linux knows it can forward packets destined for that network:

route add -net 10.0.0.0 gw 10.0.0.1

or

route add -net 10.0.0.0 eth0:1

I prefer the first form.  Now you should be good to go.  It'll act just like a linux box that has two IP interfaces in it.

Read up on your routing, and don't forget that every interface that has an IP needs to have a corresponding net route pointing to its own IP as the route to whatever net it's on.

Good luck!

Mart
0
 
LVL 3

Expert Comment

by:RitBit
ID: 38181219
Above description is almost accurate but you might need to enable up-forwarding in the kernel with:
sysctl -w net.ipv4.ip_forward=1

Open in new window

or
echo 1 > /proc/sys/net/ipv4/ip_forward

Open in new window

And make sure there is no firewall (iptables) blocking traffic....
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question