LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-15-2003, 07:47 PM   #1
jmono
Member
 
Registered: Feb 2003
Location: Colombia
Distribution: Mandrake
Posts: 52

Rep: Reputation: 15
Thumbs down middle router


hi
ě`m trying to set up a linux router between two machines using Mandrake 9

the Linux machine (in the middle) has two network cards->
eth0-->
addr 10.1.0.1 mask 255.255.0.0
eth1-->
addr 10.2.0.1 mask 255.255.0.0

the first client is 10.1.0.2 with gateway 10.1.0.1 and the second one is 10.2.0.2 with gateway 10.2.0.1, both with the same mask 255.255.0.0

is this configuration ok??? i hope so...

anyway what i need is->
communicate the client 1 with the client 2 = router

i type this->
echo '1' > /proc/sys/net/ipv4/ip_forward
then
route add -net 10.1.0.0 netmask 255.255.0.0 gw 10.2.0.1 dev eth1
and
route add -net 10.2.0.0 netmask 255.255.0.0 gw 10.1.0.1 dev eth0
but nothing happen when i try to make ping to the client 2 from the client 1

do i miss something??


Last edited by jmono; 11-17-2003 at 02:53 PM.
 
Old 11-15-2003, 09:04 PM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Could you post the contents of these files:

/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1

Also what do you get when you type these two commands?
route
ifconfig
 
Old 11-15-2003, 09:08 PM   #3
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
You should be able to use mcc (Mandrake Control Center) to do most of this quite easily.
Click on Network & Internet -> DrakConnect will allow you to setup the NIC cards.
Click on Network & Internet -> DrakGw will allow you to setup a Gateway.
 
Old 11-16-2003, 01:34 PM   #4
jmono
Member
 
Registered: Feb 2003
Location: Colombia
Distribution: Mandrake
Posts: 52

Original Poster
Rep: Reputation: 15
the contents.
network->
NETWORKING=yes
FORWARD_IPV4="yes"
HOSTNAME="server.a.a"
DOMAINNAME=a.a
GATEWAY="10.1.0.1"
GATEWAYDEV="eth0"

ifcfg-eth0->
DEVICE·="eth0"
BOOTPROTO="none"
IPADDR="10.1.0.1"
NETMASK="255.255.0.0"
NETWORK=10.1.0.0
BROADCAST=10.1.255.255
ONBOOT="yes"
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"

the ifcfg-eth1 the same as the eth0 but in the other sub-network -> 10.2.0.0

and when i type route i get->
Kernel IP routing
Destination Gateway Genmask Flags Interface
10.2.0.0 10.1.0.1 255.255.0.0 U eth0
10.1.0.0 10.2.0.1 255.255.0.0 U eth1

and ifconfig shows me eth0 and eth1 configuration and they are ok as in the above files.

about MCC, that is the last option i wanna use, i want to do it in the console mode

thanks mate for your help!!!
 
Old 11-17-2003, 03:02 PM   #5
jmono
Member
 
Registered: Feb 2003
Location: Colombia
Distribution: Mandrake
Posts: 52

Original Poster
Rep: Reputation: 15
i have some progress now... but i really need help now

i`m able to communicate the client 2 with the client 1 after this:
iptables -A FORWARD -i eth1 -j ACCEPT
iptables - t nat -A POSTROUTING -o eth0 -j MASQUERADE
but i also read that i do not need MASQUERADE if i am not using dynamic-IPs ??????

anyway it works, but the client 1 is not bale to communicate with the client 2

is the gateway the problem?????
when i read the file /etc/sysconfig/network it says GATEWAY=10.1.0.1 GATEWAYDEV= eth0

do i need anything like GATEWAY=10.2.0.1 GATEWAYDEV=eth1 to resolve my problem???
can i do that???
 
Old 11-17-2003, 03:27 PM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Is this a Novell network?

Try changing BOOTPROTO="none" to BOOTPROTO="static" in the ifcfg-eth0/1 files. Then type this to restart the network, service network restart.

Also could you post the results of ifconfig.
 
Old 11-17-2003, 03:55 PM   #7
jmono
Member
 
Registered: Feb 2003
Location: Colombia
Distribution: Mandrake
Posts: 52

