Operating System - Linux
1830061 Members
2606 Online
109998 Solutions
New Discussion

the client can not got default gw setting via linux route but only localnet

 
SOLVED
Go to solution

the client can not got default gw setting via linux route but only localnet

I try to use one linux system as router, with multiple net-interface. the topologic as bellows:
subnet1(192.168.1.0/24)<->(192.168.1.254)router
subnet2(192.168.2.0/24)<->(192.168.2.254)router

the router's gateway interface is 192.168.0.4 and the gw is 192.168.0.254, which transfer the ip to internet via the next routers.which add by:
route add default gw 192.168.0.254 dev eth0;
in the router side.

the simple router can work but only one fail that any clients in subnets can not via to internet by the default gw setting in router as 192.168.0.254, except for the machinese of subnet(192.168.0.0/24) can proceed, which set the router's interface9192.168.0.4) as gw.

I have not use MASQ, I do not see why MASQ must be used in the router. On the other hand, I have not to use Zebra for a router usage yet. Isn't that it is possible to make one simple router by only multiple interface as well as route utilties? Why?

thanks for any tips.
Frederick Van targero
7 REPLIES 7
Alexander Chuzhoy
Honored Contributor

Re: the client can not got default gw setting via linux route but only localnet

I'm sorry , but I couldn't understand a part of the question...

Anyway since the IP addresses that you use are from a private range (i.e. you can't use them on the internet) you must somewhere have a nat.

If 192.168.0.254 can access the internet ,that means that somewhere between it and the internet is a NAT and thus you don't need to configure another NAT on your router
Jerome Henry
Honored Contributor

Re: the client can not got default gw setting via linux route but only localnet

Does your router route ? Did you enable ip forward ?
From any machine in 192.168.1.0 subnet, can you ping any machine in 192.168.0.0 subnet ? Can you pin router IP ?

You shouldn't need to set up zebra, unless you wish to use elaborated routing protocl such as ospf... But to go to the internet, rip or static path should be enough.

So could you detail your router configuration and tell us about this connectivity ?

Tks

Jerome Henry
You can lean only on what resists you...

Re: the client can not got default gw setting via linux route but only localnet

dear Alex,
yes, the 192.168.0.254 is the inside interface of one internet gateway. so, if someone set the gw to 192.168.0.254 it will go to internet, of course, the private range ip is only used inside the lan.

Re: the client can not got default gw setting via linux route but only localnet

Dear Henry,

>Does your router route ? Did you enable ip >forward ?
I thought I have cleared all MASQ on purpose.
>From any machine in 192.168.1.0 subnet, can >you ping any machine in 192.168.0.0 >subnet ? Can you pin router IP ?

Yes, I can ping any machine in 192.168.0.0/24, either the router IP,too. I repeated that Only it can not get the default gw setting via router, every other issue is normal.

thanks very much indeed
frederick
Alexander Chuzhoy
Honored Contributor
Solution

Re: the client can not got default gw setting via linux route but only localnet

can you send us a routing table from your router?

You should have an entry on your router
0.0.0.0 netmask 0.0.0.0 gw 192.168.0.254 eth?


while eth? is the adapter that has the address 192.168.0.4


for your tipical client the routing table should hold something like this:
0.0.0.0 netmask 0.0.0.0 gw 192.168.1.254
if it sits on 192.168.0.0 subnet
Jerome Henry
Honored Contributor

Re: the client can not got default gw setting via linux route but only localnet

Yes, your routing table would help us understand. It seems that you haven't set up defaul route above gw...
Would I be right to see your network this way ?


192.168.1.0/24----------192.168.1.254(lnux)
192.168.2.0/24----------192.168.2.254(lnux)
192.168.0.0/24----------192.168.0.254(lnux)
|
192.168.0.4 (router to Internet)

Now 192.168.1.x pings 192.168.2.x and 192.168.0.x, including 192.168.0.4, but don't go to Internet.
192.168.2.x pings 192.168.1.x and 192.168.0.x, including 192.168.0.4, but don't go to Internet.
192.168.0.x pings 192.168.1.x and 192.168.2.x, including 192.168.0.4, and goes to the Internet, which is normal.
Am I wrong somewhere ?

Jerome Henry
You can lean only on what resists you...

Re: the client can not got default gw setting via linux route but only localnet

Dear both,
I found the error last night, you are right, one route entry to the inner 192.168.1.0/24 or the other must be added into the public router which via inside to internet by interface of 192.168.0.254.

Thanks you both very much indeed.
Fredeirck