rh9 Routing Prob. using Linux between router and Win Client
Hi -
I am new to Linux (1 week?) and work only on shell, so go easy on me :-) I have a Router through which we share one dsl for 4 people. The router (a Netgear box) is also used as NAT and dhcp, so it gives the clients IP adresses and DNS location. I try to connect a linux between my winXP client, and the router. The linux has two eth-cards : one (eth0) is connected to the router, the other (eth1) to my winXP client. The router has the ip 192.168.0.1. eth0 is getting its ip from the router, and functions ( i can surf with lynx ) eth1 i give a static address of 192.168.100.1 the win machine runs on 192.168.100.2. I can ping between linux and win, but the win machine does not get to the net, and I have no clue as how to give it a DNS access - but first I will be glad to be able to ping from my XP to the router... You will proably ask me for "routes" so I quote it here: Dest // Gateway // Genmask // Flags // Metric // ref // use // Iface 192.168.100.0 // * // 255.255.255.0 // U // 0 // 0 // 0 // eth1 127.0.0.0 // * // 255.0.0.0 // U / 0 / 0 / 0 / lo default // 192.168.0. 1 // 0.0.0.0 // UG / 0 / 0 / 0 / eth0 I turned also my iptables off, but it did not really improve anything... Be glad for help ... Greetings, Ron |
192.168.100.0 and 192.168.0.0 are different networks without a router you cannot get them to ping or any connectivity. you have to set up the Linux box to act as a router. You may have to give the windows box a static IP. And make sure your real router routes for both networks.
Make your eth1 ip the default gateway on your windows box. And add routes through the Linux box so traffic for the network 192.168.100.0 This is done using the route command syntax: # route [add,del] [-net, -host] [addy] netmask [mask] gw [gwaddress] dev [eth0] Addy option is the destination network to which you want to offer a route. To display the routing table use the command route with no parameters. Troubleshooting: netstat can be used to display the status of all network connections. -r option shows the routing table -n does not perform name resolution traceroute - can be used to view hops |
You need to activate ip routing
make sure you have 1 in the file /proc/sys/net/ipv4/ip_forward This is a command that should do it: echo 1 > /proc/sys/net/ipv4/ip_forward that should do the trick. |
must i use NAT?
Hi -
Thank you both for the answers - I set the ip_forward to 1 and played a bit with route (which does not really functions like it is written in man) and I advanced a bit : Now my windows machine can ping other clients on the network and they can ping it, but it can not go to the internet, nor ping the router. I am suspecting the router denies it... so the network looks like this: Code:
Internet Is the problem on the router box? Greetings, Ron |
why don't you put everything in the same subnet? ie: 192.168.0.x?
|
ifconfig, route and so on
Hi - thanks for your answer - here are the details...
Well - I tried to put them all on 192.168.0.X but I did not succeed to the mutter of being able to ping them all, and was already very glad to be able to ping other clients on the network from inside the win machine - this stopped as I changed them all to the same network, I will however try again, maybe I have done some routing mistake. For now - here are the details you asked for.... Code:
Greetings, Ron |
Sorrry to have you made change everything, I just _asked_ why you needed 2 subnet.
Anyways, what is important here is to configure your default gateway correctly Each of the machine in the 192.168.100.x and 192.168.0.x must have the router as their default gateway (ex: 192.168.100.2 must have 192.168.100.1 as default gateway and 192.168.0.123 must have 192.168.0.7 as default gateway). Then, the router must have your netgear box as default gateway. |
Hi - thanks again :-))
I did check it again and it does not function with one subnet... but i guess i could use the practice... Now, to be sure we are talking about the same thing : 1. The netgear box gets its gateway from the ISP. it has also an intern IP of 192.168.0.1 2. The Linux Box has two eth cards: 2.1. eth0 (192.168.0.7) has no gw set 2.2. eth1 (192.168.100.1) has also no gw set 2.3. default route 0.0.0.0 has the gw 192.168.0.1 (the netgear box) 3. windows (192.168.100.2) has the gw 192.168.100.1, which is the eth1 on the linux. The funny thing is, that I can contact, for example, 192.168.0.4, or each other client from the network, but not the netgear box, and not the internet, so I suspect the netgear box does not route the subnet 192.168.100.X. I set on the netgear box a static route to 192.168.100.0 through gw 192.168.0.7 (eth0) which enables other to ping the win, and win to ping others, but... hmm... maybe you have a clue? Thanx again... Many Greetings, Ron |
Of course I do have a clue :)
your mistake point 2. : The Linux Box must have 192.168.0.1 as a gateway. You define this in /etc/sysconfig/network in the format GATEWAY=192.168.0.1 Please try this out. |
yes - this is already set... :-(
I define in /etc/hosts router as 192.168.0.1 I can also use lynx from the linux to surf... (well - not much color there...) ??? :-( Greetings, Ron |
if you suspect that the netgear does not route traffic that doesn't come from its subnet, you must use NAT
|
btw, your routing seems ok. sorry for all the steps, but it is really hard to figure it out from here.
For NAT'ing I usually instal webmin, go into the firewall section and tell it to masquerade. Lame, but it works. (you can then maybe check for the rules)..For more complex firewalls, I modify some scripst I have. You can also check here for some samples http://iptables-tutorial.frozentux.n...-tutorial.html |
yes - i will do it tommorow (here in europe it is now midnight...)
I hoped i can solve this otherwise, since the linux runs on a pII 233, and i am not sure about performance issues when using NAT... Anyway, I start to figure out something about networking - it isn't so bad... Thanks alot, I will replay when I try the next step... Cheers, Ron |
Nat is not cpu-extensive.
I run a firewall with complete rules on Pentium 166 here, load average: 0.00 0.00 0.00 :) gnite! |
Hi - I finally did it !
I changed the router (netgear box) netmask from 255.255.255.0 to 255.255.0.0 so it feels also responsible for the 192.168.100 network - and it works ! I can ping the netgear, I can ping the internet and so on. The only problem is, my win maschine has a static ip, and thus a static DNS, whereas I would like it to get the DNS server IP eather from the netgear router or from the linux, which gets it from the router... But I guess that is a win problem - so I search some help somewhere else - Many Thanx, Ron |
All times are GMT -5. The time now is 06:13 PM. |