Original Poster
Rep: Reputation: 15
i already did that but it still doesn`t work!!

my ifconfig result for eth0 and eth1->
eth0
Link encap: Ethernet HWaddr 00:00:E8:86:3E:2E
inet addr: 10.1.0.1 broadcat: 10.1.255.255 mask: 255.255.0.0
UP BROADCAST RUNNING MULTIMCAST MTU: 1500 Mmetric:1
RX packets: 357 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 618 errors: 0 dropped: 0 overruns: 0 carrier: 0
collisions: 0 txqueuelen: 100
RX bytes:120724 (117.8 Kb) TX bytes: 48492 (47.3 kb)
Interrupt:11 Base address 0xf800

eth1
Link encap: Ethernet HWaddr 00:00:E8:86:3E:2E
inet addr: 10.2.0.1 broadcat: 10.2.255.255 mask: 255.255.0.0
UP BROADCAST RUNNING MULTIMCAST MTU: 1500 Mmetric:1
RX packets: 365 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 809 errors: 0 dropped: 0 overruns: 0 carrier: 0
collisions: 0 txqueuelen: 100
RX bytes:33132 (32.3 Kb) TX bytes: 143620 (140.2 kb)
Interrupt:11 Base address 0x8c00

and lo but this is not necessary i think...
 
Old 11-17-2003, 04:17 PM   #8
jmono
Member
 
Registered: Feb 2003
Location: Colombia
Distribution: Mandrake
Posts: 52

Original Poster
Rep: Reputation: 15
and no, it is not a novell network!!!
i don`t know why IPX there!!!
 
Old 11-17-2003, 04:37 PM   #9
zaphodiv
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 30
>nothing happen when i try to make ping to the client 2 from the client 1
>do i miss something??

You need the routing table on client1 set so it sends packets addressed to 10.2.x.x to 10.1.0.1

You need the routing table on client2 set so it sends packets addresses to 10.1.x.x to 10.2.0.1

>then route add -net 10.1.0.0 netmask 255.255.0.0 gw 10.2.0.1 dev eth1
>and
>route add -net 10.2.0.0 netmask 255.255.0.0 gw 10.1.0.1 dev eth0

You are doing the above command on the server when you should be doing them on the clients.

Just setting the ip and netmask on you network cards should leave your routing table in a state that will send traffic in the right direction.

Typing those route commands on the router will probably break it by sending packets out the wrong network card.

If the client will allways need to send traffic to a destination outside their subnet via the router (and not, for example, access the internet via a different gateway) then you can set the default route of the clients in
the 10.1.x.x network to 10.1.0.1 and set the default route of the clients in
the 10.2.x.x network to 10.2.0.1

I guess you have the default route of client 1 set to the router because it worked when you set the linux box to do network address translation instead of forwarding packets unmolested.

>i`m able to communicate the client 2 with the client 1 after this:
>iptables -A FORWARD -i eth1 -j ACCEPT
>iptables - t nat -A POSTROUTING -o eth0 -j MASQUERADE

Doing it this way means that when client1 connects to client2, client2 sees an incoming connection from the router's ip address instead of from client1's ip address.

You are only NATing one way through the router.
You could try NATing the other way as well eg
iptables -A FORWARD -i eth0 -j ACCEPT
iptables - t nat -A POSTROUTING -o eth1 -j MASQUERADE

I don't know if a two way NAT will work, let us know if you try it.
 
Old 11-17-2003, 05:01 PM   #10
jmono
Member
 
Registered: Feb 2003
Location: Colombia
Distribution: Mandrake
Posts: 52

Original Poster
Rep: Reputation: 15
it doesn`t work
i set up the other NAT way too
but the client 1 doesn`t ping the client 2 in the other subnetwork!!

i don`t know what else to do!!
 
Old 11-17-2003, 05:03 PM   #11
jmono
Member
 
Registered: Feb 2003
Location: Colombia
Distribution: Mandrake
Posts: 52

Original Poster
Rep: Reputation: 15
the client 1 has the following configuration
IP address 10.1.0.2
netmask 255.255.0.0
gateway 10.1.0.1
running on Windows 2000 pro

and the client 2
IP address 10.2.0.2
netmask 255.255.0.0
running on W98
gateway 10.2.0.1
 
Old 11-17-2003, 05:45 PM   #12
zaphodiv
Member
 
Registered: Oct 2003
Distribution: Slackware
Posts: 388

Rep: Reputation: 30
If you set up the linux router as you said in the first post but don#'t mess with the routing on it tehn in theory that should work.

Preshaps it is time to start sniffing to see exactly where the packets get lost.
 
Old 11-17-2003, 10:33 PM   #13
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
eth0
Link encap: Ethernet HWaddr 00:00:E8:86:3E:2E
eth1
Link encap: Ethernet HWaddr 00:00:E8:86:3E:2E

What are the odds that you would have two ethernet cards with the same HWaddr? Is this a dual port NIC?


Now I noticed an error in /etc/sysconfig/network
GATEWAY="10.1.0.1"
Try removing that then
service network restart

If you still have problems would you post the routing table?
route
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I add a second gateway to my linux router? abefroman Linux - Networking 1 11-20-2005 12:45 PM
Using Linux as a gateway with hardware router spudtheimpaler Linux - Networking 1 08-22-2005 02:39 PM
Linux box as a gateway/router dooda5555 Linux - Networking 2 04-29-2005 02:06 PM
Using Linux as an internet router / gateway bashworth Linux - Networking 2 09-10-2004 07:00 PM
Linux as a gateway/router Why is it so difficult? quincy56 Linux - Networking 14 01-29-2002 07:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration