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.
here it goes: i have a private network (192.168.0.x) and a server which gives some public ips through dhcp, and the other guys with private ips must have a gateway set up (192.168.0.xxx) to access the public ips.
the problem is that another server is up..and gives internet through NAT to some guys with private ips. so the problem is they cant access the guys with public ips cuze they use diff. gateway (gateway to NAT server)
what can i do to tell the nat clients to access the extern ips through local network?
hmm. How about assigning 2 IPs to the guys that have a real world IP. You couldn't use DHCP for both but you would set in a 192.168.0.x address for eth0:1 and use dhcp for eth0. That may not help in your situation. I don't know. But it's a suggestion.
Static routes are most likely your best bet. The following examples will give you an idea on how to setup static routes on your workstations:
For Windows:
route add DESTINATION_IP SUBET_MASK GATEWAY_IP
(example: route add 12.12.124.20 255.255.0.0 192.168.0.254)
This means that whenever the computer needs to reach the IP 12.12.124.20, it will ask 192.168.0.254 about it. The 192 address should be a system or router with knowledge about where the 12.x.x.x network is.
For Linux:
route add -net DESTINATION_IP SUBNET_MASK dev eth0
(example: route add -net 12.12.0.0 255.255.0.0 dev eth0)
This means that whenever the computer needs to reach the 12.12.x.x network, the request will be sent through the device "eth0". Just remember that in this case, your default gateway must have a route to the 12.12.x.x network, in order for the request to be passed on.
Also note that the public side will need a route BACK to the private systems. Otherwise, the public systems will get traffic, but won't know how to send it back!
i wrote and i wrote...and nothing. The thing is the public system have a route to the private systems..thats settled.
but the private system with internet from the NAT server use a diff. gateway..so I need some kind of link between the dhcp server and nat server...well..i think so..anyway
the default gateway on the nat server is a ISP gateway..so i cant change it
i might be wrong..if there can be another way..some hints.
please..be very explicit..i want to study from the commands
The bottom line is that you need to have a route for each hop in both directions. For example, let's say you have two routers on your network. Let's call them, router A, and router B. Let's pretend you have one router giving your network internet access, and the other router connects a remote office.
Not that it matters, but let's pretend router A is your internet router, and router B is for your remote office. If your default gateway is router A, and you want to be able to reach systems on the remote network via router B, you will need the following:
1. You will need to add a static route to the remote network, and that route entry MUST have router B's IP as your gateway.
2. Router B MUST have a route to the remote network, AND a route back.
3. The computer on the remote end MUST have a route back to the original network, with a gateway of router B's IP.
Once you do this, you will have a full route to and from. Your situation sounds very much like this one. I would attempt to solve your exact situation, but it's not making much sense to me. The bottom line with any kind of routing is that you make sure that every hop knows exactly where to go next.
I think the problem lies in the fact that he's probably NATing multiple internal IP addresses behind a single public IP. Most NAT gateways won't let a connection go through to the internal network unless you do 1-to-1 NAT or port forwarding.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.