Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
windows machines zien elkaar niet door Gentoo router
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Dutch
View previous topic :: View next topic  
Author Message
wouzer
Tux's lil' helper
Tux's lil' helper


Joined: 11 Feb 2003
Posts: 88
Location: The Hague, The Netherlands

PostPosted: Fri Dec 29, 2006 11:19 am    Post subject: windows machines zien elkaar niet door Gentoo router Reply with quote

Ik krijg het niet voor elkaar om van win naar win te pingen (en dus te sharen) via mijn Gentoo router.

Ik heb twee servers staan. Een Gentoo router/firewall/fileserver/LAMP machientje en een win2k3 .NET ontwikkel bakkie. Daarnaast heb ik sinds kort een winxp lappie. Alle machienes kunnen zonder problemen op Internet. Beiden windows machienes kunnen ook zonder problemen op de samba shares van de Gentoo bak.

Als ik op de win2k3 "net view" doe, zie ik de machiene zelf en de Gentoo server. Als ik het zelde op mijn laptop doe, zie ik alleen de laptop. beide windows machienes krijgen een IP via dnsmasq (DHCP) en draaien zelf geen firewall.

Ik vermoed dat ik een route mis of een iptables rule. Kan iemand me helpen?

dit is mijn routing tabel:

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
[laptop 192.168.1.3]       *               255.255.255.255 UH    0      0        0 eth1 (192.168.1.1)
[win3k3 192.168.1.4]      *               255.255.255.255 UH    0      0        0 eth2 (192.168.1.2)
[extern ip]    *               255.255.255.128 U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth2
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
loopback        *               255.0.0.0       U     0      0        0 lo
default         [extern ip]    0.0.0.0         UG    0      0        0 eth0


En dit is mijn IPTables confc (uit de home network router guide):

Code:
#!/bin/bash
IPTABLES='/sbin/iptables'

#First we flush our current rules
$IPTABLES -F
$IPTABLES -t nat -F

#Setup default policies to handle unmatched traffic
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD DROP

#Copy and paste these examples ...
export WAN=eth0
export LAN1=eth1
export LAN2=eth2

#Then we lock our services so they only work from the LAN
$IPTABLES -I INPUT 1 -i ${LAN1} -j ACCEPT
$IPTABLES -I INPUT 1 -i ${LAN2} -j ACCEPT
$IPTABLES -I INPUT 1 -i lo -j ACCEPT
$IPTABLES -A INPUT -p UDP --dport bootps -i ! ${LAN1} -j REJECT
$IPTABLES -A INPUT -p UDP --dport bootps -i ! ${LAN2} -j REJECT
$IPTABLES -A INPUT -p UDP --dport domain -i ! ${LAN1} -j REJECT
$IPTABLES -A INPUT -p UDP --dport domain -i ! ${LAN2} -j REJECT

#(Optional) Allow access to our ssh server from the WAN
$IPTABLES -A INPUT -p TCP --dport 22 -i ${WAN} -j ACCEPT
$IPTABLES -A INPUT -p TCP --dport 80 -i ${WAN} -j ACCEPT

#Drop TCP / UDP packets to privileged ports
#$IPTABLES -A INPUT -p TCP -i ! ${LAN1} -d 0/0 --dport 0:10000 -j DROP
#$IPTABLES -A INPUT -p UDP -i ! ${LAN1} -d 0/0 --dport 0:10000 -j DROP
#$IPTABLES -A INPUT -p TCP -i ! ${LAN2} -d 0/0 --dport 0:10000 -j DROP
#$IPTABLES -A INPUT -p UDP -i ! ${LAN2} -d 0/0 --dport 0:10000 -j DROP

#Finally we add the rules for NAT
$IPTABLES -I FORWARD -i ${LAN1} -d 192.168.1.0/255.255.255.0 -j DROP
$IPTABLES -I FORWARD -i ${LAN2} -d 192.168.1.0/255.255.255.0 -j DROP
$IPTABLES -A FORWARD -i ${LAN1} -s 192.168.1.0/255.255.255.0 -j ACCEPT
$IPTABLES -A FORWARD -i ${LAN2} -s 192.168.1.0/255.255.255.0 -j ACCEPT
$IPTABLES -A FORWARD -i ${WAN} -d 192.168.1.0/255.255.255.0 -j ACCEPT
$IPTABLES -t nat -A POSTROUTING -o ${WAN} -j MASQUERADE

_________________
It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. (Mark Twain)
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Fri Dec 29, 2006 12:02 pm    Post subject: Reply with quote

Hoi Wouzer,

