Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to use a Linux box as a router between two networks, one with an external gateway and one without. Say the one with the gateway is 192.0.1. and the one without is 192.0.2. On the 192.0.1 network 192.0.1.1 is the gateway. So I install linux on a box with two nics, and configure one as 192.0.1.2 and the other as 192.0.2.1.
What do I do on the linux box so that traffic coming in on 192.0.2.1 interface is routed to the 192.0.1.2 interface? And how do I configure workstations on the 192.0.2 network so that they can get to the 192.0.1.1 gateway (and thus to the internet)?
Originally posted by BillJennings The gateway must always be on the local subnet (it must be directly accessable via a connected route). So...
If the computer address is A.B.C.D, then by tradition it's gateway is A.B.C.1.
Got it?
Sincerely
Bill Jennings
I do. But I'm still having some problems, after all. Let's back up and reconsider how I've got things configured. (I've changed the ip scheme a bit to make the distinctions in the two networks more obvious.) In the "router" I have two nics. The ip addr for eth0 is 172.16.0.3/24. On this network, the lan side of the router (to the internet) is 172.16.0.1. The ip addr for eth1 is 192.168.0.1/24. I want this to be the "gateway" for a second 192.168.0/24 network.
From the "router" I can ping hosts on either network (172.16.0/24 and 192.168.0/24). From hosts on the 192.168.0/24 network I can ping the gateway (per above, 192.168.0.1) and I can ping 172.16.0.3. Can I infer from the latter that the "ip route add" is doing its job?
Where the problem comes in is that while my 192.168.0/24 hosts can ping 172.16.0.3 (the ip addr of eth0 in the "router"), they cannot ping any other 172.16.0/24 host, including 172.16.0.1 . And without that, they cannot get to the internet (which is the ultimate objective).
Anybody else have any ideas here? Seems a common enough question, as others here are asking something similar .
What it boils down to, in my case, is two networks or subnets, say A and B. A is connected to the internet through a router. B is not. I have a linux machine with two nics, one on the A subnet, and one on the B subnet. What do I have to do so that hosts on the B subnet can get to the internet?
I've taken Bill's suggestion as far as I can. Hosts on B can get to the nic on A, but cannot get to any other host on A, nor to the router to the internet on A.
Is there a route table, either on B, or A, or both, that I need to pull this off?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.