View previous topic :: View next topic |
Author |
Message |
mycroes Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/The Matrix/movie_the_matrix_agent_smith.gif)
Joined: 26 May 2003 Posts: 110 Location: Netherlands
|
Posted: Tue Jun 03, 2003 4:38 pm Post subject: Iptables advanced routing |
|
|
Just to introduce my situation: I'm using windows 2000 on this pc. This pc is connected to my Gentoo pc that will be server for my web page soon. The Gentoo pc is connected to a hub through another NIC, and on the hub there are several other pc's (running windows).
I managed to get all my pc's/NICs on the same subnet, and I'm using iptables with ipv4_forwarding to have internet on my windows 2000 pc. Now the problem is I want to have acces to the other pc's in the network (that are connected to the hub). I can see them in network neigboorhood, but I can't acces them.
The iptables commands I used on my Gentoo pc are:
iptables -A POSTROUTING -t nat -s 192.168.0.54 -o eth0 -j MASQUERADE
iptables -A POSTROUTING -t nat -s 192.168.0.1/24 -o eth1 -j MASQUERADE
192.168.0.54 is my windows 2000 pc, eth1 is connected to the 2000 pc, eth0 is going to the hub with the other pc's.
Am I doing anything wrong or can't it be done what I want?
Thnx in advance.
Greetings,
Michael _________________ In a world without walls or fences we don't need windows or gates |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
DefconAlpha Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/19877044473e6f752d29406.png)
Joined: 25 Feb 2003 Posts: 151 Location: Alabama
|
Posted: Tue Jun 03, 2003 5:08 pm Post subject: Masquerading |
|
|
I'm not exactly sure why you have the win2k box plugged into the hub (dmz or something?) but you won't need to use masquerading. You will want to bridge the two networks together. I think that you will want something on the order of
Code: | iptables -t nat -A PREROUTING -i win2knic -o lannic -J SNAT |
though i'm sure that this specific command won't work. I have all of the documentation at work if you can't find any good tutorials on netfilter bridging (i can't for the life of me find that tutorial... good thing i printed it out :)
Regardless of the command you will have to bridge the two subnets together, not masquerade them...
[edit]
So I don't have a short term memory. At all. :) Keep me posted on what you find out, and i will get the docs as soon as i can (latest tomorrow at work) _________________ In the end, the love you get is equal to the love you make
--John Lennon & Paul McCartney (The End - Abbey Road,
Last edited by DefconAlpha on Tue Jun 03, 2003 9:57 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mycroes Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/The Matrix/movie_the_matrix_agent_smith.gif)
Joined: 26 May 2003 Posts: 110 Location: Netherlands
|
Posted: Tue Jun 03, 2003 5:15 pm Post subject: iptables |
|
|
the Gentoo pc is connected to the hub, the win2000 pc is only connected to the gentoo pc... I'll try to do some with the prerouting command.
Thnx anyway
Greetings,
Michael _________________ In a world without walls or fences we don't need windows or gates |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
uzik Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 17 Apr 2003 Posts: 257
|
Posted: Tue Jun 03, 2003 7:07 pm Post subject: |
|
|
I would think you'd want to set rules for the "FORWARD" chain
to forward traffic from one NIC to the other on the gentoo box.
for file sharing you need to allow traffic on ports 137 and 139 through
from one nic to the other. I've never tried file sharing on separate
subnets, but I thought it would work fine. I don't think you need
masquerade |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mycroes Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/The Matrix/movie_the_matrix_agent_smith.gif)
Joined: 26 May 2003 Posts: 110 Location: Netherlands
|
Posted: Tue Jun 03, 2003 7:17 pm Post subject: What you don't seem to understand... |
|
|
The windows 2000 pc and the other pc's in the hub are on the same subnet (192.168.0.x, subnet mask 255.255.255.0). I think that I indeed may be searching for forwarding, but could you please give a (working) example (the prerouting example by DefconAlpha wasn't working )?
Greetings,
Michael _________________ In a world without walls or fences we don't need windows or gates |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
uzik Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 17 Apr 2003 Posts: 257
|
Posted: Tue Jun 03, 2003 10:21 pm Post subject: Re: What you don't seem to understand... |
|
|
mycroes wrote: | The windows 2000 pc and the other pc's in the hub are on the same subnet (192.168.0.x, subnet mask 255.255.255.0). I think that I indeed may be searching for forwarding, but could you please give a (working) example (the prerouting example by DefconAlpha wasn't working )?
Greetings,
Michael |
I can't guarantee this will work for you but I'll give it a try:
# from eth0 to eth1
iptables -A FORWARD --sport 137:139 -i eth0 -o eth1 -j ACCEPT
# from eth1 to eth0
iptables -A FORWARD --sport 137:139 -i eth1 -o eth0 -j ACCEPT
I dont have time to solve this problem for you.
Find the "how to" on iptables, it will help with this.
I'm not sure if you need input and output rules in
addition to the forward rules, but I thought not.
Port 137 is for file sharing, port 139 is for the network
neighborhood announcement packets |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
DefconAlpha Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/19877044473e6f752d29406.png)
Joined: 25 Feb 2003 Posts: 151 Location: Alabama
|
Posted: Wed Jun 04, 2003 2:46 pm Post subject: Bridge |
|
|
Well, i have done some hunting and i think that the easiest thing to do would be to make a pseudo-bridge. The advanced linux routing project has some dox on it, but basically here's what you should do to test it out:
1: flush out all of your iptables rules (may not even need iptables for this)
2: create routes so that gentoo box can talk to either pc (already done from what it seems)
3: echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp
echo 1 > /proc/sys/net/ipv4/ip_forward (if not already on)
4: run the 'arping' tool
if that doesn't work well, issue
echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind so you can send out unsolicted arp messages.
Give this a shot, i'm curious to know if it works (i will probably want to use something like this) _________________ In the end, the love you get is equal to the love you make
--John Lennon & Paul McCartney (The End - Abbey Road, |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mycroes Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/The Matrix/movie_the_matrix_agent_smith.gif)
Joined: 26 May 2003 Posts: 110 Location: Netherlands
|
Posted: Wed Jun 04, 2003 6:03 pm Post subject: Thnx but... |
|
|
I think it would work with just forwarding ports 137 and 139, but I ran into another problem. Windows 2000 only seems to work with gateways ending with a .1, allthough it worked for a few days it stopped working yesterday so I'm on a different subnet now... I'll try to fix it later and then gonna do this all over again, I think I can get there without any more help now. Thnx all
Greetings,
Michael _________________ In a world without walls or fences we don't need windows or gates |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|