* Linux Router
@ 2005-02-06 17:36 spdesai
2005-02-06 19:46 ` Jason Opperisano
2005-02-07 20:43 ` srg
0 siblings, 2 replies; 3+ messages in thread
From: spdesai @ 2005-02-06 17:36 UTC (permalink / raw)
To: netfilter
Hi
I have one linux machine with two NIC cards. One is connected to internet and
one is private PC. Below is my IP configuration
eth0: Valid IP: xxx.xxx.xxx.68
Mask: 255.255.255.192
Gateway: xxx.xxx.xxx.65
eth1: Invalid IP: 192.168.1.1
Mask : 255.255.255.0
Gateway: xxx.xxx.xxx.65
Now when i connect eth1 to window machine. i can ping up to eth0 valid ip i.e
xxx.xxx.xxx.68 but could not ping xxx.xxx.xxx.65 which is gateway ip of linux.
I have enable ip_forward to 1 in linux machine.
My window machine ip is:
IP: 192.168.1.2
Mask:255.255.255.0
GW: 192.168.1.1
Pl. give me the solution so i can ping xxx.xxx.xxx.65 from my window machine.
Thanks in advance
suhag.
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Linux Router
2005-02-06 17:36 Linux Router spdesai
@ 2005-02-06 19:46 ` Jason Opperisano
2005-02-07 20:43 ` srg
1 sibling, 0 replies; 3+ messages in thread
From: Jason Opperisano @ 2005-02-06 19:46 UTC (permalink / raw)
To: netfilter
On Sun, 2005-02-06 at 12:36, spdesai@gnvfc.net wrote:
> Hi
>
> I have one linux machine with two NIC cards. One is connected to internet and
> one is private PC. Below is my IP configuration
>
> eth0: Valid IP: xxx.xxx.xxx.68
> Mask: 255.255.255.192
> Gateway: xxx.xxx.xxx.65
>
> eth1: Invalid IP: 192.168.1.1
> Mask : 255.255.255.0
> Gateway: xxx.xxx.xxx.65
you shouldn't have a default gateway on your internal interface.
default gateway == gateway of last resort; i.e., there's one (barring
some specific multipath routing situation).
> Now when i connect eth1 to window machine. i can ping up to eth0 valid ip i.e
> xxx.xxx.xxx.68 but could not ping xxx.xxx.xxx.65 which is gateway ip of linux.
>
> I have enable ip_forward to 1 in linux machine.
>
> My window machine ip is:
> IP: 192.168.1.2
> Mask:255.255.255.0
> GW: 192.168.1.1
>
> Pl. give me the solution so i can ping xxx.xxx.xxx.65 from my window machine.
my guess is that you haven't created an outbound MASQ/SNAT rule (at
least you don't say you have):
# IF YOUR ETH0 IP IS STATIC
iptables -t nat -A POSTROUTING -o eth0 \
-j SNAT --to-source xxx.xxx.xxx.68
-OR-
# IF YOUR ETH0 IP IS DYNAMIC
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
-j
--
"I've always wondered if there was a god. And now I know there is --
and it's me."
--The Simpsons
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Linux Router
2005-02-06 17:36 Linux Router spdesai
2005-02-06 19:46 ` Jason Opperisano
@ 2005-02-07 20:43 ` srg
1 sibling, 0 replies; 3+ messages in thread
From: srg @ 2005-02-07 20:43 UTC (permalink / raw)
To: spdesai, netfilter
Hello:
You have two solutions (one exclude the other):
1. NO nat in the linux machine.
The solution is adding a static route at the router (.65) in the form:
ip route add 192.168.1.0/24 via xxx.xxx.xxx.68
With this solution traffic from your private network is seen by the
router with the real source address (192.168.1.x).
Of course, if you want this traffic to go to Internet then, the router
must do source nat (because the source addr will be a private one).
2. nat in the linux machine.
iptables -A POSTROUTING -t nat -o eth0 -s 192.168.1.0/24 -d 0/0 -j
MASQUERADE
With this solution, traffic originating in your private net will have
xxx.xxx.xxx.68 source address when the packets leave the linux machine,
so when the packets arrive to the router (xxx.xxx.xxx.65) will have the
xxx.xxx.xxx.68 addr (in other words, if you want, those packets can go
directly to the Internet without the need of another nat in the router)
spdesai@gnvfc.net wrote:
>Hi
>
>I have one linux machine with two NIC cards. One is connected to internet and
>one is private PC. Below is my IP configuration
>
>eth0: Valid IP: xxx.xxx.xxx.68
> Mask: 255.255.255.192
> Gateway: xxx.xxx.xxx.65
>
>eth1: Invalid IP: 192.168.1.1
> Mask : 255.255.255.0
> Gateway: xxx.xxx.xxx.65
>
>
>Now when i connect eth1 to window machine. i can ping up to eth0 valid ip i.e
>xxx.xxx.xxx.68 but could not ping xxx.xxx.xxx.65 which is gateway ip of linux.
>
>I have enable ip_forward to 1 in linux machine.
>
>My window machine ip is:
>IP: 192.168.1.2
>Mask:255.255.255.0
>GW: 192.168.1.1
>
>Pl. give me the solution so i can ping xxx.xxx.xxx.65 from my window machine.
>
>Thanks in advance
>
>suhag.
>
>
>
>-------------------------------------------------
>This mail sent through IMP: http://horde.org/imp/
>
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-02-07 20:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-06 17:36 Linux Router spdesai
2005-02-06 19:46 ` Jason Opperisano
2005-02-07 20:43 ` srg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox