Routing between 2 interfaces?
Hello everyone.
I'm playing with this about 3 days, and sometimes works sometimes not but never perfect. I have eth0 (connected in switch with internet connection) and ra0 (wireless card where few users connects). I need to use gateway 192.168.0.160 / 16 I want to route internet trought eth0 to ra0 and I want to access another computers which are in switch where is connected eth0... Please help me... I tried to make it eye-candy (like eth0 @ 192.168.1.1 lan users .1.XXX & ra0 @ 192.168.2.1 wifi users .2.XXX) but no luck. Thank You in advance! |
a) Please post details of your network settitngs.
b) Be more precise: what do you want to achieve? c) What have you tried? d) What exactly is not working? |
Quote:
Also need to have a look at your routing table on the machine with the eth0 and ra0 card in it. To see the routing tables at the command prompt as root type: route -n It will give you something like this, this is from one of my machines: billyg@gateway:~ $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 111.222.333.444 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 111.222.333.444 0.0.0.0 255.255.255.255 UH 0 0 0 ipsec0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 1.1.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0.0.0.0 111.222.333.444 0.0.0.0 UG 0 0 0 ppp0 The 111.222.333.444 is not a real address, i'm just masking my real ip address. Plus your interfaces will vary from this, but it will give you a general idea. |
Hello again...
First I tried this: Code:
ifconfig eth0 192.168.1.1 netmask 255.255.0.0 up After that I tried Code:
# Set up interfaces And lots of other not saved tricks... |
@stefan_nicolau:
d) I want to share internet connection on eth0 with ra0, and communication with users on wireless and users on switch where is eth0 connected. I get this once with some stupid routes, and restarted machine and everything is gone ;) |
Quote:
I don't think that you need masquarading (correct me if I missed something) And I repeat my original question: in what way does this setup not work? |
But I tried already to back old configs but it doesn't works maybe I missed something but anyway it doesn't works...
It doesn't work in way that users connected at ra0 doesn't have internet connection and can't ping ra0 ip or eth0 ip or any user behind eth0... That worked for I while and I messed something... |
Quote:
|
Look, I can now ping linux box (eth0 & ra0 ip) but I can't ping gateway or any user in network behind eth0....
My network configuration now looks like: Code:
ifconfig eth0 192.168.0.1 netmask 255.255.0.0 up Quote:
Quote:
|
Quote:
|
Than can you show me example how you would configure my network?
Thank you on fast answers :) |
If using ip masquerading from ra0 to eth0 then I don't think overlapping makes a difference here. This is the way I would get started based on info provided and assuming eth0 is the outside nic and ra0 would be and inside nic.
eth0 IP 192.168.0.1 Subnet 255.255.0.0 Gateway 192.168.0.160 DNS IP ***.***.***.*** ra0 IP 192.168.10.1 Subnet 255.255.255.0 No Gateway defined for ra0 Then goto http://easyfwgen.morizot.net/gen/ to build the iptables rules and ip masquerading. Only concern is the use of going from a class C on ra0 to a class B on eth0. Never done that before so cannot say if that is and issue. If worst case make ra0 172.16.0.1 edit: Check out this link. http://www.faqs.org/docs/linux_netwo...addresses.html It talks about the limits for IP classes 192.168.0.160 cannot be a class B network. Only 128.0.0.0 through 191.255.0.0 for class B and the non routable for is 172.16.0.0 through 172.31.0.0. Same for Class C 192.0.0.0 through 223.255.255.0 and the non routable ones 192.168.0.0 through 192.168.255.0. Use non routables ip if you do not have real IP's. New I was missing something. So this is wrong for a class B eth0 IP 192.168.0.1 Subnet 255.255.0.0 Gateway 192.168.0.160 DNS IP ***.***.***.*** Needs to be like eth0 IP 172.16.0.1 Subnet 255.255.0.0 Gateway 172.16.0.160 DNS IP ***.***.***.*** If you not need more than 255 IP on the eth0 side then I would make it a class C and use something like this and ra0 the same as above. eth0 IP 192.168.0.1 Subnet 255.255.255.0 Gateway 192.168.0.160 DNS IP ***.***.***.*** edit: Can goto the following to learn more on iptables and firewalls. http://www.linuxguruz.com/iptables/v http://iptables-tutorial.frozentux.n...-tutorial.html http://www.netfilter.org/ Brian1 |
Hello Brian1.
Thank You on lots of informations. But my gateway must be 192.168.0.160 /16 (defined by isp). So what should I do now? iptables generator didn't helped me. Thank You in advance. |
a) I think that the overlaping networks are a problem: On which network should a packet for 192.168.10.5 go? Because of the order in which they are in the routing table, this will probably work as expected, but it's still a very bad idea.
b) Quote:
|
change your another network to different class of ip address like 172.16.1.0/16 or others.
|
All times are GMT -5. The time now is 10:15 AM. |