• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1125
  • Last Modified:

how to configure my router on linux?

I use centos4.2(RHEL4.2). I want to configure a router on linux.
My pc-router has three ethernet cards. The ip adress of the three cards are:
192.168.1.4    to internet(net1)
192.168.2.4    to acces to the net 192.168.2.0/24(net2)
192.168.3.4    to acces to the net 192.168.3.0/24(net3)
I have also set ip_forward to 1.
What else must I configure to run my router?
I want that any pc on the net 192.168.2.0/24(net2) can ping, or ssh to any pc on the net 192.168.3.0/24(net3).
When I run 'route', what must I see for my router?
0
gdmo
Asked:
gdmo
  • 2
1 Solution
 
bourneispCommented:
Hi gdmo,

the way i would do this would be by using iptables/ipchains.

give one of the interfaces a default gateway out to the internet.
your client machines should use the ip of your gateway linux router as their gateway
ie.

192.168.1.0/24 gw = 192.168.1.4
192.168.2.0/24 gw = 192.168.2.4
192.168.3.0/24 gw = 192.168.3.4

Then using iptables/ipchains set the outbounds rules you require.
firewalls built into linux can get quiete complex and you can create quite and advance firewall allow access based on source and destination interfaces, ports, source and destination ip etc....
Cheers!
0
 
gdmoAuthor Commented:
I  have done what you wrote above about the gateways.
in fact, I have more than three nets.  when I issue 'route' on my pc,  I get:
[root@rato etc]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.6.0     192.168.6.4     255.255.255.0   UG    0      0        0 eth3
192.168.5.0     192.168.5.4     255.255.255.0   UG    0      0        0 eth2
192.168.4.0     192.168.4.4     255.255.255.0   UG    0      0        0 eth1
192.168.3.0     192.168.3.4     255.255.255.0   UG    0      0        0 eth0
192.168.9.0     192.168.9.4     255.255.255.0   UG    0      0        0 eth6
0.0.0.0         192.168.3.3     0.0.0.0         UG    0      0        0 eth0

But I do not succeed that a pc from the net 192.168.3.0 ping another pc from the net 192.168.5.0.
You wrote that I should set "the outbounds rules that I require".  I have read the doc about iptables, but I have never yet used iptables. I am a newbie in networking. Which command should I do with iptables to ping? I want that any pc on the net 192.168.5.0/24(net5) can ping, or ssh to any pc on the net 192.168.9.0/24(net9).
0
 
bourneispCommented:
Hi gdmo

Do you have any firewalls set on any of these networks at the moment or the machines you are trying to connect to.

this looks to be quite a complex network and there could be many places that this could be failing.

Try doing a traceroute from a machine on the 192.168.3.0/24 to a machine on the 192.168.5.0.

Cheers
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now