LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-14-2008, 12:49 AM   #1
bangbang
LQ Newbie
 
Registered: Oct 2008
Posts: 10

Rep: Reputation: 0
Problem, seeting fedora 9 as a router.


Hai,...

Hai, i have a problem with setting a fedora 9 as a router.
I have done the following:
1 comp (fedora) as a router, eth0=192.168.7.8, eth1=192.168.22.1.
1 comp as client of fedora, 192.168.22.2.
1 komputer sebagaicomp as a gateway, 192.168.7.1

i have made the connection, and made the following setting:
1. Set ip on eth0 & eth1 on the fedora
2. Set gateway = 192.168.7.1 (Windows comp as gateway)
3. Set NAT on iptables
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

for this one i've also try:
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.22.0/24 -j SNAT -to-source 192.168.7.8

4. Set ip forwarding on /etc/sysctl.conf

Af ter that, i can ping from 192.168.22.2 to 192.168.7.8 and juga 192.168.22.1.
But i can't ping from 192.168.22.2 to 192.168.7.1.

Is this normal? (why can't i ping to my gateway)
Is there anything wrong or missing on my setting?

Oh yea, i also already set the client gateway to 192.168.7.1, and then to 192.168.7.8, and then to 192.168.22.1.
(i tried all possibility).

Thx,
rabbi
 
Old 10-14-2008, 07:33 AM   #2
WorldIsNotFair
Member
 
Registered: Jun 2008
Location: Jakarta
Distribution: CentOS 5
Posts: 89

Rep: Reputation: 17
you have to set a route to 192.168.22.0/24 from your gateway machine.

your gateway don't know how to route it if u don't set it.

use route add command to add persistent route (i forget on windows ),

try route /help on windows if u don't know or simply google it.

point the gateway for 192.168.22.0/24 to 192.168.7.8 on your gw machine.


if u already done above step & still didn't work, you can try below
step :

- make sure that your forward chain policy is set to accept,
if u want to set it drop, then u have to add rules for forwarding
packet.
or maybe u want to describe it more to us.

- make sure your gateway dont block the packet.

- try not to nat it first.
if u already activate forwarding , u should able to ping your
gateway from client.
make sure u restart your network service after modify sysctl.conf.
run sysctl -v | grep ip_forward , the value should be 1.

- after that success, then you can try to nat it, use masquerade for dynamic ip.


hope help friend.

Quote:
Originally Posted by bangbang View Post
Hai,...

Hai, i have a problem with setting a fedora 9 as a router.
I have done the following:
1 comp (fedora) as a router, eth0=192.168.7.8, eth1=192.168.22.1.
1 comp as client of fedora, 192.168.22.2.
1 komputer sebagaicomp as a gateway, 192.168.7.1

i have made the connection, and made the following setting:
1. Set ip on eth0 & eth1 on the fedora
2. Set gateway = 192.168.7.1 (Windows comp as gateway)
3. Set NAT on iptables
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

for this one i've also try:
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.22.0/24 -j SNAT -to-source 192.168.7.8

4. Set ip forwarding on /etc/sysctl.conf

Af ter that, i can ping from 192.168.22.2 to 192.168.7.8 and juga 192.168.22.1.
But i can't ping from 192.168.22.2 to 192.168.7.1.

Is this normal? (why can't i ping to my gateway)
Is there anything wrong or missing on my setting?

Oh yea, i also already set the client gateway to 192.168.7.1, and then to 192.168.7.8, and then to 192.168.22.1.
(i tried all possibility).

Thx,
rabbi
 
Old 10-17-2008, 05:02 AM   #3
bangbang
LQ Newbie
 
Registered: Oct 2008
Posts: 10

Original Poster
Rep: Reputation: 0
My gateway is using Windows XP, i can't add routing on it. (i don't know how).

But i use mikrotik router as trial (instead of the fedora, i switch the fedora with mikrotik router), it works fine, i can ping outside the router from another network segment without having to set the route in the gateway.

And, with the fedora, i already set the masquerade, shouldn't the gateway recognize my 192.168.22.0 network as 192.168.7.0 network?

Pleaase, any advice, i'm really lost.


Thx,
Bangbang
 
Old 10-19-2008, 08:58 AM   #4
WorldIsNotFair
Member
 
Registered: Jun 2008
Location: Jakarta
Distribution: CentOS 5
Posts: 89

Rep: Reputation: 17
yes it should nat it to 192.168.7.8.

try this on your fedora.

iptables -t nat -A POSTROUTING -s 192.168.22.0/24 -j MASQUERADE


please note that if your default policy is drop, then you must add rules in forward chain too.

it would be very helpful if you post your iptables rules with each ip config on every host.
 
Old 10-19-2008, 11:38 PM   #5
bangbang
LQ Newbie
 
Registered: Oct 2008
Posts: 10

Original Poster
Rep: Reputation: 0
I haven't got any other rules on the iptables, just the nat (masquerade).
And the other host, i didn't set anything else.

I will try it first, then i'll inform you again.

Thanks,
BangBang
 
  


Reply



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
Fedora 9 as a router,..... problem =( bangbang Linux - Newbie 2 10-14-2008 07:00 AM
Seeting Up the Java_home in Iplanet web server rajaniyer123 Solaris / OpenSolaris 1 04-12-2008 02:29 PM
Seeting up web server using fedora core 4 CrazyLou Linux - Server 1 09-06-2007 10:17 PM
Fedora or router problem? BobNutfield Fedora 2 02-26-2006 05:48 AM
help in seeting up a lan tuxfood General 1 04-24-2004 03:16 PM

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

All times are GMT -5. The time now is 04:32 AM.

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
Open Source Consulting | Domain Registration