Zo te zien heb je bijde ethernet kaarten in hetzelfde subnet (192.168.1.0/24) gezet. Het zou netwerktechnisch beter zijn om bijvoorbeeld 192.168.1.0/24 voor eth1 te gebruiken en 192.168.2.0/24 voor eth2. Dat het met routering wel werkt komt omdat je specifieke routes voor de 2 machines erin hebt staan.

Dat ze elkaar niet kunnen pingen komt door je firewall:
Code:

$IPTABLES -I FORWARD -i ${LAN1} -d 192.168.1.0/255.255.255.0 -j DROP
$IPTABLES -I FORWARD -i ${LAN2} -d 192.168.1.0/255.255.255.0 -j DROP

Je blokkeerd alles wat van de interfaces af komt, en wat een destination heeft wat binnen hun subnet ligt, op zich niets mis mee, maar omdat eth1 en eth2 in hetzelfde subnet zitten blokkeer je dus ook al het verkeer hiertussen.

Om dit te voorkomen zou je kunnen doen:
Code:

$IPTABLES -I FORWARD -i ${LAN1} -o ${LAN2} -j ACCEPT
$IPTABLES -I FORWARD -i ${LAN2} -o ${LAN1} -j ACCEPT

Hiermee sta je al het verkeer toe tussen eth1 en eth2 voordat je dingen gaat blokkeren, maar dat is miscshien iets TE open :-)

Groeten,
pa4wdh
Back to top
View user's profile Send private message
lost+found
Guru
Guru


Joined: 15 Nov 2004
Posts: 509
Location: North~Sea~Coa~s~~t~~~

PostPosted: Fri Dec 29, 2006 12:11 pm    Post subject: Re: windows machines zien elkaar niet door Gentoo router Reply with quote

wouzer wrote:
... Ik vermoed dat ik een route mis of een iptables rule. ...


Als er iets in iptables blijft hangen, is daar wel achter te komen, door (tijdelijk) een logging chain toe te voegen.
Probeer dit script 'ns. Is wel een goeie i.m.o., en makkelijk te veranderen. Anders kun je loggen aan je bestaande script toevoegen, natuurlijk. :)
Back to top
View user's profile Send private message
wouzer
Tux's lil' helper
Tux's lil' helper


Joined: 11 Feb 2003
Posts: 88
Location: The Hague, The Netherlands

PostPosted: Sat Dec 30, 2006 7:13 am    Post subject: Reply with quote

Hey guys,
dank jullie wel voor de reacties.
ik heb helaas nu geen tijd om het uit te proberen, maar dat ga ik morgen zeker doen.
Ik laat nog wel weten of het gelukt is.
In elk geval een prettige jaarwisseling vast.
groeten,

Wouzer
_________________
It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. (Mark Twain)
Back to top
View user's profile Send private message
wouzer
Tux's lil' helper
Tux's lil' helper


Joined: 11 Feb 2003
Posts: 88
Location: The Hague, The Netherlands

PostPosted: Sun Dec 31, 2006 10:20 am    Post subject: Reply with quote

Ik heb de rules van pa4wdh uitgeprobeerd, maar het werkt nog steeds niet hoe ik wil.
Het script van lost+found is zo uitgebreid en ingewikkeld, dat ik het niet zo maar wil uitproberen.

typisch gevalletje van RTFM. Aldus ben ik begonnen aan:
http://iptables-tutorial.frozentux.net/iptables-tutorial.html

Als ik straks oud en wijs ben meer. In elk geval bedankt voor de hulp.
groeten,

Wouter
_________________
It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt. (Mark Twain)
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Sun Dec 31, 2006 11:38 am    Post subject: Reply with quote

Wat je eventueel ook nog kan proberen is om deze twee regels:
Code:

$IPTABLES -I FORWARD -i ${LAN1} -d 192.168.1.0/255.255.255.0 -j DROP
$IPTABLES -I FORWARD -i ${LAN2} -d 192.168.1.0/255.255.255.0 -j DROP

eruit te halen. Dit zijn volgens mij de regels die je tegenhouden.
Back to top
View user's profile Send private message
shinadul
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jul 2003
Posts: 90
Location: Netherlands

PostPosted: Wed Jan 10, 2007 12:12 pm    Post subject: Reply with quote

Misschien een hele domme, maar heb je ip_forward wel aan staan in de kernel?

Code:

cat /proc/sys/net/ipv4/ip_forward
1


Indien er een 0 staat ipv een 1, dien je dit te veranderen:

Code:

echo 1 >> /proc/sys/net/ipv4/ip_forward
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Dutch All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum